use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class PacketGetScreenDataHelper method setScreenData.
public static void setScreenData(PacketReturnScreenData message) {
Coordinate c = new Coordinate(message.x, message.y, message.z);
ScreenTileEntity.screenData.put(c, message.screenData);
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class ShieldTEBase method composeShield.
public void composeShield(boolean ctrl) {
shieldBlocks.clear();
Collection<Coordinate> coordinates;
if (isShapedShield()) {
// Special shaped mode.
ShapeCardItem.Shape shape = ShapeCardItem.getShape(stacks[ShieldContainer.SLOT_SHAPE]);
Coordinate dimension = ShapeCardItem.getClampedDimension(stacks[ShieldContainer.SLOT_SHAPE], ShieldConfiguration.maxShieldDimension);
Coordinate offset = ShapeCardItem.getClampedOffset(stacks[ShieldContainer.SLOT_SHAPE], ShieldConfiguration.maxShieldOffset);
coordinates = new ArrayList<Coordinate>();
ShapeCardItem.composeShape(shape, worldObj, getCoordinate(), dimension, offset, coordinates, supportedBlocks, false, null);
} else {
templateMeta = findTemplateMeta();
coordinates = new HashSet<Coordinate>();
findTemplateBlocks((Set<Coordinate>) coordinates, templateMeta, ctrl, getCoordinate());
}
for (Coordinate c : coordinates) {
shieldBlocks.add(new RelCoordinate(c.getX() - xCoord, c.getY() - yCoord, c.getZ() - zCoord));
}
shieldComposed = true;
updateShield();
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class AbstractShieldBlock method checkPlayerCD.
private boolean checkPlayerCD(World world, int x, int y, int z, EntityPlayer entity) {
ShieldBlockTileEntity shieldBlockTileEntity = (ShieldBlockTileEntity) world.getTileEntity(x, y, z);
Coordinate shieldBlock = shieldBlockTileEntity.getShieldBlock();
if (shieldBlock != null) {
ShieldTEBase shieldTileEntity = (ShieldTEBase) world.getTileEntity(shieldBlock.getX(), shieldBlock.getY(), shieldBlock.getZ());
if (shieldTileEntity != null) {
List<ShieldFilter> filters = shieldTileEntity.getFilters();
for (ShieldFilter filter : filters) {
if (DefaultFilter.DEFAULT.equals(filter.getFilterName())) {
return (filter.getAction() & ShieldFilter.ACTION_SOLID) != 0;
} else if (PlayerFilter.PLAYER.equals(filter.getFilterName())) {
PlayerFilter playerFilter = (PlayerFilter) filter;
String name = playerFilter.getName();
if ((name == null || name.isEmpty())) {
return (filter.getAction() & ShieldFilter.ACTION_SOLID) != 0;
} else if (name.equals(entity.getDisplayName())) {
return (filter.getAction() & ShieldFilter.ACTION_SOLID) != 0;
}
}
}
}
}
return false;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class ShieldBlock method wrenchSneakSelect.
@Override
protected boolean wrenchSneakSelect(World world, int x, int y, int z, EntityPlayer player) {
if (!world.isRemote) {
GlobalCoordinate currentBlock = SmartWrenchItem.getCurrentBlock(player.getHeldItem());
if (currentBlock == null) {
SmartWrenchItem.setCurrentBlock(player.getHeldItem(), new GlobalCoordinate(new Coordinate(x, y, z), world.provider.dimensionId));
Logging.message(player, EnumChatFormatting.YELLOW + "Selected block");
} else {
SmartWrenchItem.setCurrentBlock(player.getHeldItem(), null);
Logging.message(player, EnumChatFormatting.YELLOW + "Cleared selected block");
}
}
return true;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class CounterClientScreenModule method setupCoordinateFromNBT.
protected void setupCoordinateFromNBT(NBTTagCompound tagCompound, int dim, int x, int y, int z) {
coordinate = Coordinate.INVALID;
if (tagCompound.hasKey("monitorx")) {
this.dim = tagCompound.getInteger("dim");
if (dim == this.dim) {
Coordinate c = new Coordinate(tagCompound.getInteger("monitorx"), tagCompound.getInteger("monitory"), tagCompound.getInteger("monitorz"));
int dx = Math.abs(c.getX() - x);
int dy = Math.abs(c.getY() - y);
int dz = Math.abs(c.getZ() - z);
if (dx <= 64 && dy <= 64 && dz <= 64) {
coordinate = c;
}
}
}
}
Aggregations