Skip to content

Commit

Permalink
Merge branch '1.20.1-main' into compat
Browse files Browse the repository at this point in the history
  • Loading branch information
f-raZ0R authored Oct 3, 2024
2 parents aea4133 + 4bd30af commit 9aa4d20
Show file tree
Hide file tree
Showing 152 changed files with 1,859 additions and 525 deletions.
61 changes: 24 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ plugins {
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
mavenLocal()
maven { url = "https://jitpack.io" } // Arrowhead, Dimensional Reverb, Step Height Entity Attribute
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url = "https://maven.terraformersmc.com/" } // Modmenu, EMI
maven { url = "https://maven.nucleoid.xyz/" } // Common Protection API
Expand All @@ -23,6 +22,8 @@ repositories {
maven { url = "https://cfa2.cursemaven.com" }
maven { url = "https://repo.unascribed.com" } // Ears API
maven { url = "https://dl.cloudsmith.io/public/klikli-dev/mods/maven/" } // Modonomicon
maven { url = "https://maven.is-immensely.gay/" } // Matchbooks
maven { url = "https://jitpack.io" } // Arrowhead, Dimensional Reverb, Step Height Entity Attribute
mavenCentral()
}

Expand All @@ -44,7 +45,7 @@ dependencies {
modImplementation ("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")

// mine
modImplementation ("maven.modrinth:exclusions-lib:0.6")
modImplementation include("maven.modrinth:exclusions-lib:0.6")
modImplementation ("maven.modrinth:Revelationary:${project.revelationary_version}")
modImplementation include("maven.modrinth:AdditionalEntityAttributes:${project.additional_entity_attributes_version}")
modImplementation include("com.github.DaFuqs:Arrowhead:${project.arrowhead_version}")
Expand Down Expand Up @@ -114,16 +115,6 @@ loom {
}
}

sourceSets {
main {
resources {
srcDirs += [
'src/main/generated'
]
}
}
}

processResources {
inputs.property "version", project.version

Expand All @@ -132,47 +123,43 @@ processResources {
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
it.options.release = 17 // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
from("LICENSE.md") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}" }
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
mavenLocal()
maven {
name "sapphoCompany"
url = "https://maven.is-immensely.gay/releases"
credentials {
username = "dafuqs"
password = System.getenv("MAVEN_PASS")
}
}
}
}
4 changes: 3 additions & 1 deletion credits/Freesound - The Mist by DaveJf.URL
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[InternetShortcut]
URL=https://freesound.org/people/DaveJf/sounds/556315/
URL=https://freesound.org/people/DaveJf/sounds/556315/

music.discovery_theme
2 changes: 1 addition & 1 deletion credits/Youtube - Radiarc - Irrelevance Fading.URL
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ https://www.youtube.com/watch?v=-V1VpPBvh-k
Explicitly gotten permission to use this beautiful piece:
"Feel free to use whatever you'd like! All I ask is that I'm credited for the music, and that it isn't a commercial project (if so, just message me so we can discuss it)"

Used for as background music of the dimension
Used for as background music of the dimension "music.credits"
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true

# Fabric Properties
minecraft_version=1.20.1
Expand All @@ -8,8 +9,8 @@ loader_version=0.16.4

# Mod Properties
mod_version=1.8.0
maven_group=de.dafuqs.spectrum
archives_base_name=spectrum-deeper-down
maven_group=de.dafuqs
archives_base_name=spectrum

