From 04459094e6d29da692cb45fa22f20371503a8494 Mon Sep 17 00:00:00 2001 From: gnembon Date: Sat, 7 Dec 2019 01:07:19 -0400 Subject: [PATCH] 1.15 mixin cleanup --- ...EntityRenderDispatcher_movableTEMixin.java | 71 ---------------- .../BuriedTreasureGeneratorPieceMixin.java | 22 ----- .../carpet/mixins/ChunkGeneratorMixin.java | 3 - src/main/java/carpet/mixins/ChunkMixin.java | 5 -- ...erInteractionManager_ghostBlocksMixin.java | 56 ------------- .../carpet/mixins/FossilFeatureMixin.java | 22 ----- .../mixins/GameRenderer_pausedShakeMixin.java | 36 --------- .../GravityStructureProcessorMixin.java | 22 ----- .../mixins/IglooGeneratorPieceMixin.java | 22 ----- .../java/carpet/mixins/KelpFeatureMixin.java | 24 ------ .../carpet/mixins/MobEntity_leashMixin.java | 28 ------- .../mixins/OceanRuinGeneratorPieceMixin.java | 22 ----- .../mixins/PlayerEntity_horseFixMixin.java | 48 ----------- .../PortalBlock_portalCachingMixin.java | 45 ----------- .../PortalForcer_portalCachingMixin.java | 80 ------------------- ...ayerInteractionManager_antiCheatMixin.java | 31 +++++++ ...erInteractionManager_ghostBlocksMixin.java | 56 ------------- .../mixins/ShipwreckGeneratorPieceMixin.java | 29 ------- .../carpet/mixins/StructureFeatureMixin.java | 13 +-- .../carpet/mixins/StructurePieceMixin.java | 22 ----- .../carpet/mixins/World_scarpetPlopMixin.java | 31 +++++++ src/main/resources/carpet.mixins.json | 27 +------ 22 files changed, 72 insertions(+), 643 deletions(-) delete mode 100644 src/main/java/carpet/mixins/BlockEntityRenderDispatcher_movableTEMixin.java delete mode 100644 src/main/java/carpet/mixins/BuriedTreasureGeneratorPieceMixin.java delete mode 100644 src/main/java/carpet/mixins/ClientPlayerInteractionManager_ghostBlocksMixin.java delete mode 100644 src/main/java/carpet/mixins/FossilFeatureMixin.java delete mode 100644 src/main/java/carpet/mixins/GameRenderer_pausedShakeMixin.java delete mode 100644 src/main/java/carpet/mixins/GravityStructureProcessorMixin.java delete mode 100644 src/main/java/carpet/mixins/IglooGeneratorPieceMixin.java delete mode 100644 src/main/java/carpet/mixins/KelpFeatureMixin.java delete mode 100644 src/main/java/carpet/mixins/MobEntity_leashMixin.java delete mode 100644 src/main/java/carpet/mixins/OceanRuinGeneratorPieceMixin.java delete mode 100644 src/main/java/carpet/mixins/PlayerEntity_horseFixMixin.java delete mode 100644 src/main/java/carpet/mixins/PortalBlock_portalCachingMixin.java delete mode 100644 src/main/java/carpet/mixins/PortalForcer_portalCachingMixin.java create mode 100644 src/main/java/carpet/mixins/ServerPlayerInteractionManager_antiCheatMixin.java delete mode 100644 src/main/java/carpet/mixins/ServerPlayerInteractionManager_ghostBlocksMixin.java delete mode 100644 src/main/java/carpet/mixins/ShipwreckGeneratorPieceMixin.java delete mode 100644 src/main/java/carpet/mixins/StructurePieceMixin.java create mode 100644 src/main/java/carpet/mixins/World_scarpetPlopMixin.java diff --git a/src/main/java/carpet/mixins/BlockEntityRenderDispatcher_movableTEMixin.java b/src/main/java/carpet/mixins/BlockEntityRenderDispatcher_movableTEMixin.java deleted file mode 100644 index c83119cd..00000000 --- a/src/main/java/carpet/mixins/BlockEntityRenderDispatcher_movableTEMixin.java +++ /dev/null @@ -1,71 +0,0 @@ -package carpet.mixins; - -import carpet.fakes.BlockEntityRenderDispatcherInterface; -//import net.minecraft.block.BlockRenderLayer; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.render.BufferBuilder; -import net.minecraft.client.render.Camera; -import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.util.crash.CrashException; -import net.minecraft.util.crash.CrashReport; -import net.minecraft.util.crash.CrashReportSection; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(BlockEntityRenderDispatcher.class) -public abstract class BlockEntityRenderDispatcher_movableTEMixin implements BlockEntityRenderDispatcherInterface -{/* - @Shadow - public static double renderOffsetX; - @Shadow - public static double renderOffsetY; - @Shadow - public static double renderOffsetZ; - @Shadow - public Camera cameraEntity; - @Shadow - public World world; - - //@Shadow //Shadow doesn't work due to private+static+mixins requires abstract, therefore copied the whole method. //Todo fix this - private static void renderEntity(BlockEntity blockEntity_1, Runnable runnable_1){ - try { - runnable_1.run(); - } catch (Throwable var5) { - CrashReport crashReport_1 = CrashReport.create(var5, "Rendering Block Entity"); - CrashReportSection crashReportSection_1 = crashReport_1.addElement("Block Entity Details"); - blockEntity_1.populateCrashReport(crashReportSection_1); - throw new CrashException(crashReport_1); - } - } - @Shadow - public abstract BlockEntityRenderer get(/@Nullable/ BlockEntity blockEntity_1); - - / - @author 2No2Name - / - //Renders the BlockEntity offset by the amount specified in the arguments xOffset yOffset zOffset (the moving block moved in the animation by this) - //Code copied and modified from BlockEntityRenderDispatcher::render(BlockEntity blockEntity_1, float float_1, int int_1, BlockRenderLayer blockRenderLayer_1, BufferBuilder bufferBuilder_1) - public void renderBlockEntityOffset(BlockEntity blockEntity_1, float partialTicks, int destroyStage, BlockRenderLayer blockRenderLayer_1, BufferBuilder bufferBuilder_1, double xOffset, - double yOffset, double zOffset){ - if (blockEntity_1.getSquaredDistance(this.cameraEntity.getPos().x - xOffset, this.cameraEntity.getPos().y - yOffset, this.cameraEntity.getPos().z - zOffset) < blockEntity_1.getSquaredRenderDistance()) { - BlockEntityRenderer blockEntityRenderer_1 = this.get(blockEntity_1); - if (blockEntityRenderer_1 != null) { - if (blockEntity_1.hasWorld() && blockEntity_1.getType().supports(blockEntity_1.getCachedState().getBlock())) { - BlockPos blockPos_1 = blockEntity_1.getPos(); - renderEntity(blockEntity_1, () -> - { - bufferBuilder_1.method_22629(); //add layer to stack - bufferBuilder_1.method_22626(xOffset,yOffset,zOffset); //add offset for the Blockentity - blockEntityRenderer_1.method_22747(blockEntity_1, (double)blockPos_1.getX() - renderOffsetX, (double)blockPos_1.getY() - renderOffsetY, (double)blockPos_1.getZ() - renderOffsetZ, partialTicks, destroyStage, bufferBuilder_1, blockRenderLayer_1, blockPos_1); - //bufferBuilder_1.method_22626(-xOffset,-yOffset,-zOffset); //remove offset - bufferBuilder_1.method_22630(); //remove layer from stack - } - ); - } - } - } - }*/ -} diff --git a/src/main/java/carpet/mixins/BuriedTreasureGeneratorPieceMixin.java b/src/main/java/carpet/mixins/BuriedTreasureGeneratorPieceMixin.java deleted file mode 100644 index effaa2d3..00000000 --- a/src/main/java/carpet/mixins/BuriedTreasureGeneratorPieceMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.structure.BuriedTreasureGenerator; -import net.minecraft.world.Heightmap; -import net.minecraft.world.IWorld; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(BuriedTreasureGenerator.Piece.class) -public class BuriedTreasureGeneratorPieceMixin -{ - @Redirect(method = "generate", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3) - { - return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/ChunkGeneratorMixin.java b/src/main/java/carpet/mixins/ChunkGeneratorMixin.java index c256e209..47804b3a 100644 --- a/src/main/java/carpet/mixins/ChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/ChunkGeneratorMixin.java @@ -13,9 +13,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ChunkGenerator.class) public abstract class ChunkGeneratorMixin { - - ///used for plop - changed in 1.14 - feature needs reimplemnting - @Inject(method = "hasStructure", at = @At("HEAD"), cancellable = true) private void skipGenerationBiomeChecks(Biome biome_1, StructureFeature structureFeature_1, CallbackInfoReturnable cir) { diff --git a/src/main/java/carpet/mixins/ChunkMixin.java b/src/main/java/carpet/mixins/ChunkMixin.java index d76f9f9e..4afd1d38 100644 --- a/src/main/java/carpet/mixins/ChunkMixin.java +++ b/src/main/java/carpet/mixins/ChunkMixin.java @@ -11,15 +11,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Chunk.class) public abstract class ChunkMixin { - - ///used for plop - changed in 1.14 - feature needs reimplemnting - - @Inject(method = "markBlockForPostProcessing(Lnet/minecraft/util/math/BlockPos;)V", at =@At("HEAD"), cancellable = true) private void squashWarnings(BlockPos blockPos_1, CallbackInfo ci) { if (CarpetSettings.skipGenerationChecks) ci.cancel(); } - } diff --git a/src/main/java/carpet/mixins/ClientPlayerInteractionManager_ghostBlocksMixin.java b/src/main/java/carpet/mixins/ClientPlayerInteractionManager_ghostBlocksMixin.java deleted file mode 100644 index a4e7dbab..00000000 --- a/src/main/java/carpet/mixins/ClientPlayerInteractionManager_ghostBlocksMixin.java +++ /dev/null @@ -1,56 +0,0 @@ -package carpet.mixins; - - -import carpet.settings.CarpetSettings; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.item.AxeItem; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.IWorld; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(ClientPlayerInteractionManager.class) -public abstract class ClientPlayerInteractionManager_ghostBlocksMixin -{ -/* - @Shadow @Final private MinecraftClient client; - - @Redirect(method = "breakBlock", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/block/Block;onBroken(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V") - ) - private void requestServerStatusForBlock(Block block, IWorld iWorld_1, BlockPos blockPos_1, BlockState blockState_1) { - if ((CarpetSettings.miningGhostBlockFix || ( - !client.isInSingleplayer() && - !client.isIntegratedServerRunning() && - client.getNetworkHandler().getCommandDispatcher().getRoot().getChild("carpet") == null)) && - blockState_1.getHardness(client.world, blockPos_1) > 0.0 && - blockState_1.getCollisionShape(iWorld_1, blockPos_1) != VoxelShapes.empty() - ) - { - ItemStack handItem = client.player.getMainHandStack(); - if (handItem.isEmpty() || ( ( - handItem.getItem().getGroup() == ItemGroup.TOOLS || - handItem.getItem().getGroup() == ItemGroup.COMBAT ) && !(handItem.getItem() instanceof AxeItem )) - ) - client.getNetworkHandler().sendPacket(new PlayerInteractBlockC2SPacket( - Hand.MAIN_HAND, - new BlockHitResult(new Vec3d(blockPos_1), Direction.DOWN, blockPos_1, false) - )); - } - }*/ -} \ No newline at end of file diff --git a/src/main/java/carpet/mixins/FossilFeatureMixin.java b/src/main/java/carpet/mixins/FossilFeatureMixin.java deleted file mode 100644 index ffb695ce..00000000 --- a/src/main/java/carpet/mixins/FossilFeatureMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.world.Heightmap; -import net.minecraft.world.IWorld; -import net.minecraft.world.gen.feature.FossilFeature; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(FossilFeature.class) -public class FossilFeatureMixin -{ - @Redirect(method = "generate", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3) - { - return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/GameRenderer_pausedShakeMixin.java b/src/main/java/carpet/mixins/GameRenderer_pausedShakeMixin.java deleted file mode 100644 index ae240d58..00000000 --- a/src/main/java/carpet/mixins/GameRenderer_pausedShakeMixin.java +++ /dev/null @@ -1,36 +0,0 @@ -package carpet.mixins; - -import carpet.fakes.MinecraftClientInferface; -import carpet.helpers.TickSpeed; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.Camera; -import net.minecraft.client.render.GameRenderer; -//import net.minecraft.client.render.VisibleRegion; -import net.minecraft.client.render.WorldRenderer; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(GameRenderer.class) -public class GameRenderer_pausedShakeMixin -{ - @Shadow @Final private MinecraftClient client; /* needs fixing somewhere else - - @Redirect(method = "renderCenter", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/WorldRenderer;renderEntities(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/VisibleRegion;F)V" - )) - private void renderEntitiesNoShake(WorldRenderer worldRenderer, Camera camera_1, VisibleRegion visibleRegion_1, float float_1) - { - if (!TickSpeed.process_entities) - { - worldRenderer.renderEntities(camera_1, visibleRegion_1, ((MinecraftClientInferface)client).getPausedTickDelta()); - } - else - { - worldRenderer.renderEntities(camera_1, visibleRegion_1, float_1); - } - }*/ -} diff --git a/src/main/java/carpet/mixins/GravityStructureProcessorMixin.java b/src/main/java/carpet/mixins/GravityStructureProcessorMixin.java deleted file mode 100644 index 876877aa..00000000 --- a/src/main/java/carpet/mixins/GravityStructureProcessorMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.structure.processor.GravityStructureProcessor; -import net.minecraft.world.Heightmap; -import net.minecraft.world.WorldView; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(GravityStructureProcessor.class) -public class GravityStructureProcessorMixin -{ - @Redirect(method = "process", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/WorldView;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(WorldView worldView, Heightmap.Type var1, int var2, int var3) - { - return worldView.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/IglooGeneratorPieceMixin.java b/src/main/java/carpet/mixins/IglooGeneratorPieceMixin.java deleted file mode 100644 index f3017b6f..00000000 --- a/src/main/java/carpet/mixins/IglooGeneratorPieceMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.structure.IglooGenerator; -import net.minecraft.world.Heightmap; -import net.minecraft.world.IWorld; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(IglooGenerator.Piece.class) -public class IglooGeneratorPieceMixin -{ - @Redirect(method = "generate", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3) - { - return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/KelpFeatureMixin.java b/src/main/java/carpet/mixins/KelpFeatureMixin.java deleted file mode 100644 index 3a3c8f18..00000000 --- a/src/main/java/carpet/mixins/KelpFeatureMixin.java +++ /dev/null @@ -1,24 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.world.gen.feature.KelpFeature; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.Random; - -@Mixin(KelpFeature.class) -public class KelpFeatureMixin -{ - /*@Redirect(method = "method_13460", at = @At(value = "INVOKE", target = "Ljava/util/Random;nextInt(I)I")) - private int getRandom(Random random, int bound) - { - if (bound==10) - return random.nextInt(bound); - int limit = CarpetSettings.kelpGenerationGrowthLimit; - if (limit == 0) - return random.nextInt(bound); - return 25-limit+random.nextInt(Math.min(23,limit+1)); - }*/ -} diff --git a/src/main/java/carpet/mixins/MobEntity_leashMixin.java b/src/main/java/carpet/mixins/MobEntity_leashMixin.java deleted file mode 100644 index 1b052386..00000000 --- a/src/main/java/carpet/mixins/MobEntity_leashMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.entity.Entity; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.nbt.CompoundTag; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MobEntity.class) -public abstract class MobEntity_leashMixin -{ - @Shadow /*@Nullable*/ private Entity holdingEntity; - - @Shadow /*@Nullable*/ private CompoundTag leashTag; - - /*@Inject(method = "writeCustomDataToTag", at = @At("TAIL")) // added in 1.15 - private void addLeashData(CompoundTag compoundTag_1, CallbackInfo ci) - { - if (holdingEntity == null && CarpetSettings.leadFix && leashTag != null) - { - compoundTag_1.put("Leash", leashTag); - } - }*/ -} diff --git a/src/main/java/carpet/mixins/OceanRuinGeneratorPieceMixin.java b/src/main/java/carpet/mixins/OceanRuinGeneratorPieceMixin.java deleted file mode 100644 index 1500cd7f..00000000 --- a/src/main/java/carpet/mixins/OceanRuinGeneratorPieceMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.structure.OceanRuinGenerator; -import net.minecraft.world.Heightmap; -import net.minecraft.world.IWorld; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(OceanRuinGenerator.Piece.class) -public class OceanRuinGeneratorPieceMixin -{ - @Redirect(method = "generate", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3) - { - return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/PlayerEntity_horseFixMixin.java b/src/main/java/carpet/mixins/PlayerEntity_horseFixMixin.java deleted file mode 100644 index 547edd30..00000000 --- a/src/main/java/carpet/mixins/PlayerEntity_horseFixMixin.java +++ /dev/null @@ -1,48 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.client.network.packet.EntityPositionS2CPacket; -import net.minecraft.client.network.packet.VehicleMoveS2CPacket; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(PlayerEntity.class) -public abstract class PlayerEntity_horseFixMixin extends Entity -{ - - @Shadow public abstract ActionResult interact(Entity entity_1, Hand hand_1); - - public PlayerEntity_horseFixMixin(EntityType entityType_1, World world_1) - { - super(entityType_1, world_1); - } - /* fixed in 1.15 pre-2 - @Inject(method = "stopRiding", at = @At("HEAD")) - private void resetNavigation(CallbackInfo ci) - { - if (this.getVehicle() != null && CarpetSettings.horseWanderingFix) - { - if (getVehicle() instanceof MobEntity) - ((MobEntity) getVehicle()).getNavigation().stop(); - if (!getEntityWorld().isClient) - { - ((ServerWorld) getEntityWorld()).getChunkManager().sendToNearbyPlayers(this, new EntityPositionS2CPacket(getVehicle())); - // not sure if player at this point is actually considered to be next to the exiting vehicle - ((ServerPlayerEntity)(Object)this).networkHandler.sendPacket(new EntityPositionS2CPacket(getVehicle())); - ((ServerPlayerEntity)(Object)this).networkHandler.sendPacket(new VehicleMoveS2CPacket(getVehicle())); - } - } - }*/ -} diff --git a/src/main/java/carpet/mixins/PortalBlock_portalCachingMixin.java b/src/main/java/carpet/mixins/PortalBlock_portalCachingMixin.java deleted file mode 100644 index 1e51e330..00000000 --- a/src/main/java/carpet/mixins/PortalBlock_portalCachingMixin.java +++ /dev/null @@ -1,45 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import carpet.fakes.PortalForcerInterface; -import net.minecraft.block.BlockState; -import net.minecraft.block.PortalBlock; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.IWorld; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(PortalBlock.class) -public class PortalBlock_portalCachingMixin -{ - /* - @Inject(method = "createPortalAt", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/block/PortalBlock$AreaHelper;createPortal()V" - )) - private void onCreatePortal(IWorld iWorld_1, BlockPos blockPos_1, CallbackInfoReturnable cir) - { - if (!iWorld_1.isClient() && CarpetSettings.portalCaching) - { - ((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache(); - } - } - - @Inject(method = "getStateForNeighborUpdate", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/block/Block;getDefaultState()Lnet/minecraft/block/BlockState;" - )) - private void getAirBlockState(BlockState blockState_1, Direction direction_1, BlockState blockState_2, IWorld iWorld_1, BlockPos blockPos_1, BlockPos blockPos_2, CallbackInfoReturnable cir) - { - if (!iWorld_1.isClient() && CarpetSettings.portalCaching) - { - ((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache(); - } - } - */ - -} diff --git a/src/main/java/carpet/mixins/PortalForcer_portalCachingMixin.java b/src/main/java/carpet/mixins/PortalForcer_portalCachingMixin.java deleted file mode 100644 index 3e819a5d..00000000 --- a/src/main/java/carpet/mixins/PortalForcer_portalCachingMixin.java +++ /dev/null @@ -1,80 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import carpet.fakes.PortalForcerInterface; -import net.minecraft.entity.Entity; -import net.minecraft.server.world.ChunkTicketType; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.ColumnPos; -import net.minecraft.world.PortalForcer; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.HashMap; -import java.util.Map; - -@Mixin(PortalForcer.class) -public abstract class PortalForcer_portalCachingMixin implements PortalForcerInterface -{ - /* - @Shadow @Final private ServerWorld world; - private Map storedTicketInfos = new HashMap<>(); - - @Override - public void invalidateCache() - { - storedTicketInfos.clear(); - } - - @Inject(method = "createPortal", at = @At("HEAD")) - private void portalSpawnedByTheGame(Entity entity_1, CallbackInfoReturnable cir) - { - invalidateCache(); - } - - @Redirect(method = "getPortal", at = @At( - value = "INVOKE", - target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;" - )) - private Object / private TicketInfo / getTicketInfo(Map map, Object / ColumnPos / key) - { - //Do the dance with ticketinfos. If vanilla has one, we gonna borrow, if vanilla is missing, we supply - if (!CarpetSettings.portalCaching) - return map.get(key); - Object ticketInfo = map.get(key); - if (ticketInfo != null) - { - storedTicketInfos.put((ColumnPos) key, ticketInfo); - return ticketInfo; - } - ticketInfo = storedTicketInfos.get(key); - if (ticketInfo != null) - { - // vanilla got removed, but we stored it meaning we not only need to add it but also let it chunkload - map.put(key, ticketInfo); - ColumnPos cpos = (ColumnPos)key; - BlockPos fakePos = new BlockPos(((ColumnPos) key).x, 0, ((ColumnPos) key).z); - world.method_14178().addTicket(ChunkTicketType.PORTAL, new ChunkPos(fakePos), 3, (ColumnPos) key); - } - return ticketInfo; - } - - @Redirect(method = "getPortal", at = @At( - value = "INVOKE", - target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;" - )) - private Object / TicketInfo / putNewTicket(Map map, Object /ColumnPos / key, Object /TicketInfo / value) - { - if (CarpetSettings.portalCaching) - storedTicketInfos.put((ColumnPos) key, value); - return map.put(key, value); - } - */ -} diff --git a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_antiCheatMixin.java b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_antiCheatMixin.java new file mode 100644 index 00000000..a976a5d9 --- /dev/null +++ b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_antiCheatMixin.java @@ -0,0 +1,31 @@ +package carpet.mixins; + +import carpet.settings.CarpetSettings; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.network.ServerPlayerInteractionManager; +import net.minecraft.server.network.packet.PlayerActionC2SPacket; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockView; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(ServerPlayerInteractionManager.class) +public class ServerPlayerInteractionManager_antiCheatMixin +{ + @Shadow public ServerPlayerEntity player; + + @ModifyConstant(method = "processBlockBreakingAction", + constant = @Constant(doubleValue = 36D)) + private double addDistance(double original) { + if (CarpetSettings.antiCheatDisabled) + return 1024D; // blocks 32 distance + return original; + } +} diff --git a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_ghostBlocksMixin.java b/src/main/java/carpet/mixins/ServerPlayerInteractionManager_ghostBlocksMixin.java deleted file mode 100644 index 4488603f..00000000 --- a/src/main/java/carpet/mixins/ServerPlayerInteractionManager_ghostBlocksMixin.java +++ /dev/null @@ -1,56 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.network.ServerPlayerInteractionManager; -import net.minecraft.server.network.packet.PlayerActionC2SPacket; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockView; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.ModifyConstant; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(ServerPlayerInteractionManager.class) -public class ServerPlayerInteractionManager_ghostBlocksMixin -{ - @Shadow public ServerPlayerEntity player; - - /* - 1.15 changes the protocol to include instamine as a possible action - @Redirect(method = "method_14263", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/block/BlockState;calcBlockBreakingDelta(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F") - - ) - private float noCheatBlockBreakSpeed(BlockState blockState, PlayerEntity playerEntity_1, BlockView blockView_1, BlockPos blockPos_1, - // main args - BlockPos blockPos_1a, PlayerActionC2SPacket.Action playerActionC2SPacket$Action_1, Direction direction_1, int int_1) - { - float progress = blockState.calcBlockBreakingDelta(playerEntity_1, blockView_1, blockPos_1); - if (CarpetSettings.miningGhostBlockFix && - (playerActionC2SPacket$Action_1 == PlayerActionC2SPacket.Action.START_DESTROY_BLOCK) && - !playerEntity_1.onGround && !playerEntity_1.isClimbing() && !playerEntity_1.isFallFlying() && - progress >= 0.2 - ) - return progress*5; - if (CarpetSettings.miningGhostBlockFix && - (playerActionC2SPacket$Action_1 == PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK) - ) - return 1.0f; - return progress; - }*/ - - @ModifyConstant(method = "processBlockBreakingAction", - constant = @Constant(doubleValue = 36D)) - private double addDistance(double original) { - if (CarpetSettings.antiCheatDisabled) - return 1024D; // blocks 32 distance - return original; - } -} diff --git a/src/main/java/carpet/mixins/ShipwreckGeneratorPieceMixin.java b/src/main/java/carpet/mixins/ShipwreckGeneratorPieceMixin.java deleted file mode 100644 index a4162f19..00000000 --- a/src/main/java/carpet/mixins/ShipwreckGeneratorPieceMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.structure.ShipwreckGenerator; -import net.minecraft.world.Heightmap; -import net.minecraft.world.IWorld; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(ShipwreckGenerator.Piece.class) -public class ShipwreckGeneratorPieceMixin -{ - @Shadow @Final private boolean grounded; - - @Redirect(method = "generate", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/IWorld;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(IWorld iWorld, Heightmap.Type var1, int var2, int var3) - { - if (grounded) - return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:Heightmap.Type.WORLD_SURFACE_WG, var2, var3); - else - return iWorld.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index 82a5644e..44f098b6 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -52,7 +52,6 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface StructureStart structurestart = forceStructureStart(world, generator, rand, chId); if (structurestart == null || structurestart == StructureStart.DEFAULT) { - CarpetSettings.skipGenerationChecks = false; return false; } //generator.ge getStructurePositionToReferenceMap(this).computeIfAbsent(chId, @@ -89,14 +88,16 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface } } } - catch (Exception ignored) + catch (Exception booboo) { - CarpetSettings.LOG.error("Unknown Exception while plopping structure: "+ignored); - ignored.printStackTrace(); - CarpetSettings.skipGenerationChecks = false; + CarpetSettings.LOG.error("Unknown Exception while plopping structure: "+booboo); + booboo.printStackTrace(); return false; } - CarpetSettings.skipGenerationChecks = false; + finally + { + CarpetSettings.skipGenerationChecks = false; + } return true; } diff --git a/src/main/java/carpet/mixins/StructurePieceMixin.java b/src/main/java/carpet/mixins/StructurePieceMixin.java deleted file mode 100644 index d988dbcc..00000000 --- a/src/main/java/carpet/mixins/StructurePieceMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package carpet.mixins; - -import carpet.settings.CarpetSettings; -import net.minecraft.structure.StructurePiece; -import net.minecraft.world.Heightmap; -import net.minecraft.world.WorldView; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(StructurePiece.class) -public class StructurePieceMixin -{ - @Redirect(method = "isUnderSeaLevel", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/world/WorldView;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I" - )) - private int getTop(WorldView worldView, Heightmap.Type var1, int var2, int var3) - { - return worldView.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3); - } -} diff --git a/src/main/java/carpet/mixins/World_scarpetPlopMixin.java b/src/main/java/carpet/mixins/World_scarpetPlopMixin.java new file mode 100644 index 00000000..f378f03c --- /dev/null +++ b/src/main/java/carpet/mixins/World_scarpetPlopMixin.java @@ -0,0 +1,31 @@ +package carpet.mixins; + +import carpet.settings.CarpetSettings; +import net.minecraft.world.Heightmap; +import net.minecraft.world.World; +import net.minecraft.world.chunk.WorldChunk; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(World.class) +public class World_scarpetPlopMixin +{ + + @Redirect(method = "getTopY", at = @At( + value = "INVOKE", + target = "net/minecraft/world/chunk/WorldChunk.sampleHeightmap(Lnet/minecraft/world/Heightmap$Type;II)I" + )) + private int fixSampleHeightmap(WorldChunk chunk, Heightmap.Type type, int x, int z) + { + if (CarpetSettings.skipGenerationChecks) + { + Heightmap.Type newType = type; + if (type == Heightmap.Type.OCEAN_FLOOR_WG) newType = Heightmap.Type.OCEAN_FLOOR; + else if (type == Heightmap.Type.WORLD_SURFACE_WG) newType = Heightmap.Type.WORLD_SURFACE; + return chunk.sampleHeightmap(newType, x, z); + } + return chunk.sampleHeightmap(type, x, z); + } +} + diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 18145770..ad824750 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -26,7 +26,6 @@ "MobEntityMixin", "ServerWorld_unloadedEntityMixin", - "MobEntity_leashMixin", "EntityTrackerEntry_leashFixMixin", "VillagerEntity_aiMixin", @@ -51,17 +50,11 @@ "PoweredRailBlock_powerLimitMixin", "LivingEntity_maxCollisionsMixin", "ServerWorld_onePlayerSleepingMixin", - "KelpFeatureMixin", "CoralBlockMixin", "CoralFeatureMixin", - "StructurePieceMixin", "StructureFeatureMixin", - "ShipwreckGeneratorPieceMixin", - "OceanRuinGeneratorPieceMixin", - "IglooGeneratorPieceMixin", - "FossilFeatureMixin", - "BuriedTreasureGeneratorPieceMixin", - "GravityStructureProcessorMixin", + "World_scarpetPlopMixin", + "ServerPlayNetworkHandler_scarpetEventsMixin", "ServerPlayerInteractionManager_scarpetEventsMixin", "PlayerEntity_parrotMixin", @@ -90,15 +83,10 @@ "ServerPlayNetworkHandler_antiCheatDisabledMixin", "PlayerEntity_antiCheatDisabled", - "PortalForcer_portalCachingMixin", - "PortalBlock_portalCachingMixin", - "Entity_portalSuffocationMixin", "PortalForcer_portalSuffocationMixin", - "PlayerEntity_horseFixMixin", - - "ServerPlayerInteractionManager_ghostBlocksMixin", + "ServerPlayerInteractionManager_antiCheatMixin", "HopperBlockEntityMixin", "ContainerMixin", @@ -134,8 +122,6 @@ "FallingBlockEntity_scarpetEventsMixin", "ChunkTicketManager_scarpetMixin", "ServerChunkManager_scarpetMixin", - - "PistonBlock_movableTEMixin", "PistonBlockEntity_movableTEMixin", "World_movableTEMixin", @@ -145,18 +131,11 @@ "client": [ "RenderTickCounter_tickSpeedMixin", "MinecraftClientMixin", - "MinecraftClient_pausedShakeMixin", - "GameRenderer_pausedShakeMixin", "WorldRenderer_pausedShakeMixin", - "IntegratedServerMixin", "InGameHudMixin", "PlayerListHudMixin", - - "ClientPlayerInteractionManager_ghostBlocksMixin", - - "BlockEntityRenderDispatcher_movableTEMixin", "PistonBlockEntityRenderer_movableTEMixin" ], "server": [