use of net.minecraft.world.ChunkPosition 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();
}
use of net.minecraft.world.ChunkPosition 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 net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class DroneEntityAIGoToLocation method shouldExecute.
/**
* Returns whether the EntityAIBase should begin execution.
*/
@Override
public boolean shouldExecute() {
Collections.sort(validArea, positionSorter);
for (ChunkPosition c : validArea) {
if (drone.getPosition().squareDistanceTo(c.chunkPosX + 0.5, c.chunkPosY + 0.5, c.chunkPosZ + 0.5) < 0.50)
return false;
if (drone.getPathNavigator().moveToXYZ(c.chunkPosX, c.chunkPosY, c.chunkPosZ)) {
return !((IGotoWidget) gotoWidget).doneWhenDeparting();
}
}
boolean teleport = drone.getPathNavigator().isGoingToTeleport();
if (teleport) {
return true;
} else {
for (ChunkPosition c : validArea) {
drone.addDebugEntry("gui.progWidget.goto.debug.cantNavigate", c);
}
return false;
}
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class EntityDrone method getDugBlock.
@Override
protected ChunkPosition getDugBlock() {
int x = dataWatcher.getWatchableObjectInt(18);
int y = dataWatcher.getWatchableObjectInt(19);
int z = dataWatcher.getWatchableObjectInt(20);
return x != 0 || y != 0 || z != 0 ? new ChunkPosition(x, y, z) : null;
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class EntityDroneBase method renderExtras.
public void renderExtras(double x, double y, double z, float partialTicks) {
ChunkPosition diggingPos = getDugBlock();
if (diggingPos != null) {
if (digLaser == null) {
int color = 0xFF0000;
digLaser = new RenderLaser(color);
}
digLaser.render(partialTicks, 0, getLaserOffsetY(), 0, diggingPos.chunkPosX + 0.5 - posX, diggingPos.chunkPosY + 0.45 - posY, diggingPos.chunkPosZ + 0.5 - posZ);
}
}
Aggregations