Java Code Examples for net.minecraft.world.ChunkPosition#equals()
The following examples show how to use
net.minecraft.world.ChunkPosition#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiProgrammer.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private String getOffsetVariable(Map<ChunkPosition, String> offsetToVariableNames, String baseVariable, ChunkPosition offset){ if(offset.equals(new ChunkPosition(0, 0, 0))) return baseVariable; String var = offsetToVariableNames.get(offset); if(var == null) { var = "var" + (offsetToVariableNames.size() + 1); offsetToVariableNames.put(offset, var); } return var; }
Example 2
Source File: ContainerRemote.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void detectAndSendChanges(){ super.detectAndSendChanges(); for(int i = 0; i < lastValues.length; i++) { ChunkPosition newValue = GlobalVariableManager.getInstance().getPos(syncedVars.get(i)); if(!newValue.equals(lastValues[i])) { lastValues[i] = newValue; for(Object o : crafters) { if(o instanceof EntityPlayerMP) NetworkHandler.sendTo(new PacketSetGlobalVariable(syncedVars.get(i), newValue), (EntityPlayerMP)o); } } } }
Example 3
Source File: ProgWidgetAreaItemBase.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private boolean updateVariables(){ boolean varChanged = false; for(Map.Entry<String, ChunkPosition> entry : areaVariableStates.entrySet()) { ChunkPosition newValue = aiManager.getCoordinate(entry.getKey()); if(!newValue.equals(entry.getValue())) { varChanged = true; entry.setValue(newValue); } } return varChanged; }
Example 4
Source File: TileEntityPneumaticDoorBase.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private boolean shouldOpen(){ switch(redstoneMode){ case 0: case 1: int range = TileEntityConstants.RANGE_PNEUMATIC_DOOR_BASE + this.getUpgrades(ItemMachineUpgrade.UPGRADE_RANGE); AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xCoord - range, yCoord - range, zCoord - range, xCoord + range + 1, yCoord + range + 1, zCoord + range + 1); List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb); for(EntityPlayer player : players) { if(PneumaticCraftUtils.getProtectingSecurityStations(worldObj, xCoord, yCoord, zCoord, player, false, false) == 0) { if(redstoneMode == 0) { return true; } else { ((BlockPneumaticDoor)Blockss.pneumaticDoor).isTrackingPlayerEye = true; ChunkPosition lookedPosition = PneumaticCraftUtils.getEntityLookedBlock(player, range * 1.41F); //max range = range * sqrt(2). ((BlockPneumaticDoor)Blockss.pneumaticDoor).isTrackingPlayerEye = false; if(lookedPosition != null) { if(lookedPosition.equals(new ChunkPosition(xCoord, yCoord, zCoord))) { return true; } else { if(door != null) { if(lookedPosition.equals(new ChunkPosition(door.xCoord, door.yCoord, door.zCoord))) return true; if(lookedPosition.equals(new ChunkPosition(door.xCoord, door.yCoord + (door.getBlockMetadata() < 6 ? 1 : -1), door.zCoord))) return true; } } } } } } return false; case 2: return opening; } return false; }
Example 5
Source File: TileEntityKeroseneLamp.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
private boolean passesRaytraceTest(ChunkPosition pos, ChunkPosition lampPos){ MovingObjectPosition mop = worldObj.rayTraceBlocks(Vec3.createVectorHelper(pos.chunkPosX + 0.5, pos.chunkPosY + 0.5, pos.chunkPosZ + 0.5), Vec3.createVectorHelper(lampPos.chunkPosX + 0.5, lampPos.chunkPosY + 0.5, lampPos.chunkPosZ + 0.5)); return mop != null && lampPos.equals(new ChunkPosition(mop.blockX, mop.blockY, mop.blockZ)); }