diff --git a/CHANGELOG.md b/CHANGELOG.md index 46b7e1fe5b..00d2e8f07c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,7 @@ Please clear changelog after each release. Thank you! ----------------- -# Wilder Wild 2.2 -## What's new? - +Additions --- - ### Added the Crab! @@ -23,14 +21,12 @@ Thank you! - Does not affect attacking, only impacts interactions with Items and Blocks including both placing and breaking. - There is, however, a config option to let this impact attack reach. -## Bug Fixes & Other Changes - +Bug Fixes & Other Changes --- - Milkweed now plays a sound when rustled - Milkweed can now be sheared with a Dispenser - Glory of the Snow can now be sheared with a Dispenser -- Fixed Mesoglea liquid rendering extending 16 tiles out instead of only encompassing 1 tile - Fixed Jellyfish no longer spawning in Jellyfish Caves - Slightly optimized Jellyfish rendering with the rainbow easter egg - Added a translation string for Coconut projectiles @@ -43,4 +39,5 @@ Thank you! - Fixed Display Lantern silk touch loot table - Fixed compatibility with Roughly Enough Resources ([#315](https://github.com/FrozenBlock/WilderWild/issues/315)) - Added Palm Crowns into tags it was missing from +- Hopefully resolved world generation issues with C2ME ([#311](https://github.com/FrozenBlock/WilderWild/issues/311)) - Refactored multiple classes to improve internal organization diff --git a/src/main/java/net/frozenblock/wilderwild/block/HangingTendrilBlock.java b/src/main/java/net/frozenblock/wilderwild/block/HangingTendrilBlock.java index 20dd3e0e54..1d3f7e8f39 100644 --- a/src/main/java/net/frozenblock/wilderwild/block/HangingTendrilBlock.java +++ b/src/main/java/net/frozenblock/wilderwild/block/HangingTendrilBlock.java @@ -216,7 +216,7 @@ public void activate(@Nullable Entity entity, @NotNull Level world, @NotNull Blo SculkSensorBlock.tryResonateVibration(entity, world, pos, j); boolean tendrilsCarryEvents = BlockConfig.get().tendrilsCarryEvents; world.gameEvent(tendrilsCarryEvents ? entity : null, VibrationSystem.getResonanceEventByFrequency(j), pos); - world.gameEvent(tendrilsCarryEvents ? entity : null, tendrilsCarryEvents ? gameEvent : GameEvent.SCULK_SENSOR_TENDRILS_CLICKING, pos); + world.gameEvent(tendrilsCarryEvents ? entity : null, tendrilsCarryEvents && gameEvent != null ? gameEvent : GameEvent.SCULK_SENSOR_TENDRILS_CLICKING, pos); if (!state.getValue(WATERLOGGED)) { world.playSound( null, diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Crab.java b/src/main/java/net/frozenblock/wilderwild/entity/Crab.java index 03f979c309..ab49d2990a 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Crab.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Crab.java @@ -103,7 +103,6 @@ import net.minecraft.world.level.gameevent.PositionSource; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; import net.minecraft.world.level.pathfinder.BlockPathTypes; -import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; diff --git a/src/main/java/net/frozenblock/wilderwild/misc/mod_compat/FrozenLibIntegration.java b/src/main/java/net/frozenblock/wilderwild/misc/mod_compat/FrozenLibIntegration.java index 913074763c..b229e4ba45 100644 --- a/src/main/java/net/frozenblock/wilderwild/misc/mod_compat/FrozenLibIntegration.java +++ b/src/main/java/net/frozenblock/wilderwild/misc/mod_compat/FrozenLibIntegration.java @@ -66,7 +66,6 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.item.InstrumentItem; @@ -88,7 +87,6 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class FrozenLibIntegration extends ModIntegration { public FrozenLibIntegration() { diff --git a/src/main/java/net/frozenblock/wilderwild/mixin/sculk/SculkBlockMixin.java b/src/main/java/net/frozenblock/wilderwild/mixin/sculk/SculkBlockMixin.java index 210ccdf6e5..195fc9a485 100644 --- a/src/main/java/net/frozenblock/wilderwild/mixin/sculk/SculkBlockMixin.java +++ b/src/main/java/net/frozenblock/wilderwild/mixin/sculk/SculkBlockMixin.java @@ -104,12 +104,8 @@ public abstract class SculkBlockMixin { @Unique private Optional wilderWild$additionalGrowthCost = Optional.empty(); @Unique - private boolean wilderWild$isWorldgen; - @Unique private boolean wilderWild$canPlace; @Unique - private RandomSource wilderWild$randomSource; - @Unique private BlockPos wilderWild$placedPos; @Unique private BlockState wilderWild$placedState; @@ -152,17 +148,16 @@ public abstract class SculkBlockMixin { } @ModifyExpressionValue(method = "attemptUseCharge", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/SculkBlock;canPlaceGrowth(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;)Z")) - private boolean wilderWild$newWorldgenCharge(boolean original, SculkSpreader.ChargeCursor chargeCursor, LevelAccessor levelAccessor, BlockPos blockPos, RandomSource randomSource, SculkSpreader sculkSpreader, boolean bl) { + private boolean wilderWild$newWorldgenCharge(boolean original, SculkSpreader.@NotNull ChargeCursor chargeCursor, LevelAccessor levelAccessor, BlockPos blockPos, RandomSource randomSource, @NotNull SculkSpreader sculkSpreader, boolean bl) { return this.wilderWild$canPlaceGrowth(levelAccessor, chargeCursor.getPos(), sculkSpreader.isWorldGeneration()) || original; } @Inject(method = "attemptUseCharge", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/SculkBlock;getRandomGrowthState(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/util/RandomSource;Z)Lnet/minecraft/world/level/block/state/BlockState;"), locals = LocalCapture.CAPTURE_FAILHARD) - private void wilderWild$getPlacementState(SculkSpreader.ChargeCursor cursor, LevelAccessor level, BlockPos pos, RandomSource random, SculkSpreader spreader, boolean shouldConvertBlocks, CallbackInfoReturnable cir, int charge, BlockPos chargePos, boolean withinNoGrowthRadius, int growthSpawnCost, BlockPos blockPos2) { + private void wilderWild$getPlacementState(SculkSpreader.ChargeCursor charge, LevelAccessor level, BlockPos catalystPos, RandomSource random, @NotNull SculkSpreader sculkChargeHandler, boolean shouldConvertBlocks, CallbackInfoReturnable cir, int chargeAmount, BlockPos chargePos, int growthSpawnCost, BlockPos aboveChargePos) { this.wilderWild$placementState = null; this.wilderWild$placementPos = null; this.wilderWild$additionalGrowthCost = Optional.empty(); - this.wilderWild$isWorldgen = spreader.isWorldGeneration(); - this.wilderWild$randomSource = random; + boolean isWorldgen = sculkChargeHandler.isWorldGeneration(); if (this.wilderWild$isPlacingBelow) { BlockPos belowCharge = chargePos.below(); @@ -176,16 +171,16 @@ public abstract class SculkBlockMixin { this.wilderWild$additionalGrowthCost = Optional.of(1); } - if (this.wilderWild$isWorldgen && this.wilderWild$placementState != null && this.wilderWild$placementState.is(RegisterBlocks.OSSEOUS_SCULK)) { + if (isWorldgen && this.wilderWild$placementState != null && this.wilderWild$placementState.is(RegisterBlocks.OSSEOUS_SCULK)) { this.wilderWild$additionalGrowthCost = Optional.of(growthSpawnCost + 2); } BlockState chargePosState = level.getBlockState(chargePos); - if ((this.wilderWild$isWorldgen && chargePosState.is(WilderBlockTags.SCULK_STAIR_REPLACEABLE_WORLDGEN)) || chargePosState.is(WilderBlockTags.SCULK_STAIR_REPLACEABLE)) { + if ((isWorldgen && chargePosState.is(WilderBlockTags.SCULK_STAIR_REPLACEABLE_WORLDGEN)) || chargePosState.is(WilderBlockTags.SCULK_STAIR_REPLACEABLE)) { this.wilderWild$placementState = RegisterBlocks.SCULK_STAIRS.withPropertiesOf(chargePosState); - } else if ((this.wilderWild$isWorldgen && chargePosState.is(WilderBlockTags.SCULK_SLAB_REPLACEABLE_WORLDGEN)) || chargePosState.is(WilderBlockTags.SCULK_SLAB_REPLACEABLE)) { + } else if ((isWorldgen && chargePosState.is(WilderBlockTags.SCULK_SLAB_REPLACEABLE_WORLDGEN)) || chargePosState.is(WilderBlockTags.SCULK_SLAB_REPLACEABLE)) { this.wilderWild$placementState = RegisterBlocks.SCULK_SLAB.withPropertiesOf(chargePosState); - } else if ((this.wilderWild$isWorldgen && chargePosState.is(WilderBlockTags.SCULK_WALL_REPLACEABLE_WORLDGEN)) || chargePosState.is(WilderBlockTags.SCULK_WALL_REPLACEABLE)) { + } else if ((isWorldgen && chargePosState.is(WilderBlockTags.SCULK_WALL_REPLACEABLE_WORLDGEN)) || chargePosState.is(WilderBlockTags.SCULK_WALL_REPLACEABLE)) { this.wilderWild$placementState = RegisterBlocks.SCULK_WALL.withPropertiesOf(chargePosState); } @@ -194,7 +189,7 @@ public abstract class SculkBlockMixin { @ModifyArgs(method = "attemptUseCharge", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/LevelAccessor;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z")) private void wilderWild$newPlace(Args args) { - if (this.wilderWild$placementPos == null && this.wilderWild$placementState == null && this.wilderWild$placedPos == null && this.wilderWild$placedState == null) { + if (this.wilderWild$placementPos == null || this.wilderWild$placementState == null) { return; } if (this.wilderWild$canPlace) { @@ -207,7 +202,7 @@ public abstract class SculkBlockMixin { @ModifyArgs(method = "attemptUseCharge", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/LevelAccessor;playSound(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/core/BlockPos;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FF)V")) private void wilderWild$newSounds(Args args) { - if (this.wilderWild$placedState == null || this.wilderWild$placedPos == null) { + if (this.wilderWild$placedPos == null || this.wilderWild$placedState == null) { return; } args.set(1, this.wilderWild$placedPos); @@ -222,15 +217,14 @@ public abstract class SculkBlockMixin { if (this.wilderWild$placedState == null || this.wilderWild$placedPos == null) { return; } - if (this.wilderWild$isWorldgen && this.wilderWild$placedState.getBlock() instanceof OsseousSculkBlock osseousSculkBlock) { - int growthAmount = Math.max(0, this.wilderWild$placedState.getValue(OsseousSculkBlock.HEIGHT_LEFT) - this.wilderWild$randomSource.nextInt(2)); + if (sculkSpreader.isWorldGeneration() && this.wilderWild$placedState.getBlock() instanceof OsseousSculkBlock osseousSculkBlock) { + int growthAmount = Math.max(0, this.wilderWild$placedState.getValue(OsseousSculkBlock.HEIGHT_LEFT) - randomSource.nextInt(2)); for (int a = 0; a < growthAmount; a++) { - osseousSculkBlock.worldGenSpread(this.wilderWild$placedPos, levelAccessor, this.wilderWild$randomSource); + osseousSculkBlock.worldGenSpread(this.wilderWild$placedPos, levelAccessor, randomSource); } } else if (this.wilderWild$placedState.is(RegisterBlocks.SCULK_STAIRS) || this.wilderWild$placedState.is(RegisterBlocks.SCULK_SLAB) || this.wilderWild$placedState.is(RegisterBlocks.SCULK_WALL)) { SlabWallStairSculkBehavior.clearSculkVeins(levelAccessor, this.wilderWild$placedPos); } - this.wilderWild$randomSource = null; this.wilderWild$placedPos = null; this.wilderWild$placedState = null; }