use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class GuiAmadronAddTrade method actionPerformed.
@Override
public void actionPerformed(IGuiWidget widget) {
if (widget.getID() == 6 || widget.getID() == 7) {
gpsSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClientPlayerEntity());
isSettingInput = widget.getID() == 6;
ItemStack gps = new ItemStack(Itemss.GPSTool);
ChunkPosition pos;
if (widget.getID() == 6) {
pos = getInputPosition();
} else {
pos = getOutputPosition();
}
if (pos != null)
ItemGPSTool.setGPSLocation(gps, pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
gpsSearchGui.setSearchStack(ItemGPSTool.getGPSLocation(gps) != null ? gps : null);
FMLClientHandler.instance().showGuiScreen(gpsSearchGui);
}
super.actionPerformed(widget);
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class AreaShowManager method showArea.
public AreaShowHandler showArea(Set<ChunkPosition> area, int color, TileEntity areaShower) {
if (areaShower == null)
return null;
removeHandlers(areaShower);
AreaShowHandler handler = new AreaShowHandler(area, color);
showHandlers.put(new ChunkPosition(areaShower.xCoord, areaShower.yCoord, areaShower.zCoord), handler);
return handler;
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class AreaShowManager method renderWorldLastEvent.
@SubscribeEvent
public void renderWorldLastEvent(RenderWorldLastEvent event) {
Minecraft mc = FMLClientHandler.instance().getClient();
EntityPlayer player = mc.thePlayer;
double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.partialTicks;
double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.partialTicks;
double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.partialTicks;
GL11.glPushMatrix();
GL11.glTranslated(-playerX, -playerY, -playerZ);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GL11.glDisable(GL11.GL_DEPTH_TEST);
for (AreaShowHandler handler : showHandlers.values()) {
handler.render();
}
ItemStack curItem = player.getCurrentEquippedItem();
if (curItem != null && curItem.getItem() == Itemss.GPSTool) {
ChunkPosition gpsLocation = ItemGPSTool.getGPSLocation(curItem);
if (gpsLocation != null) {
Set<ChunkPosition> set = new HashSet<ChunkPosition>();
set.add(gpsLocation);
GL11.glDisable(GL11.GL_DEPTH_TEST);
new AreaShowHandler(set, 0xFFFF00).render();
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
}
ItemStack helmet = player.getCurrentArmor(3);
if (helmet != null && helmet.getItem() == Itemss.pneumaticHelmet) {
if (droneDebugger == null)
droneDebugger = HUDHandler.instance().getSpecificRenderer(DroneDebugUpgradeHandler.class);
Set<ChunkPosition> set = droneDebugger.getShowingPositions();
GL11.glDisable(GL11.GL_DEPTH_TEST);
new AreaShowHandler(set, 0xFF0000).render();
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
// GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class AreaShowHandler method compileRenderList.
private void compileRenderList() {
renderList = GL11.glGenLists(1);
GL11.glNewList(renderList, GL11.GL_COMPILE);
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
t.setColorRGBA_I(color, 150);
for (ChunkPosition pos : showingPositions) {
t.addTranslation(pos.chunkPosX + 0.25F, pos.chunkPosY + 0.25F, pos.chunkPosZ + 0.25F);
t.addVertex(0, 0, 0);
t.addVertex(0, 0.5, 0);
t.addVertex(0.5, 0.5, 0);
t.addVertex(0.5, 0, 0);
t.addVertex(0.5, 0, 0.5);
t.addVertex(0.5, 0.5, 0.5);
t.addVertex(0, 0.5, 0.5);
t.addVertex(0, 0, 0.5);
t.addVertex(0, 0, 0);
t.addVertex(0, 0, 0.5);
t.addVertex(0, 0.5, 0.5);
t.addVertex(0, 0.5, 0);
t.addVertex(0.5, 0.5, 0);
t.addVertex(0.5, 0.5, 0.5);
t.addVertex(0.5, 0, 0.5);
t.addVertex(0.5, 0, 0);
t.addVertex(0, 0, 0);
t.addVertex(0.5, 0, 0);
t.addVertex(0.5, 0, 0.5);
t.addVertex(0, 0, 0.5);
t.addVertex(0, 0.5, 0.5);
t.addVertex(0.5, 0.5, 0.5);
t.addVertex(0.5, 0.5, 0);
t.addVertex(0, 0.5, 0);
t.addTranslation(-pos.chunkPosX - 0.25F, -pos.chunkPosY - 0.25F, -pos.chunkPosZ - 0.25F);
}
t.draw();
t.startDrawing(GL11.GL_LINES);
t.setColorRGBA_I(0, 150);
for (ChunkPosition pos : showingPositions) {
t.addTranslation(pos.chunkPosX + 0.25F, pos.chunkPosY + 0.25F, pos.chunkPosZ + 0.25F);
t.addVertex(0, 0, 0);
t.addVertex(0, 0.5, 0);
t.addVertex(0.5, 0.5, 0);
t.addVertex(0.5, 0, 0);
t.addVertex(0.5, 0, 0.5);
t.addVertex(0.5, 0.5, 0.5);
t.addVertex(0, 0.5, 0.5);
t.addVertex(0, 0, 0.5);
t.addVertex(0, 0, 0);
t.addVertex(0, 0, 0.5);
t.addVertex(0, 0.5, 0.5);
t.addVertex(0, 0.5, 0);
t.addVertex(0.5, 0.5, 0);
t.addVertex(0.5, 0.5, 0.5);
t.addVertex(0.5, 0, 0.5);
t.addVertex(0.5, 0, 0);
t.addVertex(0, 0, 0);
t.addVertex(0.5, 0, 0);
t.addVertex(0.5, 0, 0.5);
t.addVertex(0, 0, 0.5);
t.addVertex(0, 0.5, 0.5);
t.addVertex(0.5, 0.5, 0.5);
t.addVertex(0.5, 0.5, 0);
t.addVertex(0, 0.5, 0);
t.addTranslation(-pos.chunkPosX - 0.25F, -pos.chunkPosY - 0.25F, -pos.chunkPosZ - 0.25F);
}
t.draw();
GL11.glEndList();
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class GuiGPSTool method onGuiClosed.
@Override
public void onGuiClosed() {
ChunkPosition newPos = new ChunkPosition(textFields[0].getValue(), textFields[1].getValue(), textFields[2].getValue());
NetworkHandler.sendToServer(new PacketChangeGPSToolCoordinate(newPos.chunkPosX, newPos.equals(oldGPSLoc) ? -1 : newPos.chunkPosY, newPos.chunkPosZ, variableField.getText()));
}
Aggregations