1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-09-02 02:27:56 +00:00

fix: MixinWorld more correct height check

I think this Mixin need to be revisiting
This commit is contained in:
Nikita Savyolov
2021-10-17 21:08:48 +03:00
parent 43ef36fa15
commit 960d79803d

View File

@@ -7,6 +7,7 @@ package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.common.TileGeneric; import dan200.computercraft.shared.common.TileGeneric;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -26,12 +27,18 @@ import java.util.Collection;
public class MixinWorld public class MixinWorld
{ {
@Shadow @Shadow
protected boolean iteratingTickingBlockEntities; private boolean iteratingTickingBlockEntities;
@Shadow
public boolean isInBuildLimit( BlockPos pos )
{
return false;
}
@Inject( method = "addBlockEntity", at = @At( "HEAD" ) ) @Inject( method = "addBlockEntity", at = @At( "HEAD" ) )
public void addBlockEntity( @Nullable BlockEntity entity, CallbackInfo info ) public void addBlockEntity( @Nullable BlockEntity entity, CallbackInfo info )
{ {
if( entity != null && !entity.isRemoved() && entity.getWorld() != null && entity.getWorld().isInBuildLimit( entity.getPos() ) && iteratingTickingBlockEntities ) if( entity != null && !entity.isRemoved() && this.isInBuildLimit( entity.getPos() ) && iteratingTickingBlockEntities )
{ {
setWorld( entity, this ); setWorld( entity, this );
} }
@@ -41,7 +48,7 @@ public class MixinWorld
{ {
if( entity.getWorld() != world && entity instanceof TileGeneric ) if( entity.getWorld() != world && entity instanceof TileGeneric )
{ {
entity.setWorld( (World) world ); //TODO why? entity.setWorld( (World) world );
} }
} }