19w41a first pass

This commit is contained in:
gnembon committed 2019-10-09 19:43:37 -03:00
1 parent 5ebfb7d1c0
commit 7b649f9ccd
28 files changed
+164 -178

No files matched your search

@@ -0,0 +1,35 @@
package carpet.mixins;
import carpet.fakes.BiomeArrayInterface;
import carpet.settings.CarpetSettings;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeArray;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(BiomeArray.class)
public class BiomeArray_getBiomeArrayMixin implements BiomeArrayInterface
{
@Shadow @Final private static int HORIZONTAL_SECTION_COUNT;
@Shadow @Final public static int HORIZONTAL_BIT_MASK;
@Shadow @Final public static int VERTICAL_BIT_MASK;
@Shadow @Final private Biome[] data;
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
int seaLevel = 0;// seems to be a fixed value for now. world.getSeaLevel();
int int_4 = (pos.getX() >> 2) & HORIZONTAL_BIT_MASK;
int int_5 = MathHelper.clamp(seaLevel, 0, VERTICAL_BIT_MASK);
int int_6 = (pos.getZ() >> 2) & HORIZONTAL_BIT_MASK;
data[(int_5 << (HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT)) | (int_6 << HORIZONTAL_SECTION_COUNT) | int_4] = what;
}
}
@@ -1,7 +1,7 @@
package carpet.mixins;
import carpet.fakes.BlockEntityRenderDispatcherInterface;
import net.minecraft.block.BlockRenderLayer;
//import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Camera;
@@ -29,7 +29,7 @@ public abstract class FallingBlockEntityMixin extends Entity
private void tickCheck(CallbackInfo ci)
{
if (LoggerRegistry.__fallingBlocks && logHelper != null)
logHelper.onTick(x, y, z, getVelocity());
logHelper.onTick(method_23317(), method_23318(), method_23321(), getVelocity());
}
@Override
@@ -1,9 +1,9 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
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;
@@ -13,10 +13,10 @@ public class GravityStructureProcessorMixin
{
@Redirect(method = "process", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_4538;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/WorldView;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
private int getTop(WorldView worldView, Heightmap.Type var1, int var2, int var3)
{
return class_4538.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
return worldView.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
}
}
@@ -27,7 +27,7 @@ public abstract class GuardianEntityMixin extends HostileEntity
if (!this.world.isClient && !this.removed && CarpetSettings.renewableSponges)
{
ElderGuardianEntity elderGuardian = new ElderGuardianEntity(EntityType.ELDER_GUARDIAN ,this.world);
elderGuardian.setPositionAndAngles(this.x, this.y, this.z, this.yaw, this.pitch);
elderGuardian.setPositionAndAngles(this.method_23317(), this.method_23318(), this.method_23321(), this.yaw, this.pitch);
elderGuardian.initialize(this.world ,this.world.getLocalDifficulty(new BlockPos(elderGuardian)), SpawnType.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.setAiDisabled(this.isAiDisabled());
@@ -4,11 +4,11 @@ import carpet.settings.CarpetSettings;
import carpet.fakes.PistonBlockEntityInterface;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.class_4587;
import net.minecraft.class_4597;
import net.minecraft.client.render.LayeredVertexConsumerStorage;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.PistonBlockEntityRenderer;
import net.minecraft.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -24,8 +24,9 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin extends BlockEnti
}
@Inject(method = "method_3576", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/render/block/entity/PistonBlockEntityRenderer;method_3575(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/class_4587;Lnet/minecraft/class_4597;Lnet/minecraft/world/World;Z)V", ordinal = 3))
private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci)
target = "Lnet/minecraft/client/render/block/entity/PistonBlockEntityRenderer;method_3575(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/MatrixStack;Lnet/minecraft/client/render/LayeredVertexConsumerStorage;Lnet/minecraft/world/World;ZI)V", ordinal = 3))
private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, MatrixStack matrixStack_1, LayeredVertexConsumerStorage layeredVertexConsumerStorage_1, int int_1, int int_2, CallbackInfo ci)
//private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci)
{
if (!((PistonBlockEntityInterface) pistonBlockEntity_1).isRenderModeSet())
((PistonBlockEntityInterface) pistonBlockEntity_1).setRenderCarriedBlockEntity(CarpetSettings.movableBlockEntities && ((PistonBlockEntityInterface) pistonBlockEntity_1).getCarriedBlockEntity() != null);
@@ -33,7 +34,7 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin extends BlockEnti
@Inject(method = "method_3576", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE)
private void endMethod3576(PistonBlockEntity pistonBlockEntity_1, double xOffset, double yOffset, double zOffset, float partialTicks, class_4587 transform, class_4597 bufferWrapper, int int_1, CallbackInfo ci)
private void endMethod3576(PistonBlockEntity pistonBlockEntity_1, double xOffset, double yOffset, double zOffset, float partialTicks, MatrixStack matrixStack_1, LayeredVertexConsumerStorage layeredVertexConsumerStorage_1, int int_1, int init_2, CallbackInfo ci)
{
if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity())
{
@@ -42,12 +43,12 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin extends BlockEnti
{
carriedBlockEntity.setPos(pistonBlockEntity_1.getPos());
//((BlockEntityRenderDispatcherInterface) BlockEntityRenderDispatcher.INSTANCE).renderBlockEntityOffset(carriedBlockEntity, float_1, int_1, BlockRenderLayer.field_20799, bufferBuilder_1, pistonBlockEntity_1.getRenderOffsetX(float_1), pistonBlockEntity_1.getRenderOffsetY(float_1), pistonBlockEntity_1.getRenderOffsetZ(float_1));
transform.method_22904( // translate
matrixStack_1.translate(
pistonBlockEntity_1.getRenderOffsetX(partialTicks),
pistonBlockEntity_1.getRenderOffsetY(partialTicks),
pistonBlockEntity_1.getRenderOffsetZ(partialTicks)
);
BlockEntityRenderDispatcher.INSTANCE.render(carriedBlockEntity, partialTicks, transform, bufferWrapper, xOffset, yOffset, zOffset);
BlockEntityRenderDispatcher.INSTANCE.render(carriedBlockEntity, partialTicks, matrixStack_1, layeredVertexConsumerStorage_1, xOffset, yOffset, zOffset);
}
}
@@ -35,9 +35,9 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
if (CarpetSettings.stickyHoney && direction_1 != direction_2)
{
Block block = blockState_1.getBlock();
if (block != Blocks.GOLD_BLOCK && block != Blocks.SLIME_BLOCK) return;
if (block != Blocks.HONEY_BLOCK && block != Blocks.SLIME_BLOCK) return;
Block otherBlock = world_1.getBlockState(blockPos_1.method_10079(direction_2.getOpposite(),1)).getBlock();
if (otherBlock != Blocks.GOLD_BLOCK && otherBlock != Blocks.SLIME_BLOCK) return;
if (otherBlock != Blocks.HONEY_BLOCK && otherBlock != Blocks.SLIME_BLOCK) return;
cir.setReturnValue(block == otherBlock);
}
}
@@ -41,10 +41,6 @@ public abstract class PistonHandler_movableTEMixin
* @author 2No2Name
*/
private void stickToStickySide(BlockPos blockPos_1, Direction direction_1, CallbackInfoReturnable<Boolean> cir, BlockState blockState_1, Block block_1, int int_1, int int_2, int int_4, BlockPos blockPos_3, int int_5, int int_6){
if (CarpetSettings.stickyHoney && this.world.getBlockState(blockPos_1).getBlock() == Blocks.GOLD_BLOCK && !method_11538(blockPos_1)) {
cir.setReturnValue(false);
return;
}
if(!stickToStickySide(blockPos_3)){
cir.setReturnValue(false);
cir.cancel();
@@ -58,11 +54,6 @@ public abstract class PistonHandler_movableTEMixin
*/
private void stickToStickySide(CallbackInfoReturnable<Boolean> cir, int int_1){
BlockPos pos = this.movedBlocks.get(int_1);
if (CarpetSettings.stickyHoney && world.getBlockState(pos).getBlock() == Blocks.GOLD_BLOCK && !method_11538(pos))
{
cir.setReturnValue(false);
return;
}
if(!stickToStickySide(pos)){
cir.setReturnValue(false);
cir.cancel();
@@ -112,19 +103,15 @@ public abstract class PistonHandler_movableTEMixin
private BlockState redirectGetBlockState_1_B(World world, BlockPos pos) {
return blockState_1 = world.getBlockState(pos);
}
@Redirect(method = "tryMove",
at = @At(value = "FIELD", target = "Lnet/minecraft/block/Blocks;SLIME_BLOCK:Lnet/minecraft/block/Block;"))
@Inject(method = "method_23367", at = @At(value = "HEAD"), cancellable = true)
//Thanks to Earthcomputer for showing how to redirect FIELD access like this
/**
* Makes backwards stickyness work with sticky non-slimeblocks as well.
* @author 2No2Nameb
*/
private Block redirectSlimeBlock() {
if (CarpetSettings.stickyHoney && blockState_1.getBlock() == Blocks.GOLD_BLOCK)
return Blocks.GOLD_BLOCK;
private void redirectSlimeBlock(Block block_1, CallbackInfoReturnable<Boolean> cir) {
if (CarpetSettings.movableBlockEntities && isStickyOnSide(blockState_1, this.direction.getOpposite()))
return blockState_1.getBlock(); //this makes the comparison in the while condition "while(blockState_1.getBlock() == redirectSlimeBlock())" evaluate to true, so the block is treated as sticky
return Blocks.SLIME_BLOCK; //vanilla behavior
cir.setReturnValue(true);
}
@@ -29,7 +29,7 @@ public abstract class ProjectileEntityMixin extends Entity
private void tickCheck(CallbackInfo ci)
{
if (LoggerRegistry.__projectiles && logHelper != null)
logHelper.onTick(x, y, z, getVelocity());
logHelper.onTick(method_23317(), method_23318(), method_23321(), getVelocity());
}
@Inject(method = "onHit(Lnet/minecraft/util/hit/HitResult;)V", at = @At("RETURN"))
@@ -20,6 +20,8 @@ public class ServerPlayNetworkHandler_tickMixin
@Shadow private double lastTickY;
@Shadow private double lastTickZ;
@Inject(method = "onPlayerInput", at = @At(value = "RETURN"))
private void checkMoves(PlayerInputC2SPacket p, CallbackInfo ci)
{
@@ -36,9 +38,9 @@ public class ServerPlayNetworkHandler_tickMixin
))
private void checkMove(PlayerMoveC2SPacket p, CallbackInfo ci)
{
if (Math.abs(p.getX(player.x) - lastTickX) > 0.0001D
|| Math.abs(p.getY(player.y) - lastTickY) > 0.0001D
|| Math.abs(p.getY(player.y) - lastTickY) > 0.0001D)
if (Math.abs(p.getX(player.method_23317()) - lastTickX) > 0.0001D
|| Math.abs(p.getY(player.method_23318()) - lastTickY) > 0.0001D
|| Math.abs(p.getY(player.method_23321()) - lastTickZ) > 0.0001D)
{
TickSpeed.reset_player_active_timeout();
}
@@ -17,7 +17,7 @@ public class ServerPlayerInteractionManager_cactusMixin
@Redirect(method = "interactBlock", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockState;activate(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Z"
target = "Lnet/minecraft/block/BlockState;onUse(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Z"
))
private boolean activateWithOptionalCactus(BlockState blockState, World world_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1)
{
@@ -25,6 +25,6 @@ public class ServerPlayerInteractionManager_cactusMixin
if (flipped)
return true;
return blockState.activate(world_1, playerEntity_1, hand_1, blockHitResult_1);
return blockState.onUse(world_1, playerEntity_1, hand_1, blockHitResult_1);
}
}
@@ -9,6 +9,7 @@ import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.BlockBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.gen.chunk.ChunkGenerator;
@@ -101,6 +102,10 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
private StructureStart forceStructureStart(IWorld worldIn, ChunkGenerator <? extends ChunkGeneratorConfig > generator, Random rand, long packedChunkPos)
{
if (2+1==3)
{
throw new RuntimeException("reimplement it");
}
ChunkPos chunkpos = new ChunkPos(packedChunkPos);
StructureStart structurestart;
@@ -115,7 +120,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
return structurestart;
}
}
Biome biome_1 = generator.getBiomeSource().getBiome((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
Biome biome_1 = Biomes.PLAINS;// generator.getBiomeSource().getBiome((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,generator.getSeed());
structurestart1.initialize(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
@@ -1,9 +1,9 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
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;
@@ -13,10 +13,10 @@ public class StructurePieceMixin
{
@Redirect(method = "isUnderSeaLevel", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_4538;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/WorldView;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
private int getTop(WorldView worldView, Heightmap.Type var1, int var2, int var3)
{
return class_4538.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return worldView.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -29,7 +29,7 @@ public abstract class ThrownEntityMixin extends Entity
private void tickCheck(CallbackInfo ci)
{
if (LoggerRegistry.__projectiles && logHelper != null)
logHelper.onTick(x, y, z, getVelocity());
logHelper.onTick(method_23317(), method_23318(), method_23321(), getVelocity());
}
@Override
@@ -38,7 +38,7 @@ public abstract class TntEntityMixin extends Entity
{
if (LoggerRegistry.__tnt && logHelper != null && !logHelper.initialized)
{
logHelper.onPrimed(x, y, z, getVelocity());
logHelper.onPrimed(method_23317(), method_23318(), method_23321(), getVelocity());
}
}
@@ -56,6 +56,6 @@ public abstract class TntEntityMixin extends Entity
private void onExplode(CallbackInfo ci)
{
if (LoggerRegistry.__tnt && logHelper != null)
logHelper.onExploded(x, y, z);
logHelper.onExploded(method_23317(), method_23318(), method_23321());
}
}
@@ -123,7 +123,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
if (bedPos == null || bedPos.getDimension() != dimension)
{
sayNo();
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, x, y + getStandingEyeHeight() + 1, z, 1, 0.1, 0.1, 0.1, 0.0);
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, method_23317(), method_23318() + getStandingEyeHeight() + 1, method_23321(), 1, 0.1, 0.1, 0.1, 0.0);
}
else
{
@@ -181,7 +181,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
{
if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
{
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, x, y+3, z, 1, 0.1, 0.1, 0.1, 0.0);
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, method_23317(), method_23318()+3, method_23321(), 1, 0.1, 0.1, 0.1, 0.0);
}
}
@@ -1,34 +0,0 @@
package carpet.mixins;
import carpet.fakes.class_4548Interface;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4548;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import static net.minecraft.class_4548.field_20650;
import static net.minecraft.class_4548.field_20651;
@Mixin(class_4548.class)
public class class_4548_getBiomeArrayMixin implements class_4548Interface
{
@Shadow @Final private Biome[] field_20654;
@Shadow @Final private static int field_20652;
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
int seaLevel = 0;// seems to be a fixed value for now. world.getSeaLevel();
int int_4 = (pos.getX() >> 2) & field_20650;
int int_5 = MathHelper.clamp(seaLevel, 0, field_20651);
int int_6 = (pos.getZ() >> 2) & field_20650;
field_20654[(int_5 << (field_20652 + field_20652)) | (int_6 << field_20652) | int_4] = what;
}
}