diff --git a/docs/scarpet/api/BlocksAndWorldAccess.md b/docs/scarpet/api/BlocksAndWorldAccess.md index de44308b..ff14f56d 100644 --- a/docs/scarpet/api/BlocksAndWorldAccess.md +++ b/docs/scarpet/api/BlocksAndWorldAccess.md @@ -540,7 +540,7 @@ On top of that, scarpet provides the following list of noises sampled directly f `'barrier_noise'`, `'fluid_level_floodedness_noise'`, `'fluid_level_spread_noise'`, `'lava_noise'`, `'temperature'`, `'vegetation'`, `'continents'`, `'erosion'`, `'depth'`, `'ridges'`, -`'preliminary_surface_level'`, `'final_density'`, `'vein_toggle'`, `'vein_ridged'` and `'vein_gap'` +`'preliminary_surface_level'`, `'final_density'`
// requesting single value
diff --git a/gradle.properties b/gradle.properties
index 6e84e0de..2f89c048 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -7,7 +7,7 @@ org.gradle.configuration-cache=false
# Fabric Properties
# check https://fabricmc.net/develop/
- minecraft_version=26.3-snapshot-3
+ minecraft_version=26.3-snapshot-9
loader_version=0.19.3
loom_version=1.17-SNAPSHOT
diff --git a/src/main/java/carpet/fakes/RandomStateVisitorAccessor.java b/src/main/java/carpet/fakes/RandomStateVisitorAccessor.java
index d423bb52..261f856f 100644
--- a/src/main/java/carpet/fakes/RandomStateVisitorAccessor.java
+++ b/src/main/java/carpet/fakes/RandomStateVisitorAccessor.java
@@ -1,6 +1,6 @@
package carpet.fakes;
-import net.minecraft.world.level.levelgen.DensityFunction;
+import net.minecraft.world.level.levelgen.densityfunction.DensityFunction;
public interface RandomStateVisitorAccessor {
DensityFunction.Visitor getVisitor();
diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java
index daea4e40..891dc7be 100644
--- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java
+++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java
@@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
+import net.minecraft.util.Prediction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
@@ -26,6 +27,7 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.vehicle.boat.Boat;
import net.minecraft.world.entity.vehicle.minecart.Minecart;
import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.component.SwingAnimation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
@@ -261,7 +263,7 @@ public class EntityPlayerActionPack
if (!inv.getItem(slot).isEmpty())
player.drop(inv.removeItem(slot,
dropAll ? inv.getItem(slot).getCount() : 1
- ), false, true); // scatter, keep owner
+ ), false, Prediction.SERVER_ONLY); // scatter, keep owner
}
public void drop(int selectedSlot, boolean dropAll)
@@ -320,7 +322,7 @@ public class EntityPlayerActionPack
InteractionResult result = player.gameMode.useItemOn(player, world, player.getItemInHand(hand), hand, blockHit);
if (result instanceof InteractionResult.Success success)
{
- if (success.swingSource() == InteractionResult.SwingSource.SERVER) player.swing(hand);
+ if (success.swingSource() == InteractionResult.SwingSource.SERVER_ONLY) player.swing(hand, SwingAnimation.DEFAULT, true);
ap.itemUseCooldown = 3;
return true;
}
@@ -385,7 +387,7 @@ public class EntityPlayerActionPack
if (!action.isContinuous)
{
player.attack(entityHit.getEntity());
- player.swing(InteractionHand.MAIN_HAND);
+ player.swing(InteractionHand.MAIN_HAND, SwingAnimation.DEFAULT, true);
}
player.resetAttackStrengthTicker();
player.resetLastActionTime();
@@ -453,7 +455,7 @@ public class EntityPlayerActionPack
}
player.resetLastActionTime();
- player.swing(InteractionHand.MAIN_HAND);
+ player.swing(InteractionHand.MAIN_HAND, SwingAnimation.DEFAULT, true);
return blockBroken;
}
}
diff --git a/src/main/java/carpet/helpers/FertilizableCoral.java b/src/main/java/carpet/helpers/FertilizableCoral.java
index 1fc5c90d..7b7e2076 100644
--- a/src/main/java/carpet/helpers/FertilizableCoral.java
+++ b/src/main/java/carpet/helpers/FertilizableCoral.java
@@ -16,6 +16,7 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.BaseCoralPlantTypeBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.BonemealSource;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.CoralClawFeature;
@@ -39,7 +40,7 @@ public interface FertilizableCoral extends BonemealableBlock {
boolean isEnabled();
@Override
- public default boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state)
+ public default boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, BonemealSource bonemealSource)
{
return isEnabled()
&& state.getValue(BaseCoralPlantTypeBlock.WATERLOGGED)
@@ -47,13 +48,13 @@ public interface FertilizableCoral extends BonemealableBlock {
}
@Override
- public default boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state)
+ public default boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state, BonemealSource bonemealSource)
{
return random.nextFloat() < 0.15D;
}
@Override
- public default void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
+ public default void performBonemeal(ServerLevel worldIn, RandomSource random, BlockPos pos, BlockState blockUnder, BonemealSource bonemealSource)
{
MapColor color = blockUnder.getMapColor(worldIn, pos);
BlockState properBlock = blockUnder;
diff --git a/src/main/java/carpet/helpers/RedstoneWireTurbo.java b/src/main/java/carpet/helpers/RedstoneWireTurbo.java
index 57015ed0..ba095a7f 100644
--- a/src/main/java/carpet/helpers/RedstoneWireTurbo.java
+++ b/src/main/java/carpet/helpers/RedstoneWireTurbo.java
@@ -11,7 +11,7 @@ import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
-import net.minecraft.world.level.block.RedStoneWireBlock;
+import net.minecraft.world.level.block.RedstoneWireBlock;
import net.minecraft.world.level.block.state.BlockState;
import carpet.fakes.RedstoneWireBlockInterface;
@@ -79,7 +79,7 @@ public class RedstoneWireTurbo
/* Reference to RedstoneWireBlock object, which uses this accelerator */
- private final RedStoneWireBlock wire;
+ private final RedstoneWireBlock wire;
/*
@@ -115,7 +115,7 @@ public class RedstoneWireTurbo
private List updateQueue2 = new ArrayList<>();
- public RedstoneWireTurbo(RedStoneWireBlock wire) {
+ public RedstoneWireTurbo(RedstoneWireBlock wire) {
this.wire = wire;
}
@@ -848,7 +848,7 @@ public class RedstoneWireTurbo
private BlockState calculateCurrentChanges(final Level worldIn, final UpdateNode upd)
{
BlockState state = upd.currentState;
- final int i = state.getValue(RedStoneWireBlock.POWER);
+ final int i = state.getValue(RedstoneWireBlock.POWER);
int j = 0;
j = getMaxCurrentStrength(upd, j);
int l = 0;
@@ -918,7 +918,7 @@ public class RedstoneWireTurbo
// and set it in the world.
// Possible optimization: Don't commit state changes to the world until they
// need to be known by some nearby non-redstone-wire block.
- state = state.setValue(RedStoneWireBlock.POWER, j);
+ state = state.setValue(RedstoneWireBlock.POWER, j);
// [gnembon] added state check cause other things in the tick may have popped it up already
// https://github.com/gnembon/fabric-carpet/issues/117
if (worldIn.getBlockState(upd.self).getBlock() == Blocks.REDSTONE_WIRE)
@@ -962,7 +962,7 @@ public class RedstoneWireTurbo
*/
private static int getMaxCurrentStrength(final UpdateNode upd, final int strength) {
if (upd.type != UpdateNode.Type.REDSTONE) return strength;
- final int i = upd.currentState.getValue(RedStoneWireBlock.POWER);
+ final int i = upd.currentState.getValue(RedstoneWireBlock.POWER);
return i > strength ? i : strength;
}
}
\ No newline at end of file
diff --git a/src/main/java/carpet/mixins/BlockBehaviourBlockStateBase_mixin.java b/src/main/java/carpet/mixins/BlockBehaviourBlockStateBase_mixin.java
index 3e512d97..33b4cd79 100644
--- a/src/main/java/carpet/mixins/BlockBehaviourBlockStateBase_mixin.java
+++ b/src/main/java/carpet/mixins/BlockBehaviourBlockStateBase_mixin.java
@@ -21,7 +21,7 @@ public abstract class BlockBehaviourBlockStateBase_mixin
{
if (CarpetSettings.movableAmethyst && getBlock() instanceof BuddingAmethystBlock)
{
- cir.setReturnValue(PushReaction.NORMAL);
+ cir.setReturnValue(PushReaction.PUSH_PULL);
}
}
}
diff --git a/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java b/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java
index f1adfc67..d063f4ff 100644
--- a/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java
+++ b/src/main/java/carpet/mixins/BuddingAmethystBlock_movableAmethystMixin.java
@@ -3,13 +3,13 @@ package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.ItemTags;
-import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
-import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.BuddingAmethystBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
@@ -24,7 +24,7 @@ public class BuddingAmethystBlock_movableAmethystMixin extends Block {
}
@Override
- public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
+ public void playerDestroy(ServerLevel world, ServerPlayer player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
super.playerDestroy(world, player, pos, state, blockEntity, stack);
// doing it here rather than though loottables since loottables are loaded on reload
// drawback - not controlled via loottables, but hey
diff --git a/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java b/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java
index 71f9b48d..0a87fa42 100644
--- a/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java
+++ b/src/main/java/carpet/mixins/ChunkGenerator_customMobSpawnsMixin.java
@@ -4,6 +4,7 @@ import carpet.utils.SpawnOverrides;
import it.unimi.dsi.fastutil.longs.LongSet;
import net.minecraft.core.Holder;
import net.minecraft.util.random.WeightedList;
+import net.minecraft.world.level.Level;
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.levelgen.structure.Structure;
import org.spongepowered.asm.mixin.Mixin;
@@ -30,7 +31,7 @@ public abstract class ChunkGenerator_customMobSpawnsMixin
value = "INVOKE",
target = "Ljava/util/Map$Entry;getKey()Ljava/lang/Object;"
), cancellable = true)
- private void checkCMSpawns(Holder holder, StructureManager structureFeatureManager, MobCategory mobCategory, BlockPos blockPos,
+ private void checkCMSpawns(Level holder, StructureManager structureFeatureManager, MobCategory mobCategory, BlockPos blockPos,
CallbackInfoReturnable> cir,
Map map, Iterator> var6, Map.Entry entry)
{
diff --git a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java
index 76effd11..81913320 100644
--- a/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java
+++ b/src/main/java/carpet/mixins/Explosion_optimizedTntMixin.java
@@ -86,7 +86,7 @@ public abstract class Explosion_optimizedTntMixin
}
@Redirect(method = "hurtEntities",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;push(Lnet/minecraft/world/phys/Vec3;)V"))
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;pushFromExplosion(Lnet/minecraft/world/phys/Vec3;)V"))
private void setVelocityAndUpdateLogging(Entity entity, Vec3 velocity)
{
if (eLogger != null) {
diff --git a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
index 4e5e4f84..2d45981b 100644
--- a/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
+++ b/src/main/java/carpet/mixins/LevelRenderer_scarpetRenderMixin.java
@@ -26,6 +26,7 @@ import net.minecraft.client.renderer.state.level.LevelRenderState;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.sprite.AtlasManager;
+import org.joml.Matrix4f;
import org.joml.Matrix4fc;
import org.joml.Vector4f;
import org.spongepowered.asm.mixin.Final;
@@ -56,7 +57,8 @@ public class LevelRenderer_scarpetRenderMixin
@Inject(method = "render", at = @At(
value = "INVOKE",
-target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/renderpearl/api/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;F)V",
+//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/renderpearl/api/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;Z)V"
+target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/renderpearl/api/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;Z)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;F)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addAlwaysOnTopPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V",
@@ -65,7 +67,8 @@ target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/b
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addLateDebugPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/state/level/CameraRenderState;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lorg/joml/Matrix4fc;)V",
shift = At.Shift.AFTER
))
- private void renderScarpetThingsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder)
+ private void renderStanperThingsLate (GraphicsResourceAllocator resourceAllocator, boolean renderOutline, CameraRenderState cameraState, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, boolean consistentDepthRequired, CallbackInfo ci, @Local(name = "frame") FrameGraphBuilder frameGraphBuilder)
+ //private void renderScarpetThingsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, boolean consistentDepthRequired, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder)
//private void renderScarpetThinsLate(GraphicsResourceAllocator resourceAllocator, DeltaTracker deltaTracker, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, CallbackInfo ci, @Local FrameGraphBuilder frameGraphBuilder)
{
// in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
@@ -73,10 +76,11 @@ target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/b
//if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null )
if (CarpetClient.shapes != null)
{
- final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false);
+ //final float deltaPartialTick = deltaTracker.getGameTimeDeltaPartialTick(false);
FramePass pass = frameGraphBuilder.addPass("scarpet_shapes");
targets.main = pass.readsAndWrites(targets.main);
- pass.executes(() -> CarpetClient.shapes.render(submitNodeStorage, levelRenderState, modelViewMatrix, deltaPartialTick));
+ var modelViewMatrix = new Matrix4f(levelRenderState.cameraRenderState.viewRotationMatrix);
+ pass.executes(() -> CarpetClient.shapes.render(submitNodeStorage, levelRenderState, modelViewMatrix, levelRenderState.worldPartialTicks));
//featureRenderDispatcher.renderAllFeatures(submitNodeStorage);
//renderBuffers.bufferSource().uploadAndDraw();
}
diff --git a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java
index 5cc5ba95..094274b0 100644
--- a/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java
+++ b/src/main/java/carpet/mixins/PistonBaseBlock_movableBEMixin.java
@@ -79,7 +79,7 @@ public abstract class PistonBaseBlock_movableBEMixin extends DirectionalBlock
))
private static PushReaction moveGrindstones(BlockState blockState)
{
- if (CarpetSettings.movableBlockEntities && blockState.getBlock() == Blocks.GRINDSTONE) return PushReaction.NORMAL;
+ if (CarpetSettings.movableBlockEntities && blockState.getBlock() == Blocks.GRINDSTONE) return PushReaction.PUSH_PULL;
return blockState.getPistonPushReaction();
}
diff --git a/src/main/java/carpet/mixins/RandomState_ScarpetMixin.java b/src/main/java/carpet/mixins/RandomState_ScarpetMixin.java
index 2e855238..e785540b 100644
--- a/src/main/java/carpet/mixins/RandomState_ScarpetMixin.java
+++ b/src/main/java/carpet/mixins/RandomState_ScarpetMixin.java
@@ -1,7 +1,7 @@
package carpet.mixins;
import carpet.fakes.RandomStateVisitorAccessor;
-import net.minecraft.world.level.levelgen.DensityFunction;
+import net.minecraft.world.level.levelgen.densityfunction.DensityFunction;
import net.minecraft.world.level.levelgen.RandomState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
@@ -17,7 +17,7 @@ public class RandomState_ScarpetMixin implements RandomStateVisitorAccessor {
method = "",
at = @At(
value = "INVOKE",
- target = "Lnet/minecraft/world/level/levelgen/NoiseRouter;mapAll(Lnet/minecraft/world/level/levelgen/DensityFunction$Visitor;)Lnet/minecraft/world/level/levelgen/NoiseRouter;"
+ target = "Lnet/minecraft/world/level/levelgen/NoiseRouter;mapAll(Lnet/minecraft/world/level/levelgen/densityfunction/DensityFunction$Visitor;)Lnet/minecraft/world/level/levelgen/NoiseRouter;"
),
index = 0
)
diff --git a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java
index 101ef513..0e810098 100644
--- a/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java
+++ b/src/main/java/carpet/mixins/RedstoneWireBlock_fastMixin.java
@@ -21,15 +21,15 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.RedStoneWireBlock;
+import net.minecraft.world.level.block.RedstoneWireBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import org.jspecify.annotations.Nullable;
-import static net.minecraft.world.level.block.RedStoneWireBlock.POWER;
+import static net.minecraft.world.level.block.RedstoneWireBlock.POWER;
-@Mixin(RedStoneWireBlock.class)
+@Mixin(RedstoneWireBlock.class)
public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockInterface {
@Shadow
@@ -43,7 +43,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
@Accessor("shouldSignal")
public abstract boolean getWiresGivePower();
- private RedstoneWireEvaluator legacy = new DefaultRedstoneWireEvaluator((RedStoneWireBlock)(Object) this);
+ private RedstoneWireEvaluator legacy = new DefaultRedstoneWireEvaluator((RedstoneWireBlock)(Object) this);
// =
@@ -52,7 +52,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
@Inject(method = "", at = @At("RETURN"))
private void onRedstoneWireBlockCTOR(BlockBehaviour.Properties settings, CallbackInfo ci) {
//noinspection ConstantConditions
- wireTurbo = new RedstoneWireTurbo((RedStoneWireBlock) (Object) this);
+ wireTurbo = new RedstoneWireTurbo((RedstoneWireBlock) (Object) this);
}
// =
@@ -114,24 +114,24 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
// =
- @Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
- private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
+ @Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedstoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
+ private void redirectOnBlockAddedUpdate(RedstoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
}
- @Redirect(method = "affectNeighborsAfterRemoval", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
- private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
+ @Redirect(method = "affectNeighborsAfterRemoval", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedstoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
+ private void redirectOnStateReplacedUpdate(RedstoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
}
@Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target =
- "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"
- //"Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"
+ "Lnet/minecraft/world/level/block/RedstoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"
+ //"Lnet/minecraft/world/level/block/RedstoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"
))
//private void red(final RedStoneWireBlock instance, final Level level,
// final BlockPos blockPos, final BlockState blockState, final Orientation orientation)
private void redirectNeighborUpdateUpdate(
- RedStoneWireBlock self,
+ RedstoneWireBlock self,
Level world_1,
BlockPos blockPos_1,
BlockState blockState_1,
diff --git a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java
index 42e0f3e0..620c86c9 100644
--- a/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java
+++ b/src/main/java/carpet/mixins/ServerGamePacketListenerImpl_scarpetEventsMixin.java
@@ -38,7 +38,7 @@ import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket;
import net.minecraft.network.protocol.game.ServerboundPlayerInputPacket;
import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket;
-import net.minecraft.network.protocol.game.ServerboundSwingPacket;
+import net.minecraft.network.protocol.game.ServerboundPunchPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemPacket;
import net.minecraft.server.level.ServerPlayer;
@@ -171,8 +171,8 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
{
if (PLAYER_RIGHT_CLICKS_BLOCK.isNeeded())
{
- InteractionHand hand = playerInteractBlockC2SPacket_1.getHand();
- BlockHitResult hitRes = playerInteractBlockC2SPacket_1.getHitResult();
+ InteractionHand hand = playerInteractBlockC2SPacket_1.hand();
+ BlockHitResult hitRes = playerInteractBlockC2SPacket_1.hitResult();
if(PLAYER_RIGHT_CLICKS_BLOCK.onBlockHit(player, hand, hitRes)) {
ci.cancel();
}
@@ -187,7 +187,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
{
if (PLAYER_USES_ITEM.isNeeded())
{
- InteractionHand hand = playerInteractItemC2SPacket_1.getHand();
+ InteractionHand hand = playerInteractItemC2SPacket_1.hand();
if(PLAYER_USES_ITEM.onItemAction(player, hand, player.getItemInHand(hand).copy())) {
ci.cancel();
}
@@ -267,16 +267,16 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
}
}
- @Inject(method = "handleAnimate", at = @At(
+ @Inject(method = "handlePunch", at = @At(
value = "INVOKE", target =
"Lnet/minecraft/server/level/ServerPlayer;resetLastActionTime()V",
shift = At.Shift.BEFORE)
)
- private void onSwing(ServerboundSwingPacket packet, CallbackInfo ci)
+ private void onSwing(ServerboundPunchPacket packet, CallbackInfo ci)
{
- if (PLAYER_SWINGS_HAND.isNeeded() && !player.swinging)
+ if (PLAYER_SWINGS_HAND.isNeeded() && !player.isSwinging())
{
- PLAYER_SWINGS_HAND.onHandAction(player, packet.getHand());
+ PLAYER_SWINGS_HAND.onHandAction(player, InteractionHand.MAIN_HAND);
}
}
diff --git a/src/main/java/carpet/mixins/ShulkerBoxBlockEntity_creativeNoClipMixin.java b/src/main/java/carpet/mixins/ShulkerBoxBlockEntity_creativeNoClipMixin.java
index ec344482..12856aba 100644
--- a/src/main/java/carpet/mixins/ShulkerBoxBlockEntity_creativeNoClipMixin.java
+++ b/src/main/java/carpet/mixins/ShulkerBoxBlockEntity_creativeNoClipMixin.java
@@ -19,7 +19,7 @@ public class ShulkerBoxBlockEntity_creativeNoClipMixin
private PushReaction getPistonBehaviourOfNoClipPlayers(Entity entity)
{
if (CarpetSettings.creativeNoClip && entity instanceof Player && (((Player) entity).isCreative()) && ((Player) entity).getAbilities().flying)
- return PushReaction.IGNORE;
+ return PushReaction.IGNORE_ENTITY;
return entity.getPistonPushReaction();
}
}
diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java
index 69717e2e..20d627a2 100644
--- a/src/main/java/carpet/script/api/Auxiliary.java
+++ b/src/main/java/carpet/script/api/Auxiliary.java
@@ -424,7 +424,7 @@ public class Auxiliary
armorstand.setHeadPose(new Rotations((int) pointLocator.pitch, 0, 0));
armorstand.setNoGravity(true);
armorstand.setInvisible(true);
- armorstand.setInvulnerable(true);
+ armorstand.setPermanentlyInvulnerable(true);
armorstand.getEntityData().set(ArmorStand.DATA_CLIENT_FLAGS, (byte) (interactable ? 8 : 16 | 8));
level.addFreshEntity(armorstand);
return new EntityValue(armorstand);
diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java
index 28b9de22..1b2602a2 100644
--- a/src/main/java/carpet/script/api/Inventories.java
+++ b/src/main/java/carpet/script/api/Inventories.java
@@ -36,6 +36,7 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
+import net.minecraft.util.Prediction;
import net.minecraft.util.context.ContextMap;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.item.ItemEntity;
@@ -441,7 +442,7 @@ public class Inventories
ItemEntity item;
if (owner instanceof Player player)
{
- item = player.drop(droppedStack, false, true);
+ item = player.drop(droppedStack, false, Prediction.SERVER_ONLY);
if (item == null)
{
return Value.ZERO;
diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java
index 18030891..96dfdc88 100644
--- a/src/main/java/carpet/script/api/WorldAccess.java
+++ b/src/main/java/carpet/script/api/WorldAccess.java
@@ -61,8 +61,9 @@ import net.minecraft.world.level.ServerExplosion;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.PalettedContainer;
import net.minecraft.world.level.chunk.status.ChunkStatus;
-import net.minecraft.world.level.levelgen.DensityFunction;
-import net.minecraft.world.level.levelgen.DensityFunctions;
+import net.minecraft.world.level.levelgen.Aquifer;
+import net.minecraft.world.level.levelgen.densityfunction.DensityFunction;
+import net.minecraft.world.level.levelgen.densityfunction.DensityFunctions;
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
import net.minecraft.world.level.levelgen.NoiseRouter;
import net.minecraft.world.level.levelgen.RandomState;
@@ -1730,33 +1731,41 @@ public class WorldAccess
{
return ListValue.wrap(cc.registry(Registries.DENSITY_FUNCTION).keySet().stream().map(ValueConversions::of));
}
- NoiseRouter router = level.getChunkSource().randomState().router();
+ RandomState router = level.getChunkSource().randomState();
return densityFunctionQueries.length == 1
? NumericValue.of(sampleNoise(router, level, densityFunctionQueries[0], pos))
: ListValue.wrap(Arrays.stream(densityFunctionQueries).map(s -> NumericValue.of(sampleNoise(router, level, s, pos))));
});
}
- public static double sampleNoise(NoiseRouter router, ServerLevel level, String what, BlockPos pos)
+ public static double sampleNoise(RandomState router, ServerLevel level, String what, BlockPos pos)
{
DensityFunction densityFunction = switch (what)
{
- case "barrier_noise" -> router.barrierNoise();
- case "fluid_level_floodedness_noise" -> router.fluidLevelFloodednessNoise();
- case "fluid_level_spread_noise" -> router.fluidLevelSpreadNoise();
- case "lava_noise" -> router.lavaNoise();
- case "temperature" -> router.temperature();
- case "vegetation" -> router.vegetation();
- case "continents" -> router.continents();
- case "erosion" -> router.erosion();
- case "depth" -> router.depth();
- case "ridges" -> router.ridges();
- case "preliminary_surface_level" -> router.preliminarySurfaceLevel();
- case "final_density" -> router.finalDensity();
- case "vein_toggle" -> router.veinToggle();
- case "vein_ridged" -> router.veinRidged();
- case "vein_gap" -> router.veinGap();
- default -> stupidWorldgenNoiseCacheGetter.apply(Pair.of(level, what));
+ case "temperature" -> router.router().temperature();
+ case "vegetation" -> router.router().vegetation();
+ case "continents" -> router.router().continents();
+ case "erosion" -> router.router().erosion();
+ case "depth" -> router.router().depth();
+ case "ridges" -> router.router().ridges();
+ case "preliminary_surface_level" -> router.router().preliminarySurfaceLevel();
+ case "final_density" -> router.router().finalDensity();
+ //case "vein_toggle" -> router. router(). veinToggle();
+ //case "vein_ridged" -> router.router().veinRidged();
+ //case "vein_gap" -> router.router().veinGap();
+ default -> {
+ Aquifer.Config aquifer = router.aquifers().orElse(null);
+ if (aquifer != null) {
+ yield switch (what) {
+ case "barrier_noise" -> aquifer.barrierNoise();
+ case "fluid_level_floodedness_noise" -> aquifer.fluidLevelFloodednessNoise();
+ case "fluid_level_spread_noise" -> aquifer.fluidLevelSpreadNoise();
+ case "lava_noise" -> aquifer.lavaNoise();
+ default -> stupidWorldgenNoiseCacheGetter.apply(Pair.of(level, what));
+ };
+ }
+ yield stupidWorldgenNoiseCacheGetter.apply(Pair.of(level, what));
+ }
};
return densityFunction.compute(new DensityFunction.SinglePointContext(pos.getX(), pos.getY(), pos.getZ()));
}
@@ -1773,10 +1782,6 @@ public class WorldAccess
NoiseRouter router = noiseBasedChunkGenerator.generatorSettings().value().noiseRouter();
DensityFunction densityFunction = switch (densityFunctionQuery)
{
- case "barrier_noise" -> router.barrierNoise();
- case "fluid_level_floodedness_noise" -> router.fluidLevelFloodednessNoise();
- case "fluid_level_spread_noise" -> router.fluidLevelSpreadNoise();
- case "lava_noise" -> router.lavaNoise();
case "temperature" -> router.temperature();
case "vegetation" -> router.vegetation();
case "continents" -> router.continents();
@@ -1785,10 +1790,29 @@ public class WorldAccess
case "ridges" -> router.ridges();
case "preliminary_surface_level" -> router.preliminarySurfaceLevel();
case "final_density" -> router.finalDensity();
- case "vein_toggle" -> router.veinToggle();
- case "vein_ridged" -> router.veinRidged();
- case "vein_gap" -> router.veinGap();
+ //case "vein_toggle" -> router.veinToggle();
+ //case "vein_ridged" -> router.veinRidged();
+ //case "vein_gap" -> router.veinGap();
default -> {
+ Aquifer.Config aquifers = noiseBasedChunkGenerator.generatorSettings().value().aquifers().orElse(null);
+ if (aquifers != null) {
+ yield switch (densityFunctionQuery) {
+ case "barrier_noise" -> aquifers.barrierNoise();
+ case "fluid_level_floodedness_noise" -> aquifers.fluidLevelFloodednessNoise();
+ case "fluid_level_spread_noise" -> aquifers.fluidLevelSpreadNoise();
+ case "lava_noise" -> aquifers.lavaNoise();
+ default -> {
+ DensityFunction result = densityFunctionRegistry.getValue(InputValidator.identifierOf(densityFunctionQuery));
+ if (result == null)
+ {
+ throw new InternalExpressionException("Density function '" + densityFunctionQuery + "' is not defined in the registies.");
+ }
+ yield result;
+ }
+ };
+ }
+
+
DensityFunction result = densityFunctionRegistry.getValue(InputValidator.identifierOf(densityFunctionQuery));
if (result == null)
{
diff --git a/src/main/java/carpet/script/external/Vanilla.java b/src/main/java/carpet/script/external/Vanilla.java
index a7bce205..5ddfecff 100644
--- a/src/main/java/carpet/script/external/Vanilla.java
+++ b/src/main/java/carpet/script/external/Vanilla.java
@@ -53,7 +53,7 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
-import net.minecraft.world.level.levelgen.DensityFunction;
+import net.minecraft.world.level.levelgen.densityfunction.DensityFunction;
import net.minecraft.world.level.levelgen.RandomState;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.ServerLevelData;
diff --git a/src/main/java/carpet/script/utils/FeatureGenerator.java b/src/main/java/carpet/script/utils/FeatureGenerator.java
index 203a6ab5..d422b370 100644
--- a/src/main/java/carpet/script/utils/FeatureGenerator.java
+++ b/src/main/java/carpet/script/utils/FeatureGenerator.java
@@ -269,7 +269,7 @@ public class FeatureGenerator
{
//Holder genBiome = generator.getBiomeSource().getNoiseBiome(QuartPos.fromBlock(pos.getX()), QuartPos.fromBlock(pos.getY()), QuartPos.fromBlock(pos.getZ()), seed.sampler());
if (structure.findValidGenerationPoint(new Structure.GenerationContext(
- world.registryAccess(), generator, generator.getBiomeSource(),
+ world.registryAccess(), generator, world.uncachedBiomeResolver(),
seed, world.getStructureManager(), world.getSeed(), chunkPos, world, structureBiomes::contains
)).isPresent())
{
@@ -279,7 +279,7 @@ public class FeatureGenerator
else
{
StructureStart filledStructure = structure.generate(Holder.direct(structure), world.dimension(),
- world.registryAccess(), generator, generator.getBiomeSource(), seed, world.getStructureManager(),
+ world.registryAccess(), generator, world.uncachedBiomeResolver(), seed, world.getStructureManager(),
world.getSeed(), chunkPos, 0, world, structureBiomes::contains);
if (filledStructure != null && filledStructure.isValid())
{
@@ -508,7 +508,7 @@ public class FeatureGenerator
checks.set(true);
try
{
- StructureStart start = structure.generate(Holder.direct(structure), world.dimension(), world.registryAccess(), generator, generator.getBiomeSource(), world.getChunkSource().randomState(), world.getStructureManager(), world.getSeed(), ChunkPos.containing(pos), 0, world, b -> true);
+ StructureStart start = structure.generate(Holder.direct(structure), world.dimension(), world.registryAccess(), generator, world.uncachedBiomeResolver(), world.getChunkSource().randomState(), world.getStructureManager(), world.getSeed(), ChunkPos.containing(pos), 0, world, b -> true);
if (start == StructureStart.INVALID_START)
{
return false;
diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java
index d46919cb..8fae3636 100644
--- a/src/main/java/carpet/script/value/EntityValue.java
+++ b/src/main/java/carpet/script/value/EntityValue.java
@@ -70,6 +70,7 @@ import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.entity.projectile.hurtingprojectile.WitherSkull;
import net.minecraft.world.entity.vehicle.minecart.AbstractMinecart;
import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.component.SwingAnimation;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.entity.EntityTypeTest;
@@ -554,7 +555,7 @@ public class EntityValue extends Value
put("sneaking", (e, a) -> e.isShiftKeyDown() ? Value.TRUE : Value.FALSE);
put("sprinting", (e, a) -> e.isSprinting() ? Value.TRUE : Value.FALSE);
put("swimming", (e, a) -> e.isSwimming() ? Value.TRUE : Value.FALSE);
- put("swinging", (e, a) -> e instanceof LivingEntity le ? BooleanValue.of(le.swinging) : Value.NULL);
+ put("swinging", (e, a) -> e instanceof LivingEntity le ? BooleanValue.of(le.isSwinging()) : Value.NULL);
put("air", (e, a) -> new NumericValue(e.getAirSupply()));
put("language", (e, a) -> !(e instanceof ServerPlayer p) ? NULL : StringValue.of(p.clientInformation().language()));
put("persistence", (e, a) -> e instanceof Mob mob ? BooleanValue.of(mob.isPersistenceRequired()) : Value.NULL);
@@ -1586,7 +1587,7 @@ public class EntityValue extends Value
hand = InteractionHand.OFF_HAND;
}
}
- le.swing(hand, true);
+ le.swing(hand, SwingAnimation.DEFAULT, true);
}
});
@@ -1603,7 +1604,7 @@ public class EntityValue extends Value
}
else
{
- e.setInvulnerable(invulnerable);
+ e.setPermanentlyInvulnerable(invulnerable);
}
});
diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java
index b52a88d9..e8974b73 100644
--- a/src/main/java/carpet/utils/PerimeterDiagnostics.java
+++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java
@@ -161,10 +161,10 @@ public class PerimeterDiagnostics
private boolean check_entity_spawn(BlockPos pos)
{
- if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap().contains(sle))
+ if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer, worldServer.structureManager(), ctype, pos).unwrap().contains(sle))
{
sle = null;
- for (Weighted wsle: worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap())
+ for (Weighted wsle: worldServer.getChunkSource().getGenerator().getMobsAt(worldServer, worldServer.structureManager(), ctype, pos).unwrap())
{
MobSpawnSettings.SpawnerData sle = wsle.value();
if (el.getType() == sle.type())
@@ -173,7 +173,7 @@ public class PerimeterDiagnostics
break;
}
}
- if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap().contains(sle))
+ if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer, worldServer.structureManager(), ctype, pos).unwrap().contains(sle))
{
return false;
}
diff --git a/src/main/java/carpet/utils/SpawnOverrides.java b/src/main/java/carpet/utils/SpawnOverrides.java
index 58113d77..f0fbc717 100644
--- a/src/main/java/carpet/utils/SpawnOverrides.java
+++ b/src/main/java/carpet/utils/SpawnOverrides.java
@@ -9,6 +9,9 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.Identifier;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.random.WeightedList;
+import net.minecraft.util.valueproviders.ConstantInt;
+import net.minecraft.util.valueproviders.IntProvider;
+import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.StructureManager;
@@ -32,16 +35,16 @@ public class SpawnOverrides {
static {
addOverride(() -> CarpetSettings.huskSpawningInTemples, MobCategory.MONSTER, BuiltinStructures.DESERT_PYRAMID, StructureSpawnOverride.BoundingBoxType.STRUCTURE,
- WeightedList.of(new MobSpawnSettings.SpawnerData(EntityTypes.HUSK, 1, 1))
+ WeightedList.of(new MobSpawnSettings.SpawnerData(EntityTypes.HUSK, ConstantInt.of(1)))
);
addOverride(() -> CarpetSettings.shulkerSpawningInEndCities, MobCategory.MONSTER, BuiltinStructures.END_CITY, StructureSpawnOverride.BoundingBoxType.PIECE,
- WeightedList.of(new MobSpawnSettings.SpawnerData(EntityTypes.SHULKER, 4, 4))
+ WeightedList.of(new MobSpawnSettings.SpawnerData(EntityTypes.SHULKER, ConstantInt.of(4)))
);
addOverride(() -> CarpetSettings.piglinsSpawningInBastions, MobCategory.MONSTER, BuiltinStructures.BASTION_REMNANT, StructureSpawnOverride.BoundingBoxType.PIECE,
WeightedList.builder()
- .add(new MobSpawnSettings.SpawnerData(EntityTypes.PIGLIN_BRUTE,1, 2), 5)
- .add(new MobSpawnSettings.SpawnerData(EntityTypes.PIGLIN, 2, 4), 10)
- .add(new MobSpawnSettings.SpawnerData(EntityTypes.HOGLIN, 1, 2), 2)
+ .add(new MobSpawnSettings.SpawnerData(EntityTypes.PIGLIN_BRUTE, UniformInt.of(1, 2)), 5)
+ .add(new MobSpawnSettings.SpawnerData(EntityTypes.PIGLIN, UniformInt.of(2, 4)), 10)
+ .add(new MobSpawnSettings.SpawnerData(EntityTypes.HOGLIN, UniformInt.of(1, 2)), 2)
.build()
);
diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java
index 35dfc479..642caa6d 100644
--- a/src/main/java/carpet/utils/SpawnReporter.java
+++ b/src/main/java/carpet/utils/SpawnReporter.java
@@ -397,7 +397,7 @@ public class SpawnReporter
// yeeted from NaturalSpawner - temporary access fix
private static WeightedList getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder holder) {
- return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos);
+ return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES : chunkGenerator.getMobsAt(serverLevel, structureManager, mobCategory, blockPos);
}
public static List report(BlockPos pos, ServerLevel worldIn)
@@ -492,7 +492,7 @@ public class SpawnReporter
{
String color = (fits && willSpawn > 0) ? "e" : "gi";
rep.add(Messenger.c(
- String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()),
+ String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.count().minInclusive(), spawnEntry.count().maxInclusive(), mob.getMaxSpawnClusterSize()),
"l YES",
color + " , fit: ",
(fits ? "l YES" : "r NO"),
@@ -502,7 +502,7 @@ public class SpawnReporter
}
else
{
- rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()), "n NO"));
+ rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.count().minInclusive(), spawnEntry.count().maxInclusive(), mob.getMaxSpawnClusterSize()), "n NO"));
}
killEntity(mob);
}