1.15 mixin cleanup
This commit is contained in:
1 parent
380b9131d8
commit
04459094e6
22 files changed
+72
-643
No files matched your search
@@ -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 <T extends BlockEntity> BlockEntityRenderer<T> 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<BlockEntity> 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
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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<? extends FeatureConfig> structureFeature_1, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}*/
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -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<Boolean> 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<BlockState> cir)
|
||||
{
|
||||
if (!iWorld_1.isClient() && CarpetSettings.portalCaching)
|
||||
{
|
||||
((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -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<ColumnPos, Object> storedTicketInfos = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void invalidateCache()
|
||||
{
|
||||
storedTicketInfos.clear();
|
||||
}
|
||||
|
||||
@Inject(method = "createPortal", at = @At("HEAD"))
|
||||
private void portalSpawnedByTheGame(Entity entity_1, CallbackInfoReturnable<Boolean> 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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user