diff --git a/gradle.properties b/gradle.properties index 8a45cf99..c736d2b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,9 +5,9 @@ org.gradle.jvmargs=-Xmx1G # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html minecraft_version=21w37a - yarn_mappings=21w37a+build.5 + yarn_mappings=21w37a+build.13 loader_version=0.11.7 - fabric_version=0.40.1+1.17 + fabric_version=0.40.3+1.18 # Mod Properties mod_version = 1.4.46 diff --git a/src/main/java/carpet/fakes/StructureFeatureInterface.java b/src/main/java/carpet/fakes/StructureFeatureInterface.java index 7d197d5b..db05ac1f 100644 --- a/src/main/java/carpet/fakes/StructureFeatureInterface.java +++ b/src/main/java/carpet/fakes/StructureFeatureInterface.java @@ -6,7 +6,7 @@ import net.minecraft.util.math.ChunkPos; import net.minecraft.world.HeightLimitView; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; -import net.minecraft.world.gen.ChunkRandom; +import net.minecraft.world.gen.random.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.feature.FeatureConfig; diff --git a/src/main/java/carpet/helpers/EntityPlayerActionPack.java b/src/main/java/carpet/helpers/EntityPlayerActionPack.java index 6a127d48..2cfa2b37 100644 --- a/src/main/java/carpet/helpers/EntityPlayerActionPack.java +++ b/src/main/java/carpet/helpers/EntityPlayerActionPack.java @@ -308,11 +308,11 @@ public class EntityPlayerActionPack case BLOCK: { player.updateLastActionTime(); - ServerWorld world = player.method_37908(); + ServerWorld world = player.getWorld(); BlockHitResult blockHit = (BlockHitResult) hit; BlockPos pos = blockHit.getBlockPos(); Direction side = blockHit.getSide(); - if (pos.getY() < player.method_37908().getTopY() - (side == Direction.UP ? 1 : 0) && world.canPlayerModifyAt(player, pos)) + if (pos.getY() < player.getWorld().getTopY() - (side == Direction.UP ? 1 : 0) && world.canPlayerModifyAt(player, pos)) { ActionResult result = player.interactionManager.interactBlock(player, world, player.getStackInHand(hand), hand, blockHit); if (result.isAccepted()) @@ -347,7 +347,7 @@ public class EntityPlayerActionPack } } ItemStack handItem = player.getStackInHand(hand); - if (player.interactionManager.interactItem(player, player.method_37908(), handItem, hand).isAccepted()) + if (player.interactionManager.interactItem(player, player.getWorld(), handItem, hand).isAccepted()) { ap.itemUseCooldown = 3; return true; @@ -400,7 +400,7 @@ public class EntityPlayerActionPack boolean blockBroken = false; if (player.interactionManager.getGameMode().isCreative()) { - player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.method_37908().getTopY()); + player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopY()); ap.blockHitDelay = 5; blockBroken = true; } @@ -408,9 +408,9 @@ public class EntityPlayerActionPack { if (ap.currentBlock != null) { - player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, side, player.method_37908().getTopY()); + player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, side, player.getWorld().getTopY()); } - player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.method_37908().getTopY()); + player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopY()); boolean notAir = !state.isAir(); if (notAir && ap.curBlockDamageMP == 0) { @@ -433,7 +433,7 @@ public class EntityPlayerActionPack ap.curBlockDamageMP += state.calcBlockBreakingDelta(player, player.world, pos); if (ap.curBlockDamageMP >= 1) { - player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, side, player.method_37908().getTopY()); + player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, side, player.getWorld().getTopY()); ap.currentBlock = null; ap.blockHitDelay = 5; blockBroken = true; @@ -455,7 +455,7 @@ public class EntityPlayerActionPack EntityPlayerActionPack ap = ((ServerPlayerEntityInterface) player).getActionPack(); if (ap.currentBlock == null) return; player.world.setBlockBreakingInfo(-1, ap.currentBlock, -1); - player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.method_37908().getTopY()); + player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.getWorld().getTopY()); ap.currentBlock = null; } }, diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index 325cf8e4..79b834b8 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -18,7 +18,7 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeKeys; import net.minecraft.world.biome.BuiltinBiomes; import net.minecraft.world.biome.source.BiomeAccess; -import net.minecraft.world.gen.ChunkRandom; +import net.minecraft.world.gen.random.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.StructureConfig; import net.minecraft.world.gen.treedecorator.BeehiveTreeDecorator; @@ -161,7 +161,7 @@ public class FeatureGenerator private static ConfiguredStructureFeature getDefaultFeature(StructureFeature structure, ServerWorld world, BlockPos pos, boolean tryHard) { - var definedStructures = world.getServer().getSaveProperties().getGeneratorOptions().getChunkGenerator().getStructuresConfig().method_38424(structure); + var definedStructures = world.getServer().getSaveProperties().getGeneratorOptions().getChunkGenerator().getStructuresConfig().getConfiguredStructureFeature(structure); var optinalBiome = world.getRegistryManager().get(Registry.BIOME_KEY).getKey(world.getBiome(pos)); if (optinalBiome.isPresent()) for (var configureStructure: definedStructures.inverse().get(optinalBiome.get())) diff --git a/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java b/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java index bd259cc2..a3f7a8a8 100644 --- a/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java +++ b/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java @@ -147,7 +147,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null) { //Leave name "carriedTileEntityCM" instead of "carriedBlockEntityCM" for upgrade compatibility with 1.13.2 movable TE - NbtCompound_1.put("carriedTileEntityCM", this.carriedBlockEntity.method_38244()); // toNBT + NbtCompound_1.put("carriedTileEntityCM", this.carriedBlockEntity.createNbt()); } } } diff --git a/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java b/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java index bca72d55..49f81043 100644 --- a/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java @@ -231,7 +231,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin )) private void onEntityInteract(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci) { - PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.method_37908()), playerInteractEntityC2SPacket_1.getHand()); + PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getWorld()), playerInteractEntityC2SPacket_1.getHand()); }*/ /*@Inject(method = "onPlayerInteractEntity", at = @At( @@ -241,7 +241,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin private void onEntityAttack(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci) { //todo add hit and hand in the future - PLAYER_ATTACKS_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.method_37908()), null); + PLAYER_ATTACKS_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getWorld()), null); }*/ @Inject(method = "onButtonClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V")) diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index c0f6f0b6..638b884e 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -16,7 +16,7 @@ import net.minecraft.world.biome.source.BiomeCoords; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkStatus; -import net.minecraft.world.gen.ChunkRandom; +import net.minecraft.world.gen.random.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.feature.ConfiguredStructureFeature; import net.minecraft.world.gen.feature.DefaultFeatureConfig; @@ -70,7 +70,7 @@ public abstract class StructureFeatureMixin implements Objects.requireNonNull(thiss); return registry3.getKey(thiss).map(Object::toString).orElseGet(thiss::toString); }); - ImmutableMultimap, RegistryKey> immutableMultimap = generator.getStructuresConfig().method_38424((StructureFeature) (Object)this); + ImmutableMultimap, RegistryKey> immutableMultimap = generator.getStructuresConfig().getConfiguredStructureFeature((StructureFeature) (Object)this); Predicate predicate = (b) -> { Objects.requireNonNull(immutableMultimap); diff --git a/src/main/java/carpet/patches/EntityPlayerMPFake.java b/src/main/java/carpet/patches/EntityPlayerMPFake.java index eb35f9a6..562effb0 100644 --- a/src/main/java/carpet/patches/EntityPlayerMPFake.java +++ b/src/main/java/carpet/patches/EntityPlayerMPFake.java @@ -80,7 +80,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity { player.getServer().getPlayerManager().remove(player); player.networkHandler.disconnect(new TranslatableText("multiplayer.disconnect.duplicate_login")); - ServerWorld worldIn = player.method_37908();//.getWorld(player.dimension); + ServerWorld worldIn = player.getWorld();//.getWorld(player.dimension); GameProfile gameprofile = player.getGameProfile(); EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true); server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), playerShadow); diff --git a/src/main/java/carpet/script/CarpetEventServer.java b/src/main/java/carpet/script/CarpetEventServer.java index 0635508c..113701ae 100644 --- a/src/main/java/carpet/script/CarpetEventServer.java +++ b/src/main/java/carpet/script/CarpetEventServer.java @@ -494,7 +494,7 @@ public class CarpetEventServer { return Arrays.asList( new EntityValue(player), - new BlockValue(null, player.method_37908(), blockpos), + new BlockValue(null, player.getWorld(), blockpos), StringValue.of(facing.getName()) ); }, player::getCommandSource); @@ -515,7 +515,7 @@ public class CarpetEventServer new EntityValue(player), ValueConversions.of(itemstack), StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.method_37908(), blockpos), + new BlockValue(null, player.getWorld(), blockpos), StringValue.of(enumfacing.getName()), ListValue.of( new NumericValue(vec3d.x), @@ -539,7 +539,7 @@ public class CarpetEventServer return Arrays.asList( new EntityValue(player), StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.method_37908(), blockpos), + new BlockValue(null, player.getWorld(), blockpos), StringValue.of(enumfacing.getName()), ListValue.of( new NumericValue(vec3d.x), @@ -559,7 +559,7 @@ public class CarpetEventServer new EntityValue(player), ValueConversions.of(itemstack), StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"), - new BlockValue(null, player.method_37908(), pos) + new BlockValue(null, player.getWorld(), pos) ), player::getCommandSource); } }; @@ -569,7 +569,7 @@ public class CarpetEventServer public void onBlockBroken(ServerPlayerEntity player, BlockPos pos, BlockState previousBS) { handler.call( - () -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.method_37908(), pos)), + () -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.getWorld(), pos)), player::getCommandSource ); } @@ -1083,7 +1083,7 @@ public class CarpetEventServer valArgs.add(EntityValue.of(player)); for (Object o: args) { - valArgs.add(ValueConversions.guess(player.method_37908(), o)); + valArgs.add(ValueConversions.guess(player.getWorld(), o)); } return valArgs; }, player::getCommandSource diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 65ca2fec..a1948607 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -97,7 +97,7 @@ import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.explosion.Explosion; -import net.minecraft.world.gen.ChunkRandom; +import net.minecraft.world.gen.random.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.feature.ConfiguredStructureFeature; import net.minecraft.world.gen.feature.StructureFeature; diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 60886f21..b53e72dd 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -718,7 +718,7 @@ public class ShapeDispatcher ParticleEffect particle = replacementParticle(); int partno = Math.min(1000,20*subdivisions); Random rand = p.world.getRandom(); - ServerWorld world = p.method_37908(); + ServerWorld world = p.getWorld(); Vec3d ccenter = relativiseRender(world, center, 0 ); @@ -796,7 +796,7 @@ public class ShapeDispatcher ParticleEffect particle = replacementParticle(); int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height))); Random rand = p.world.getRandom(); - ServerWorld world = p.method_37908(); + ServerWorld world = p.getWorld(); Vec3d ccenter = relativiseRender(world, center, 0 ); @@ -1275,7 +1275,7 @@ public class ShapeDispatcher int parts = 0; for (ServerPlayerEntity player : playerList) { - ServerWorld world = player.method_37908(); + ServerWorld world = player.getWorld(); world.spawnParticles(player, particle, true, (towards.x)/2+from.x, (towards.y)/2+from.y, (towards.z)/2+from.z, particles/3, towards.x/6, towards.y/6, towards.z/6, 0.0); @@ -1292,7 +1292,7 @@ public class ShapeDispatcher int dev = 2*divider; for (ServerPlayerEntity player : playerList) { - ServerWorld world = player.method_37908(); + ServerWorld world = player.getWorld(); world.spawnParticles(player, particle, true, (towards.x)/center+from.x, (towards.y)/center+from.y, (towards.z)/center+from.z, particles/divider, towards.x/dev, towards.y/dev, towards.z/dev, 0.0); @@ -1321,7 +1321,7 @@ public class ShapeDispatcher Vec3d at = from.add(towards.multiply( rand.nextDouble())); for (ServerPlayerEntity player : players) { - player.method_37908().spawnParticles(player, particle, true, + player.getWorld().spawnParticles(player, particle, true, at.x, at.y, at.z, 1, 0.0, 0.0, 0.0, 0.0); pcount ++; @@ -1339,7 +1339,7 @@ public class ShapeDispatcher { for (ServerPlayerEntity player : players) { - player.method_37908().spawnParticles(player, particle, true, + player.getWorld().spawnParticles(player, particle, true, delta.x+from.x, delta.y+from.y, delta.z+from.z, 1, 0.0, 0.0, 0.0, 0.0); pcount ++; diff --git a/src/main/java/carpet/script/value/BlockValue.java b/src/main/java/carpet/script/value/BlockValue.java index e80ed65a..ca1720ff 100644 --- a/src/main/java/carpet/script/value/BlockValue.java +++ b/src/main/java/carpet/script/value/BlockValue.java @@ -123,7 +123,7 @@ public class BlockValue extends Value data = new NbtCompound(); return null; } - data = be.method_38244(); // toNBT + data = be.createNbt(); return data; } return null;