Search in sources :

Example 1 with ChunkPosition

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);
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ChunkPosition

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;
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition)

Example 3 with ChunkPosition

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();
}
Also used : ChunkPosition(net.minecraft.world.ChunkPosition) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) HashSet(java.util.HashSet) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 4 with ChunkPosition

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();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) ChunkPosition(net.minecraft.world.ChunkPosition)

Example 5 with ChunkPosition

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()));
}
Also used : PacketChangeGPSToolCoordinate(pneumaticCraft.common.network.PacketChangeGPSToolCoordinate) ChunkPosition(net.minecraft.world.ChunkPosition)

Aggregations

ChunkPosition (net.minecraft.world.ChunkPosition)94 ItemStack (net.minecraft.item.ItemStack)16 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 NBTTagList (net.minecraft.nbt.NBTTagList)10 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)9 TileEntity (net.minecraft.tileentity.TileEntity)9 ArrayList (java.util.ArrayList)8 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)8 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 Map (java.util.Map)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 Chunk (net.minecraft.world.chunk.Chunk)4 FluidStack (net.minecraftforge.fluids.FluidStack)4 Stack (java.util.Stack)3 Block (net.minecraft.block.Block)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 IInventory (net.minecraft.inventory.IInventory)3 PathPoint (net.minecraft.pathfinding.PathPoint)3 Vec3 (net.minecraft.util.Vec3)3