# Dependencies
# https://fabricmc.net/develop/
Expand Down
File renamed without changes
2 changes: 0 additions & 2 deletions src/main/java/de/dafuqs/spectrum/SpectrumCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ public void onInitialize() {
SpectrumParticleTypes.register();
logInfo("Registering Sound Events...");
SpectrumSoundEvents.register();
logInfo("Registering Music...");
SpectrumMusicType.register();
logInfo("Registering BlockSound Groups...");
SpectrumBlockSoundGroups.register();
logInfo("Registering Fluids...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Pair<Item, Item> getItemCloak() {

@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContextParameterSet.Builder builder) {
Entity entity = builder.get(LootContextParameters.THIS_ENTITY);
Entity entity = builder.getOptional(LootContextParameters.THIS_ENTITY);
if (entity instanceof EndermanEntity) {
return List.of(SpectrumBlocks.RADIATING_ENDER.asItem().getDefaultStack());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.dafuqs.spectrum.blocks.decoration;

import de.dafuqs.spectrum.*;
import net.minecraft.block.*;
import net.minecraft.block.entity.*;
import net.minecraft.util.*;
import net.minecraft.util.math.*;
import net.minecraft.util.shape.*;
import net.minecraft.world.*;
import org.jetbrains.annotations.*;

public class ProjectorBlock extends Block implements BlockEntityProvider {

private final VoxelShape shape;
final float heightOffset, bobMultiplier, scaling;
final Identifier texture;

public ProjectorBlock(Settings settings, String path, double width, double height, float heightOffset, float bobMultiplier, float scaling) {
super(settings);
this.heightOffset = heightOffset;
this.bobMultiplier = bobMultiplier;
this.scaling = scaling;
var min = (16 - width) / 2;
var max = width + min;
shape = Block.createCuboidShape(min, 0, min, max, height, max);
this.texture = SpectrumCommon.locate("textures/block/" + path + ".png");
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return shape;
}

@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new ProjectorBlockEntity(pos, state);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.dafuqs.spectrum.blocks.decoration;

import de.dafuqs.spectrum.registries.*;
import net.minecraft.block.*;
import net.minecraft.block.entity.*;
import net.minecraft.util.*;
import net.minecraft.util.math.*;

public class ProjectorBlockEntity extends BlockEntity {

final Identifier texture;
final float heightOffset, bobMultiplier, scaling;

public ProjectorBlockEntity(BlockPos pos, BlockState state) {
super(SpectrumBlockEntities.PROJECTOR, pos, state);
var projectorBlock = (ProjectorBlock) state.getBlock();
heightOffset = projectorBlock.heightOffset;
bobMultiplier = projectorBlock.bobMultiplier;
texture = projectorBlock.texture;
scaling = projectorBlock.scaling;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package de.dafuqs.spectrum.blocks.decoration;

import net.minecraft.client.*;
import net.minecraft.client.render.*;
import net.minecraft.client.render.block.entity.*;
import net.minecraft.client.render.entity.*;
import net.minecraft.client.util.math.*;
import net.minecraft.util.math.*;
import org.joml.*;

import java.lang.*;
import java.lang.Math;

public class ProjectorBlockEntityRenderer implements BlockEntityRenderer<ProjectorBlockEntity> {

protected static EntityRenderDispatcher dispatcher;

public ProjectorBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
dispatcher = MinecraftClient.getInstance().getEntityRenderDispatcher();
}

@Override
public void render(ProjectorBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
float time = entity.getWorld().getTime() % 24000 + tickDelta;
double bob = Math.sin((time / 19)) * 0.075 * entity.bobMultiplier;

matrices.push();
matrices.translate(0.5D, entity.heightOffset + bob, 0.5D);
var center = Vec3d.of(entity.getPos()).add(0.5, 0, 0.5);
var xOffset = center.getX() - dispatcher.camera.getPos().x;
var zOffset = center.getZ() - dispatcher.camera.getPos().z;
matrices.multiply(RotationAxis.POSITIVE_Y.rotation((float) MathHelper.atan2(xOffset, zOffset)));
var buffer = vertexConsumers.getBuffer(RenderLayer.getEntityTranslucent(entity.texture));
renderRing(matrices, buffer, entity.scaling, 0.75F, overlay, Direction.UP);
matrices.pop();
}

//Yes I did in fact just steal this from pastel nodes :3
private void renderRing(MatrixStack matrices, VertexConsumer vertices, float scale, float alpha, int overlay, Direction facing) {
var size = scale / 16F;
matrices.translate(-size / 2F, -size / 2F, 0);

var peek = matrices.peek();
var model = peek.getPositionMatrix();
var normals = peek.getNormalMatrix();
var transform = normals.transform(new Vector3f(facing.getUnitVector()));
renderSide(model, normals, vertices, alpha, scale, scale, 0, size, 0, size, transform.x, transform.y, transform.z, overlay);
}

private void renderSide(Matrix4f model, Matrix3f normals, VertexConsumer vertices, float alpha, float u, float v, float x1, float x2, float z1, float z2, float n1, float n2, float n3, int overlay) {
float u1 = 0, v1 = 0;
float u2 = u1 + u / 16F, v2 = v1 + v / 16F;

vertices.vertex(model, x1, z2, 0).color(1F, 1F, 1F, alpha).texture(u1, v1).overlay(overlay).light(LightmapTextureManager.MAX_LIGHT_COORDINATE).normal(0, 1, 0).next();
vertices.vertex(model, x2, z2, 0).color(1F, 1F, 1F, alpha).texture(u2, v1).overlay(overlay).light(LightmapTextureManager.MAX_LIGHT_COORDINATE).normal(0, 1, 0).next();
vertices.vertex(model, x2, z1, 0).color(1F, 1F, 1F, alpha).texture(u2, v2).overlay(overlay).light(LightmapTextureManager.MAX_LIGHT_COORDINATE).normal(0, 1, 0).next();
vertices.vertex(model, x1, z1, 0).color(1F, 1F, 1F, alpha).texture(u1, v2).overlay(overlay).light(LightmapTextureManager.MAX_LIGHT_COORDINATE).normal(0, 1, 0).next();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package de.dafuqs.spectrum.blocks.geology;

import de.dafuqs.spectrum.blocks.conditional.*;
import de.dafuqs.spectrum.networking.*;
import de.dafuqs.spectrum.helpers.*;
import de.dafuqs.spectrum.particle.*;
import de.dafuqs.spectrum.registries.*;
import net.fabricmc.api.*;
import net.minecraft.block.*;
import net.minecraft.client.*;
import net.minecraft.entity.*;
import net.minecraft.entity.player.*;
import net.minecraft.server.world.*;
import net.minecraft.sound.*;
import net.minecraft.util.*;
import net.minecraft.util.math.*;
Expand All @@ -25,36 +25,44 @@ public AzuriteOreBlock(Settings settings, UniformIntProvider uniformIntProvider,
@Override
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
super.onSteppedOn(world, pos, state, entity);
if (!world.isClient() && !entity.bypassesSteppingEffects() && world.random.nextInt(3) == 0) {
SpectrumS2CPacketSender.playParticleAroundBlockSides((ServerWorld) world, 1, Vec3d.of(pos), Vec3d.ZERO, SpectrumParticleTypes.AZURE_MOTE_SMALL, this::isVisibleTo, Direction.UP);
if (world.isClient() && !entity.bypassesSteppingEffects() && world.random.nextInt(3) == 0 && entity instanceof PlayerEntity player && this.isVisibleTo(player)) {
ParticleHelper.playParticleAroundBlockSides(world, SpectrumParticleTypes.AZURE_MOTE_SMALL, Vec3d.of(pos), new Direction[]{Direction.UP}, 1, Vec3d.ZERO);
}
}

@Override
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
super.onBroken(world, pos, state);
if (!world.isClient()) {
SpectrumS2CPacketSender.playParticleAroundArea((ServerWorld) world, 1, 0, false, true, Vec3d.ZERO, Vec3d.ofCenter(pos), new Vec3d(0, 0.08D + world.getRandom().nextDouble() * 0.04, 0), SpectrumParticleTypes.AZURE_AURA, this::isVisibleTo);
SpectrumS2CPacketSender.playParticleAroundBlockSides((ServerWorld) world, 3, Vec3d.of(pos), Vec3d.ZERO, SpectrumParticleTypes.AZURE_MOTE_SMALL, this::isVisibleTo, Direction.values());
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
super.onBreak(world, pos, state, player);

if (world.isClient() && this.isVisibleTo(player)) {
ParticleHelper.playTriangulatedParticle(world, SpectrumParticleTypes.AZURE_AURA, 1, false, Vec3d.ZERO, 0, true, Vec3d.ofCenter(pos), new Vec3d(0, 0.08D + world.getRandom().nextDouble() * 0.04, 0));
ParticleHelper.playParticleAroundBlockSides(world, SpectrumParticleTypes.AZURE_MOTE_SMALL, Vec3d.of(pos), Direction.values(), 3, Vec3d.ZERO);
}
}

@Override
public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) {
super.onBlockBreakStart(state, world, pos, player);
if (!world.isClient()) {
SpectrumS2CPacketSender.playParticleAroundBlockSides((ServerWorld) world, 1, Vec3d.of(pos), Vec3d.ZERO, SpectrumParticleTypes.AZURE_MOTE, this::isVisibleTo, Direction.values());

if (world.isClient() && this.isVisibleTo(player)) {
ParticleHelper.playParticleAroundBlockSides(world, SpectrumParticleTypes.AZURE_MOTE, Vec3d.of(pos), Direction.values(), 1, Vec3d.ZERO);
}
}


@Environment(EnvType.CLIENT)
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
SpectrumS2CPacketSender.playParticleAroundArea(world, 8, -12, false, true, new Vec3d(32, 8, 32), Vec3d.of(pos), new Vec3d(0, 0.04D + random.nextDouble() * 0.06, 0), SpectrumParticleTypes.AZURE_AURA, this::isVisibleTo);
SpectrumS2CPacketSender.playParticleAroundArea(world, 12, -12, true, true, new Vec3d(32, 8, 32), Vec3d.of(pos), new Vec3d(0, 0.04D + random.nextDouble() * 0.06, 0), SpectrumParticleTypes.AZURE_AURA, this::isVisibleTo);
SpectrumS2CPacketSender.playParticleAroundArea(world, 19, -8, false, false, new Vec3d(24, 8,24), Vec3d.of(pos), Vec3d.ZERO, SpectrumParticleTypes.AZURE_MOTE_SMALL, this::isVisibleTo);
SpectrumS2CPacketSender.playParticleAroundArea(world, 17, -6, true, false, new Vec3d(24, 6,24), Vec3d.of(pos), Vec3d.ZERO, SpectrumParticleTypes.AZURE_MOTE, this::isVisibleTo);
SpectrumS2CPacketSender.playParticleAroundArea(world, 5, 0, false, true, new Vec3d(2, 0, 2), Vec3d.of(pos), new Vec3d(0, 0.07D + random.nextDouble() * 0.06, 0), SpectrumParticleTypes.AZURE_AURA, this::isVisibleTo);
SpectrumS2CPacketSender.playParticleAroundBlockSides(world, random.nextBetween(1, 3), Vec3d.of(pos), Vec3d.ZERO, SpectrumParticleTypes.AZURE_MOTE, this::isVisibleTo, Direction.values());
world.playSound(null, pos, SpectrumSoundEvents.SOFT_HUM, SoundCategory.BLOCKS, 1F, random.nextFloat() * 0.5F + 1F);
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
super.randomDisplayTick(state, world, pos, random);

if (this.isVisibleTo(MinecraftClient.getInstance().player) && world.getRandom().nextFloat() < 0.02) {
ParticleHelper.playTriangulatedParticle(world, SpectrumParticleTypes.AZURE_AURA, 8, false, new Vec3d(32, 8, 32), -12, true, Vec3d.of(pos), new Vec3d(0, 0.04D + random.nextDouble() * 0.06, 0));
ParticleHelper.playTriangulatedParticle(world, SpectrumParticleTypes.AZURE_AURA, 12, true, new Vec3d(32, 8, 32), -12, true, Vec3d.of(pos), new Vec3d(0, 0.04D + random.nextDouble() * 0.06, 0));
ParticleHelper.playTriangulatedParticle(world, SpectrumParticleTypes.AZURE_MOTE_SMALL, 19, false, new Vec3d(24, 8, 24), -8, false, Vec3d.of(pos), Vec3d.ZERO);
ParticleHelper.playTriangulatedParticle(world, SpectrumParticleTypes.AZURE_MOTE, 17, true, new Vec3d(24, 6, 24), -6, false, Vec3d.of(pos), Vec3d.ZERO);
ParticleHelper.playTriangulatedParticle(world, SpectrumParticleTypes.AZURE_AURA, 5, false, new Vec3d(2, 0, 2), 0, true, Vec3d.of(pos), new Vec3d(0, 0.07D + random.nextDouble() * 0.06, 0));
ParticleHelper.playParticleAroundBlockSides(world, SpectrumParticleTypes.AZURE_MOTE, Vec3d.of(pos), Direction.values(), random.nextBetween(1, 3), Vec3d.ZERO);
world.playSound(null, pos, SpectrumSoundEvents.SOFT_HUM, SoundCategory.BLOCKS, 1F, random.nextFloat() * 0.5F + 1F);
}
}

}
Loading

0 comments on commit 9aa4d20

Please sign in to comment.