fixed broken movable TEs under Java 16
This commit is contained in:
1 parent
83109eda9a
commit
c55019d048
3 files changed
+22
-5
No files matched your search
@@ -0,0 +1,8 @@
|
|||||||
|
package carpet.fakes;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
public interface BlockEntityInterface
|
||||||
|
{
|
||||||
|
void setCMPos(BlockPos pos);
|
||||||
|
}
|
||||||
@@ -1,13 +1,21 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.BlockEntityInterface;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@Mixin(BlockEntity.class)
|
@Mixin(BlockEntity.class)
|
||||||
public interface BlockEntity_movableBEMixin
|
public abstract class BlockEntity_movableBEMixin implements BlockEntityInterface
|
||||||
{
|
{
|
||||||
@Accessor
|
@Mutable
|
||||||
void setPos(BlockPos pos);
|
@Shadow @Final protected BlockPos pos;
|
||||||
|
|
||||||
|
public void setCMPos(BlockPos newPos)
|
||||||
|
{
|
||||||
|
pos = newPos;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
|
import carpet.fakes.BlockEntityInterface;
|
||||||
import carpet.fakes.PistonBlockEntityInterface;
|
import carpet.fakes.PistonBlockEntityInterface;
|
||||||
import carpet.fakes.WorldInterface;
|
import carpet.fakes.WorldInterface;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -57,7 +58,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
|
|||||||
this.carriedBlockEntity = blockEntity;
|
this.carriedBlockEntity = blockEntity;
|
||||||
if (this.carriedBlockEntity != null)
|
if (this.carriedBlockEntity != null)
|
||||||
{
|
{
|
||||||
((BlockEntity_movableBEMixin)carriedBlockEntity).setPos(pos);
|
((BlockEntityInterface)carriedBlockEntity).setCMPos(pos);
|
||||||
// this might be little dangerous since pos is final for a hashing reason?
|
// this might be little dangerous since pos is final for a hashing reason?
|
||||||
if (world != null) carriedBlockEntity.setWorld(world);
|
if (world != null) carriedBlockEntity.setWorld(world);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user