Search in sources :

Example 1 with ISemiBlock

use of pneumaticCraft.common.semiblock.ISemiBlock in project PneumaticCraft by MineMaarten.

the class ClientSemiBlockManager 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.glEnable(GL11.GL_BLEND);
    // GL11.glEnable(GL11.GL_LIGHTING);
    RenderHelper.enableStandardItemLighting();
    for (Map<ChunkPosition, ISemiBlock> map : SemiBlockManager.getInstance(player.worldObj).getSemiBlocks().values()) {
        for (ISemiBlock semiBlock : map.values()) {
            ISemiBlockRenderer renderer = getRenderer(semiBlock);
            if (renderer != null) {
                GL11.glPushMatrix();
                GL11.glTranslated(semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
                renderer.render(semiBlock, event.partialTicks);
                GL11.glPopMatrix();
            }
        }
    }
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}
Also used : ISemiBlock(pneumaticCraft.common.semiblock.ISemiBlock) ChunkPosition(net.minecraft.world.ChunkPosition) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 2 with ISemiBlock

use of pneumaticCraft.common.semiblock.ISemiBlock in project PneumaticCraft by MineMaarten.

the class WailaSemiBlockHandler method getWailaBody.

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    int x = accessor.getPosition().blockX;
    int y = accessor.getPosition().blockY;
    int z = accessor.getPosition().blockZ;
    ISemiBlock semiBlock = SemiBlockManager.getInstance(accessor.getWorld()).getSemiBlock(accessor.getWorld(), x, y, z);
    if (semiBlock instanceof SemiBlockBasic) {
        ((SemiBlockBasic) semiBlock).addWailaTooltip(currenttip, accessor.getNBTData());
    }
    return currenttip;
}
Also used : SemiBlockBasic(pneumaticCraft.common.semiblock.SemiBlockBasic) ISemiBlock(pneumaticCraft.common.semiblock.ISemiBlock)

Example 3 with ISemiBlock

use of pneumaticCraft.common.semiblock.ISemiBlock in project PneumaticCraft by MineMaarten.

the class DroneAILogistics method shouldExecute.

@Override
public boolean shouldExecute() {
    manager.clearLogistics();
    Set<ChunkPosition> area = widget.getCachedAreaSet();
    if (area.size() == 0)
        return false;
    int minX = Integer.MAX_VALUE, maxX = Integer.MIN_VALUE, minZ = Integer.MAX_VALUE, maxZ = Integer.MIN_VALUE;
    for (ChunkPosition pos : area) {
        minX = Math.min(minX, pos.chunkPosX);
        maxX = Math.max(maxX, pos.chunkPosX);
        minZ = Math.min(minZ, pos.chunkPosZ);
        maxZ = Math.max(maxZ, pos.chunkPosZ);
    }
    for (int x = minX; x < maxX + 16; x += 16) {
        for (int z = minZ; z < maxZ + 16; z += 16) {
            Chunk chunk = drone.getWorld().getChunkFromBlockCoords(x, z);
            Map<ChunkPosition, ISemiBlock> map = SemiBlockManager.getInstance(drone.getWorld()).getSemiBlocks().get(chunk);
            if (map != null) {
                for (Map.Entry<ChunkPosition, ISemiBlock> entry : map.entrySet()) {
                    if (entry.getValue() instanceof SemiBlockLogistics && area.contains(entry.getKey())) {
                        SemiBlockLogistics logisticsBlock = (SemiBlockLogistics) entry.getValue();
                        manager.addLogisticFrame(logisticsBlock);
                    }
                }
            }
        }
    }
    curTask = null;
    return doLogistics();
}
Also used : SemiBlockLogistics(pneumaticCraft.common.semiblock.SemiBlockLogistics) ISemiBlock(pneumaticCraft.common.semiblock.ISemiBlock) ChunkPosition(net.minecraft.world.ChunkPosition) Chunk(net.minecraft.world.chunk.Chunk) Map(java.util.Map)

Aggregations

ISemiBlock (pneumaticCraft.common.semiblock.ISemiBlock)3 ChunkPosition (net.minecraft.world.ChunkPosition)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Map (java.util.Map)1 Minecraft (net.minecraft.client.Minecraft)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Chunk (net.minecraft.world.chunk.Chunk)1 SemiBlockBasic (pneumaticCraft.common.semiblock.SemiBlockBasic)1 SemiBlockLogistics (pneumaticCraft.common.semiblock.SemiBlockLogistics)1