use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class EnergyPlusBarClientScreenModule method setupCoordinateFromNBT.
@Override
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");
coordinate = new Coordinate(tagCompound.getInteger("monitorx"), tagCompound.getInteger("monitory"), tagCompound.getInteger("monitorz"));
}
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class FavoriteDestinationsProperties method writeFavoritesToNBT.
private static void writeFavoritesToNBT(NBTTagCompound tagCompound, Collection<GlobalCoordinate> destinations) {
NBTTagList lst = new NBTTagList();
for (GlobalCoordinate destination : destinations) {
NBTTagCompound tc = new NBTTagCompound();
Coordinate c = destination.getCoordinate();
tc.setInteger("x", c.getX());
tc.setInteger("y", c.getY());
tc.setInteger("z", c.getZ());
tc.setInteger("dim", destination.getDimension());
lst.appendTag(tc);
}
tagCompound.setTag("destinations", lst);
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class FavoriteDestinationsProperties method readCoordinatesFromNBT.
private static void readCoordinatesFromNBT(NBTTagCompound tagCompound, Set<GlobalCoordinate> destinations) {
NBTTagList lst = tagCompound.getTagList("destinations", net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < lst.tagCount(); i++) {
NBTTagCompound tc = lst.getCompoundTagAt(i);
Coordinate c = new Coordinate(tc.getInteger("x"), tc.getInteger("y"), tc.getInteger("z"));
destinations.add(new GlobalCoordinate(c, tc.getInteger("dim")));
}
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class PeacefulAreaManager method isPeaceful.
public static boolean isPeaceful(GlobalCoordinate coordinate) {
if (areas.isEmpty()) {
return false;
}
List<GlobalCoordinate> toRemove = new ArrayList<GlobalCoordinate>();
boolean peaceful = false;
long curtime = System.currentTimeMillis() - 10000;
for (Map.Entry<GlobalCoordinate, PeacefulArea> entry : areas.entrySet()) {
PeacefulArea area = entry.getValue();
GlobalCoordinate entryCoordinate = entry.getKey();
if (area.in(coordinate, entryCoordinate)) {
peaceful = true;
}
if (area.getLastTouched() < curtime) {
// Hasn't been touched for at least 10 seconds. Probably no longer valid.
// To be sure we will first check this by testing if the environmental controller is still active and running.
WorldServer world = DimensionManager.getWorld(entryCoordinate.getDimension());
if (world != null) {
Coordinate c = entryCoordinate.getCoordinate();
// If the world is not loaded we don't do anything and we also don't remove the area since we have no information about it.
if (!world.getChunkProvider().chunkExists(c.getX() >> 4, c.getZ() >> 4)) {
boolean removeArea = true;
TileEntity te = world.getTileEntity(c.getX(), c.getY(), c.getZ());
if (te instanceof EnvironmentalControllerTileEntity) {
EnvironmentalControllerTileEntity controllerTileEntity = (EnvironmentalControllerTileEntity) te;
for (EnvironmentModule module : controllerTileEntity.getEnvironmentModules()) {
if (module instanceof PeacefulEModule) {
if (((PeacefulEModule) module).isActive()) {
removeArea = false;
break;
}
}
}
}
if (removeArea) {
toRemove.add(entryCoordinate);
}
}
}
}
}
for (GlobalCoordinate globalCoordinate : toRemove) {
areas.remove(globalCoordinate);
}
return peaceful;
}
use of mcjty.lib.varia.Coordinate in project RFTools by McJty.
the class EndergenicRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
ResourceLocation txt;
Coordinate coord = new Coordinate(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
if (coord.equals(RFTools.instance.clientInfo.getSelectedTE())) {
txt = redglow;
} else if (coord.equals(RFTools.instance.clientInfo.getDestinationTE())) {
txt = blueglow;
} else {
return;
}
this.bindTexture(txt);
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
tessellator.startDrawingQuads();
tessellator.setColorRGBA(255, 255, 255, 128);
tessellator.setBrightness(240);
boolean blending = GL11.glIsEnabled(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
DefaultISBRH.addSideFullTexture(tessellator, ForgeDirection.UP.ordinal(), 1.1f, -0.05f);
DefaultISBRH.addSideFullTexture(tessellator, ForgeDirection.DOWN.ordinal(), 1.1f, -0.05f);
DefaultISBRH.addSideFullTexture(tessellator, ForgeDirection.NORTH.ordinal(), 1.1f, -0.05f);
DefaultISBRH.addSideFullTexture(tessellator, ForgeDirection.SOUTH.ordinal(), 1.1f, -0.05f);
DefaultISBRH.addSideFullTexture(tessellator, ForgeDirection.WEST.ordinal(), 1.1f, -0.05f);
DefaultISBRH.addSideFullTexture(tessellator, ForgeDirection.EAST.ordinal(), 1.1f, -0.05f);
tessellator.draw();
GL11.glPopMatrix();
if (!blending) {
GL11.glDisable(GL11.GL_BLEND);
}
}
Aggregations