@Override public void updateEntity() { oldDishRotation = dishRotation; if (isSensorActive) { dishSpeed = Math.min(dishSpeed + 0.2F, 10); } else { dishSpeed = Math.max(dishSpeed - 0.2F, 0); } dishRotation += dishSpeed; if (worldObj.isRemote) { int sensorRange = getRange(); if (oldSensorRange != sensorRange || oldSensorRange == 0) { oldSensorRange = sensorRange; if (!firstRun) rangeLineRenderer.resetRendering(sensorRange); } rangeLineRenderer.update(); } super.updateEntity(); if (!worldObj.isRemote) { ticksExisted++; ISensorSetting sensor = SensorHandler.instance().getSensorFromPath(sensorSetting); if (sensor != null && getPressure(ForgeDirection.UNKNOWN) > PneumaticValues.MIN_PRESSURE_UNIVERSAL_SENSOR) { isSensorActive = true; addAir(-PneumaticValues.USAGE_UNIVERSAL_SENSOR, ForgeDirection.UNKNOWN); if (sensor instanceof IPollSensorSetting) { if (ticksExisted % ((IPollSensorSetting) sensor).getPollFrequency() == 0) { int newRedstoneStrength = ((IPollSensorSetting) sensor) .getRedstoneValue(worldObj, xCoord, yCoord, zCoord, getRange(), sensorGuiText); if (invertedRedstone) newRedstoneStrength = 15 - newRedstoneStrength; if (newRedstoneStrength != redstoneStrength) { redstoneStrength = newRedstoneStrength; if (requestPollPullEvent) { notifyComputers(redstoneStrength); } updateNeighbours(); } } eventTimer = 0; } else { if (eventTimer > 0) { eventTimer--; if (eventTimer == 0 && redstoneStrength != (invertedRedstone ? 15 : 0)) { redstoneStrength = invertedRedstone ? 15 : 0; updateNeighbours(); } } } } else { isSensorActive = false; if (redstoneStrength != (invertedRedstone ? 15 : 0)) { redstoneStrength = invertedRedstone ? 15 : 0; updateNeighbours(); } } } }
/** * Will initiate the wireframe rendering. When invoked on the server, it sends a packet to every * client to render the box. */ @Override public void showRangeLines() { if (worldObj.isRemote) { rangeLineRenderer.resetRendering(getRange()); } else { NetworkHandler.sendToAllAround( new PacketRenderRangeLines(this), worldObj, TileEntityConstants.PACKET_UPDATE_DISTANCE + getRange()); } }
@Override @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { if (!rangeLineRenderer.isCurrentlyRendering()) return super.getRenderBoundingBox(); int range = getRange(); return AxisAlignedBB.getBoundingBox( xCoord - range, yCoord - range, zCoord - range, xCoord + 1 + range, yCoord + 1 + range, zCoord + 1 + range); }
@SideOnly(Side.CLIENT) public void renderRangeLines() { rangeLineRenderer.render(); }