mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 19:13:42 +01:00
Fix beacon reading
This commit is contained in:
parent
770fbd6aaa
commit
2d94838a3e
1 changed files with 20 additions and 17 deletions
|
@ -21,13 +21,11 @@ import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.tileentity.BeaconTileEntity;
|
import net.minecraft.tileentity.BeaconTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceContext;
|
|
||||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.Heightmap;
|
||||||
|
|
||||||
public class ChromaticCompoundItem extends Item {
|
public class ChromaticCompoundItem extends Item {
|
||||||
|
|
||||||
|
@ -117,20 +115,25 @@ public class ChromaticCompoundItem extends Item {
|
||||||
|
|
||||||
// Is inside beacon beam?
|
// Is inside beacon beam?
|
||||||
boolean isOverBeacon = false;
|
boolean isOverBeacon = false;
|
||||||
BlockPos.Mutable testPos = new BlockPos.Mutable(entity.getPosition());
|
int entityX = MathHelper.floor(entity.getX());
|
||||||
while (testPos.getY() > 0) {
|
int entityZ = MathHelper.floor(entity.getZ());
|
||||||
testPos.move(Direction.DOWN);
|
int localWorldHeight = world.getHeight(Heightmap.Type.WORLD_SURFACE, entityX, entityZ);
|
||||||
BlockState state = world.getBlockState(testPos);
|
if (entity.getY() > localWorldHeight) {
|
||||||
if (state.getOpacity(world, testPos) >= 15 && state.getBlock() != Blocks.BEDROCK)
|
BlockPos.Mutable testPos = new BlockPos.Mutable(entityX, localWorldHeight, entityZ);
|
||||||
break;
|
while (testPos.getY() > 0) {
|
||||||
if (state.getBlock() == Blocks.BEACON) {
|
testPos.move(Direction.DOWN);
|
||||||
TileEntity te = world.getTileEntity(testPos);
|
BlockState state = world.getBlockState(testPos);
|
||||||
if (!(te instanceof BeaconTileEntity))
|
if (state.getOpacity(world, testPos) >= 15 && state.getBlock() != Blocks.BEDROCK)
|
||||||
break;
|
break;
|
||||||
BeaconTileEntity bte = (BeaconTileEntity) te;
|
if (state.getBlock() == Blocks.BEACON) {
|
||||||
if (bte.getLevels() != 0)
|
TileEntity te = world.getTileEntity(testPos);
|
||||||
isOverBeacon = true;
|
if (!(te instanceof BeaconTileEntity))
|
||||||
break;
|
break;
|
||||||
|
BeaconTileEntity bte = (BeaconTileEntity) te;
|
||||||
|
if (bte.getLevels() != 0)
|
||||||
|
isOverBeacon = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue