Skip to content

Commit

Permalink
likely fix issues with c2me
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Nov 13, 2023
1 parent ae388f5 commit 475a330
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 28 deletions.
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Please clear changelog after each release.
Thank you!

-----------------
# Wilder Wild 2.2
## What's new?

Additions
---

- ### Added the Crab!
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/frozenblock/wilderwild/entity/Crab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ public abstract class SculkBlockMixin {
@Unique
private Optional<Integer> 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;
Expand Down Expand Up @@ -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<Integer> 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<Integer> 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();
Expand All @@ -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);
}

Expand All @@ -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) {
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit 475a330

Please sign in to comment.