Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TileEntityRadar extends TileEntity {
- protected World worldObj;
- public World radar;
- public AxisAlignedBB boundingBox;
- private int radarRangeHorizontal;
- private int radarRangeVertical;
- boolean hasHostiles;
- boolean shouldPrint;
- int x;
- int y;
- int z;
- int range;
- int count;
- int mode;
- int ticksHere;
- public final RadarDetectionLogic Radar = new RadarDetectionLogic() {
- public World getRadarWorld()
- {
- return TileEntityRadar.this.worldObj;
- }
- public int getRadarX()
- {
- return TileEntityRadar.this.xCoord;
- }
- public int getRadarY()
- {
- return TileEntityRadar.this.yCoord;
- }
- public int getRadarZ()
- {
- return TileEntityRadar.this.zCoord;
- }
- public int getRadarRange() {
- // TODO Auto-generated method stub
- return TileEntityRadar.this.range;
- }
- };
- public TileEntityRadar(int range) {
- super();
- this.range = range;
- x = this.xCoord;
- y = this.yCoord;
- z = this.zCoord;
- this.mode = 1;
- this.markDirty();
- // TODO Auto-generated constructor stub
- }
- // Get values
- public boolean getDanger(int range) {
- boolean flag = Radar.getDanger();
- return flag;
- }
- public int getEntityCount(int range) {
- int count = Radar.getEntityCount();
- return count;
- }
- public void updateEntity() {
- Radar.updateRadar(range);
- Minecraft.getMinecraft().thePlayer.sendChatMessage("We have updated the Radar. This is tick " + ticksHere + " of such event.");
- ticksHere++;
- boolean dangerous = this.getDanger(range);
- count = this.getEntityCount(range);
- if (dangerous) {
- hasHostiles = true;
- Minecraft.getMinecraft().thePlayer.sendChatMessage("The Radar " + x + ", " + y + ", " + z + " of range " + range + "has detected a total of " + count + " registered hostile entities in range.");
- if (shouldPrint) {
- shouldPrint = false;
- }
- } else {
- hasHostiles = false;
- Minecraft.getMinecraft().thePlayer.sendChatMessage("No hostilities in range.");
- }
- if (hasHostiles) {
- this.getBlockType().setLightLevel(15);
- } else {
- this.getBlockType().setLightLevel(0);
- }
- }
- public void printInfo() {
- int i, j, k;
- if (mode == 1) {
- i = this.Radar.getRadarX();
- j = this.Radar.getRadarY();
- k = this.Radar.getRadarZ();
- } else {
- i = x;
- j = y;
- k = z;
- }
- Minecraft.getMinecraft().thePlayer.sendChatMessage("A new instance of DetectionLogic has been created. It's range is " +range+ ".");
- // TODO Auto-generated method stub
- Minecraft.getMinecraft().thePlayer.sendChatMessage("The Radar " + i + ", " + j + ", " + k + " of range " + range + " has detected a total of " + count + " registered hostile entities in range.");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement