20w45a
This commit is contained in:
1 parent
79dc85274d
commit
2cdea92da7
55 files changed
+453
-287
No files matched your search
@@ -32,13 +32,12 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
|
||||
private BlockEntity carriedBlockEntity;
|
||||
private boolean renderCarriedBlockEntity = false;
|
||||
private boolean renderSet = false;
|
||||
|
||||
public PistonBlockEntity_movableTEMixin(BlockEntityType<?> blockEntityType_1)
|
||||
{
|
||||
super(blockEntityType_1);
|
||||
|
||||
public PistonBlockEntity_movableTEMixin(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) {
|
||||
super(blockEntityType, blockPos, blockState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author 2No2Name
|
||||
*/
|
||||
@@ -46,12 +45,23 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
|
||||
{
|
||||
return carriedBlockEntity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void method_31662(World world) {
|
||||
super.method_31662(world);
|
||||
if (carriedBlockEntity != null) carriedBlockEntity.method_31662(world);
|
||||
}
|
||||
|
||||
public void setCarriedBlockEntity(BlockEntity blockEntity)
|
||||
{
|
||||
this.carriedBlockEntity = blockEntity;
|
||||
if (this.carriedBlockEntity != null)
|
||||
this.carriedBlockEntity.setPos(this.pos);
|
||||
{
|
||||
((BlockEntity_movableBEMixin)carriedBlockEntity).setPos(pos);
|
||||
// this might be little dangerous since pos is final for a hashing reason?
|
||||
if (world != null) carriedBlockEntity.method_31662(world);
|
||||
}
|
||||
// this.carriedBlockEntity.setPos(this.pos);
|
||||
}
|
||||
|
||||
public boolean isRenderModeSet()
|
||||
@@ -73,14 +83,16 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
|
||||
/**
|
||||
* @author 2No2Name
|
||||
*/
|
||||
@Redirect(method = "tick", at = @At(value = "INVOKE",
|
||||
@Redirect(method = "method_31707", at = @At(value = "INVOKE", // tick
|
||||
target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
|
||||
private boolean movableTEsetBlockState0(World world, BlockPos blockPos_1, BlockState blockAState_2, int int_1)
|
||||
private static boolean movableTEsetBlockState0(
|
||||
World world, BlockPos blockPos_1, BlockState blockAState_2, int int_1,
|
||||
World world2, BlockPos blockPos, BlockState blockState, PistonBlockEntity pistonBlockEntity)
|
||||
{
|
||||
if (!CarpetSettings.movableBlockEntities)
|
||||
return world.setBlockState(blockPos_1, blockAState_2, int_1);
|
||||
else
|
||||
return ((WorldInterface) (world)).setBlockStateWithBlockEntity(blockPos_1, blockAState_2, this.carriedBlockEntity, int_1);
|
||||
return ((WorldInterface) (world)).setBlockStateWithBlockEntity(blockPos_1, blockAState_2, ((PistonBlockEntityInterface)pistonBlockEntity).getCarriedBlockEntity(), int_1);
|
||||
}
|
||||
|
||||
@Redirect(method = "finish", at = @At(value = "INVOKE",
|
||||
@@ -116,14 +128,15 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
|
||||
}
|
||||
|
||||
@Inject(method = "fromTag", at = @At(value = "TAIL"))
|
||||
private void onFromTag(BlockState state, CompoundTag compoundTag_1, CallbackInfo ci)
|
||||
private void onFromTag(CompoundTag compoundTag_1, CallbackInfo ci)
|
||||
{
|
||||
if (CarpetSettings.movableBlockEntities && compoundTag_1.contains("carriedTileEntityCM", 10))
|
||||
{
|
||||
if (this.pushedBlock.getBlock() instanceof BlockEntityProvider)
|
||||
this.carriedBlockEntity = ((BlockEntityProvider) (this.pushedBlock.getBlock())).createBlockEntity(this.world);
|
||||
this.carriedBlockEntity = ((BlockEntityProvider) (this.pushedBlock.getBlock())).createBlockEntity(pos, pushedBlock);// this.world);
|
||||
if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null
|
||||
this.carriedBlockEntity.fromTag(state, compoundTag_1.getCompound("carriedTileEntityCM"));
|
||||
this.carriedBlockEntity.fromTag(compoundTag_1.getCompound("carriedTileEntityCM"));
|
||||
setCarriedBlockEntity(carriedBlockEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user