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();
}
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;
}
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();
}
Aggregations