diff --git a/build.gradle b/build.gradle index 99a57b3..99a210f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' } apply from: 'https://dawnteammc.github.io/resources/gradle_scripts/fabric-mod/java-17.gradle' @@ -24,8 +24,8 @@ dependencies { modImplementation("com.terraformersmc:modmenu:${modmenu_version}") { exclude(group: "net.fabricmc.fabric-api") } - modImplementation "squeek.appleskin:appleskin-fabric:mc1.19.3-${appleskin_version}:api" - modImplementation("squeek.appleskin:appleskin-fabric:mc1.19.3-${appleskin_version}") { + modImplementation "squeek.appleskin:appleskin-fabric:mc1.19.4-${appleskin_version}:api" + modImplementation("squeek.appleskin:appleskin-fabric:mc1.19.4-${appleskin_version}") { exclude module: 'modmenu' } } diff --git a/gradle.properties b/gradle.properties index 5620b68..113be78 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,31 +17,31 @@ github_name=DawnAPI # CurseForge Metadata curseforge_slug=dawn curseforge_id=399309 -curseforge_game_versions=1.19.3, Java 17, Fabric +curseforge_game_versions=1.19.4, Java 17, Fabric curseforge_embedded_libraries=cloth-config curseforge_required_dependencies=fabric-api # Modrinth Metadata modrinth_slug=dawn modrinth_id=meZK2DCX -modrinth_game_versions=1.19.3 +modrinth_game_versions=1.19.4 modrinth_mod_loaders=fabric modrinth_embedded_dependencies=cloth-config modrinth_required_dependencies=fabric-api # https://fabricmc.net/develop/ -minecraft_version=1.19.3 -yarn_mappings=1.19.3+build.5 -loader_version=0.14.12 -fabric_version=0.72.0+1.19.3 +minecraft_version=1.19.4 +yarn_mappings=1.19.4+build.1 +loader_version=0.14.18 +fabric_version=0.76.0+1.19.4 # https://maven.shedaniel.me/me/shedaniel/cloth/cloth-config-fabric/ -cloth_version=9.0.94 +cloth_version=10.0.96 # https://maven.terraformersmc.com/releases/com/terraformersmc/terraform-api/terraform-shapes-api-v1 -terraform_shapes_version=5.0.0-beta.1 +terraform_shapes_version=6.1.0-alpha.4 # https://maven.terraformersmc.com/releases/com/terraformersmc/terraform-api/terraform-wood-api-v1 -terraform_wood_version=5.0.0-beta.1 +terraform_wood_version=6.1.0-alpha.4 # https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ -modmenu_version=5.0.2 +modmenu_version=6.1.0-rc.4 # https://maven.ryanliptak.com/squeek/appleskin/appleskin-fabric/ -appleskin_version=2.4.2 +appleskin_version=2.4.3 diff --git a/src/main/java/fr/hugman/dawn/DawnFactory.java b/src/main/java/fr/hugman/dawn/DawnFactory.java index 8ade813..c282066 100644 --- a/src/main/java/fr/hugman/dawn/DawnFactory.java +++ b/src/main/java/fr/hugman/dawn/DawnFactory.java @@ -155,26 +155,28 @@ public static SlabBlock slab(Block baseBlock) { return new SlabBlock(DawnBlockSettings.copy(baseBlock)); } - public static PressurePlateBlock pressurePlate(Block baseBlock, PressurePlateBlock.ActivationRule activationRule, SoundEvent depressSound, SoundEvent pressSound) { + public static PressurePlateBlock pressurePlate(Block baseBlock, PressurePlateBlock.ActivationRule activationRule, BlockSetType setType) { DawnBlockSettings settings = DawnBlockSettings.copy(baseBlock) .strength(0.5f) .noCollision(); - return new PressurePlateBlock(activationRule, settings, depressSound, pressSound); + return new PressurePlateBlock(activationRule, settings, setType); } public static PressurePlateBlock pressurePlate(Block baseBlock) { - return pressurePlate(baseBlock, PressurePlateBlock.ActivationRule.MOBS, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON); + return pressurePlate(baseBlock, PressurePlateBlock.ActivationRule.MOBS, BlockSetType.OAK); } - public static ButtonBlock woodenButton(boolean isNether) { + public static ButtonBlock woodenButton(boolean isNether, BlockSetType setType) { return new ButtonBlock(DawnBlockSettings.of(Material.DECORATION) .item() .strength(0.5f) .noCollision() .sounds(isNether ? BlockSoundGroup.NETHER_WOOD : BlockSoundGroup.WOOD), - 30, true, - isNether ? SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF : SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, - isNether ? SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_ON : SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON); + setType, 30, true); + } + + public static ButtonBlock woodenButton(boolean isNether) { + return woodenButton(isNether, BlockSetType.OAK); } public static FenceBlock fence(boolean isNether, Block baseBlock) { @@ -184,38 +186,38 @@ public static FenceBlock fence(boolean isNether, Block baseBlock) { } - public static FenceGateBlock fenceGate(boolean isNether, Block baseBlock, SoundEvent closeSound, SoundEvent openSound) { + public static FenceGateBlock fenceGate(boolean isNether, Block baseBlock, WoodType woodType) { DawnBlockSettings settings = DawnBlockSettings.copy(baseBlock).item(new DawnItemSettings().fuelTime(isNether ? 0 : 300)); if(isNether) settings.flammability(5, 20); - return new FenceGateBlock(settings, closeSound, openSound); + return new FenceGateBlock(settings, woodType); } public static FenceGateBlock fenceGate(boolean isNether, Block baseBlock) { - return fenceGate(isNether, baseBlock, SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN); + return fenceGate(isNether, baseBlock, WoodType.OAK); } public static WallBlock wall(Block baseBlock) { return new WallBlock(DawnBlockSettings.copy(baseBlock)); } - public static TrapdoorBlock trapdoor(Block baseBlock, SoundEvent closeSound, SoundEvent openSound) { + public static TrapdoorBlock trapdoor(Block baseBlock, BlockSetType setType) { DawnBlockSettings settings = DawnBlockSettings.copy(baseBlock) .strength(3.0f) .nonOpaque() .allowsSpawning((state, world, pos, type) -> false); - return new TrapdoorBlock(settings, closeSound, openSound); + return new TrapdoorBlock(settings, setType); } public static TrapdoorBlock woodenTrapdoor(Block baseBlock) { - return trapdoor(baseBlock, SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN); + return trapdoor(baseBlock, BlockSetType.OAK); } - public static DoorBlock door(Block baseBlock, SoundEvent openSound, SoundEvent closeSound) { - return new DoorBlock(DawnBlockSettings.copy(baseBlock).strength(3.0f).nonOpaque(), openSound, closeSound); + public static DoorBlock door(Block baseBlock, BlockSetType setType) { + return new DoorBlock(DawnBlockSettings.copy(baseBlock).strength(3.0f).nonOpaque(), setType); } public static DoorBlock woodenDoor(Block baseBlock) { - return door(baseBlock, SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE); + return door(baseBlock, BlockSetType.OAK); } public static SaplingBlock sapling(SaplingGenerator generator) { diff --git a/src/main/java/fr/hugman/dawn/block/DawnBlockSettings.java b/src/main/java/fr/hugman/dawn/block/DawnBlockSettings.java index 0b67e96..c460d1c 100644 --- a/src/main/java/fr/hugman/dawn/block/DawnBlockSettings.java +++ b/src/main/java/fr/hugman/dawn/block/DawnBlockSettings.java @@ -269,14 +269,8 @@ public DawnBlockSettings dropsNothing() { } @Override - public DawnBlockSettings offsetType(AbstractBlock.OffsetType offsetType) { - super.offsetType(offsetType); - return this; - } - - @Override - public DawnBlockSettings offsetType(Function offsetType) { - super.offsetType(offsetType); + public DawnBlockSettings offset(AbstractBlock.OffsetType offsetType) { + super.offset(offsetType); return this; } diff --git a/src/main/java/fr/hugman/dawn/client/render/entity/FlyingBlockEntityRenderer.java b/src/main/java/fr/hugman/dawn/client/render/entity/FlyingBlockEntityRenderer.java index e44f129..d688aa3 100644 --- a/src/main/java/fr/hugman/dawn/client/render/entity/FlyingBlockEntityRenderer.java +++ b/src/main/java/fr/hugman/dawn/client/render/entity/FlyingBlockEntityRenderer.java @@ -34,7 +34,7 @@ public void render(FlyingBlockEntity entity, float entityYaw, float partialTicks World world = entity.getWorldClient(); if(blockState != world.getBlockState(entity.getBlockPos()) && blockState.getRenderType() != BlockRenderType.INVISIBLE) { matrixStack.push(); - BlockPos blockPos = new BlockPos(entity.getX(), entity.getBoundingBox().maxY, entity.getZ()); + BlockPos blockPos = BlockPos.ofFloored(entity.getX(), entity.getBoundingBox().maxY, entity.getZ()); matrixStack.translate(-0.5D, 0.0D, -0.5D); BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager(); blockRenderManager.getModelRenderer().render(world, blockRenderManager.getModel(blockState), blockState, blockPos, matrixStack, vertexConsumerProvider.getBuffer(RenderLayers.getMovingBlockLayer(blockState)), false, Random.create(), blockState.getRenderingSeed(entity.getFallingBlockPos()), OverlayTexture.DEFAULT_UV); diff --git a/src/main/java/fr/hugman/dawn/codec/DawnCodecs.java b/src/main/java/fr/hugman/dawn/codec/DawnCodecs.java index 1aba9bd..9683e3e 100644 --- a/src/main/java/fr/hugman/dawn/codec/DawnCodecs.java +++ b/src/main/java/fr/hugman/dawn/codec/DawnCodecs.java @@ -32,7 +32,7 @@ public final class DawnCodecs { private static Codec nonZeroIntProvider() { Function> function = (provider) -> { if(provider.getMin() <= 0 && provider.getMax() >= 0) { - return DataResult.error("Value provider should not contain the zero value: [" + provider.getMin() + "-" + provider.getMax() + "]"); + return DataResult.error(() -> "Value provider should not contain the zero value: [" + provider.getMin() + "-" + provider.getMax() + "]"); } return DataResult.success(provider); }; @@ -42,7 +42,7 @@ private static Codec nonZeroIntProvider() { private static Codec nonZeroFloatProvider() { Function> function = (provider) -> { if(provider.getMin() <= 0.0F && provider.getMax() >= 0.0F) { - return DataResult.error("Value provider should not contain the zero value: [" + provider.getMin() + "-" + provider.getMax() + "]"); + return DataResult.error(() -> "Value provider should not contain the zero value: [" + provider.getMin() + "-" + provider.getMax() + "]"); } return DataResult.success(provider); }; @@ -69,7 +69,7 @@ private static Function> createRangeChecker( if(((Comparable) value).compareTo(min) >= 0 && ((Comparable) value).compareTo(max) <= 0) { return DataResult.success(value); } - return DataResult.error((String) messageFactory.apply(value)); + return DataResult.error(() -> messageFactory.apply(value)); }; } } diff --git a/src/main/java/fr/hugman/dawn/command/HealthCommand.java b/src/main/java/fr/hugman/dawn/command/HealthCommand.java index 51059ad..ae9f2ef 100644 --- a/src/main/java/fr/hugman/dawn/command/HealthCommand.java +++ b/src/main/java/fr/hugman/dawn/command/HealthCommand.java @@ -63,9 +63,6 @@ private static int setHealth(ServerCommandSource source, Collection 0.0F) { livingEntity.heal(amount); } - else if(amount < 0.0F) { - livingEntity.damage(DamageSource.OUT_OF_WORLD, amount * -1.0f); - } } else { if(livingEntity.getHealth() > 0.0F) { diff --git a/src/main/java/fr/hugman/dawn/entity/CustomTNTEntity.java b/src/main/java/fr/hugman/dawn/entity/CustomTNTEntity.java index b657e14..5320198 100644 --- a/src/main/java/fr/hugman/dawn/entity/CustomTNTEntity.java +++ b/src/main/java/fr/hugman/dawn/entity/CustomTNTEntity.java @@ -8,20 +8,18 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.MovementType; -import net.minecraft.entity.TntEntity; import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtHelper; -import net.minecraft.network.Packet; import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket; import net.minecraft.particle.ParticleTypes; -import net.minecraft.util.crash.CrashReportSection; import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.crash.CrashReportSection; import net.minecraft.world.World; -import net.minecraft.world.explosion.Explosion; public class CustomTNTEntity extends Entity { private static final TrackedData FUSE = DataTracker.registerData(CustomTNTEntity.class, TrackedDataHandlerRegistry.INTEGER); diff --git a/src/main/java/fr/hugman/dawn/entity/FlyingBlockEntity.java b/src/main/java/fr/hugman/dawn/entity/FlyingBlockEntity.java index f42ef88..1a8ddc7 100644 --- a/src/main/java/fr/hugman/dawn/entity/FlyingBlockEntity.java +++ b/src/main/java/fr/hugman/dawn/entity/FlyingBlockEntity.java @@ -8,7 +8,6 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.FallingBlockEntity; import net.minecraft.entity.MovementType; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.data.DataTracker; @@ -20,8 +19,8 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; import net.minecraft.nbt.NbtHelper; -import net.minecraft.network.Packet; import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.registry.tag.BlockTags; @@ -221,7 +220,7 @@ public boolean handleFallDamage(float fallDistance, float damageMultiplier, Dama } else { predicate2 = EntityPredicates.EXCEPT_SPECTATOR; - damageSource3 = DamageSource.fallingBlock(this); + damageSource3 = this.getDamageSources().fallingBlock(this); } float f = (float) Math.min(MathHelper.floor((float) i * this.flyHurtAmount), this.flyHurtMax);