aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/tileentities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/tileentities')
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java2
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java22
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java22
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java88
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java113
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java89
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java89
7 files changed, 212 insertions, 213 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index 535fc0c957..46f2416ee1 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -1,11 +1,11 @@
package gtPlusPlus.core.tileentities;
+import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.tileentities.general.TileEntityFirepit;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.core.util.Utils;
-import cpw.mods.fml.common.registry.GameRegistry;
public class ModTileEntities {
diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java b/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java
index 67c592c79c..839bcc353a 100644
--- a/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java
+++ b/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java
@@ -9,31 +9,31 @@ import net.minecraft.tileentity.TileEntity;
public class TILE_ENTITY_BASE extends TileEntity {
@Override
- public void writeToNBT(NBTTagCompound tag) {
+ public void writeToNBT(final NBTTagCompound tag) {
super.writeToNBT(tag);
- writeCustomNBT(tag);
+ this.writeCustomNBT(tag);
}
@Override
- public void readFromNBT(NBTTagCompound tag) {
+ public void readFromNBT(final NBTTagCompound tag) {
super.readFromNBT(tag);
- readCustomNBT(tag);
+ this.readCustomNBT(tag);
}
- public void writeCustomNBT(NBTTagCompound tag) {}
- public void readCustomNBT(NBTTagCompound tag) {}
+ public void writeCustomNBT(final NBTTagCompound tag) {}
+ public void readCustomNBT(final NBTTagCompound tag) {}
@Override
public Packet getDescriptionPacket() {
- NBTTagCompound tag = new NBTTagCompound();
- writeCustomNBT(tag);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag);
+ final NBTTagCompound tag = new NBTTagCompound();
+ this.writeCustomNBT(tag);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag);
}
@Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity packet) {
super.onDataPacket(net, packet);
- readCustomNBT(packet.func_148857_g());
+ this.readCustomNBT(packet.func_148857_g());
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java
index 0f2cd3390e..49fde8ee64 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java
@@ -6,34 +6,34 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityFirepit extends TileEntity{
-
+
private UUID ownerUUID;
public UUID getOwnerUUID() {
- return ownerUUID;
+ return this.ownerUUID;
}
- public void setOwnerUUID(UUID ownerUUID) {
+ public void setOwnerUUID(final UUID ownerUUID) {
this.ownerUUID = ownerUUID;
- markDirty();
+ this.markDirty();
}
@Override
- public void writeToNBT(NBTTagCompound tagCompound) {
+ public void writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
- UUID ownerUUID = getOwnerUUID();
+ final UUID ownerUUID = this.getOwnerUUID();
if (ownerUUID != null){
- tagCompound.setLong("OwnerUUIDMost", ownerUUID.getMostSignificantBits());
- tagCompound.setLong("OwnerUUIDLeast", ownerUUID.getLeastSignificantBits());
+ tagCompound.setLong("OwnerUUIDMost", ownerUUID.getMostSignificantBits());
+ tagCompound.setLong("OwnerUUIDLeast", ownerUUID.getLeastSignificantBits());
}
}
@Override
- public void readFromNBT(NBTTagCompound tagCompound) {
+ public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
- setOwnerUUID(new UUID(tagCompound.getLong("OwnerUUIDMost"), tagCompound.getLong("OwnerUUIDLeast")));
+ this.setOwnerUUID(new UUID(tagCompound.getLong("OwnerUUIDMost"), tagCompound.getLong("OwnerUUIDLeast")));
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
index 5d07020bf3..e003de4392 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
@@ -1,7 +1,7 @@
package gtPlusPlus.core.tileentities.general;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.inventories.*;
+import gtPlusPlus.core.inventories.InventoryFishTrap;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
@@ -16,7 +16,7 @@ public class TileEntityFishTrap extends TileEntity{
private int tickCount = 0;
private boolean isInWater = false;
- private InventoryFishTrap inventoryContents;
+ private final InventoryFishTrap inventoryContents;
private int locationX;
private int locationY;
private int locationZ;
@@ -25,38 +25,38 @@ public class TileEntityFishTrap extends TileEntity{
public TileEntityFishTrap(){
this.inventoryContents = new InventoryFishTrap();//number of slots - without product slot
- setTileLocation();
+ this.setTileLocation();
}
public boolean setTileLocation(){
if (this.hasWorldObj()){
if (!this.getWorldObj().isRemote){
- locationX = this.xCoord;
- locationY = this.yCoord;
- locationZ = this.zCoord;
+ this.locationX = this.xCoord;
+ this.locationY = this.yCoord;
+ this.locationZ = this.zCoord;
return true;
}
}
- return false;
+ return false;
}
public final boolean isSurroundedByWater(){
- setTileLocation();
- Block[] surroundingBlocks = new Block[6];
+ this.setTileLocation();
+ final Block[] surroundingBlocks = new Block[6];
if (this.hasWorldObj()){
if (!this.getWorldObj().isRemote){
- surroundingBlocks[0] = worldObj.getBlock(locationX, locationY+1, locationZ); //Above
- surroundingBlocks[1] = worldObj.getBlock(locationX, locationY-1, locationZ); //Below
- surroundingBlocks[2] = worldObj.getBlock(locationX+1, locationY, locationZ);
- surroundingBlocks[3] = worldObj.getBlock(locationX-1, locationY, locationZ);
- surroundingBlocks[4] = worldObj.getBlock(locationX, locationY, locationZ+1);
- surroundingBlocks[5] = worldObj.getBlock(locationX, locationY, locationZ-1);
+ surroundingBlocks[0] = this.worldObj.getBlock(this.locationX, this.locationY+1, this.locationZ); //Above
+ surroundingBlocks[1] = this.worldObj.getBlock(this.locationX, this.locationY-1, this.locationZ); //Below
+ surroundingBlocks[2] = this.worldObj.getBlock(this.locationX+1, this.locationY, this.locationZ);
+ surroundingBlocks[3] = this.worldObj.getBlock(this.locationX-1, this.locationY, this.locationZ);
+ surroundingBlocks[4] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ+1);
+ surroundingBlocks[5] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ-1);
int waterCount = 0;
int trapCount = 0;
- for (Block checkBlock : surroundingBlocks){
- if (checkBlock == Blocks.water || checkBlock == Blocks.flowing_water || checkBlock.getUnlocalizedName().toLowerCase().contains("water") || checkBlock == ModBlocks.blockFishTrap){
+ for (final Block checkBlock : surroundingBlocks){
+ if ((checkBlock == Blocks.water) || (checkBlock == Blocks.flowing_water) || checkBlock.getUnlocalizedName().toLowerCase().contains("water") || (checkBlock == ModBlocks.blockFishTrap)){
if (checkBlock != ModBlocks.blockFishTrap){
- waterCount++;
+ waterCount++;
}
else {
waterCount++;
@@ -64,11 +64,11 @@ public class TileEntityFishTrap extends TileEntity{
}
}
}
- if (waterCount >= 2 && trapCount <= 4){
+ if ((waterCount >= 2) && (trapCount <= 4)){
this.waterSides = waterCount;
return true;
}
- else if (waterCount >= 2 && trapCount > 4){
+ else if ((waterCount >= 2) && (trapCount > 4)){
Utils.LOG_INFO("Too many fish traps surrounding this one.");
Utils.LOG_INFO("Not adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)");
}
@@ -85,8 +85,8 @@ public class TileEntityFishTrap extends TileEntity{
public boolean tryAddLoot(){
if (this.getInventory().getInventory() != null){
int checkingSlot = 0;
- ItemStack loot = generateLootForFishTrap();
- for (ItemStack contents : this.getInventory().getInventory()){
+ final ItemStack loot = this.generateLootForFishTrap();
+ for (final ItemStack contents : this.getInventory().getInventory()){
if (contents == null){
this.getInventory().setInventorySlotContents(checkingSlot, loot);
this.markDirty();
@@ -115,10 +115,10 @@ public class TileEntityFishTrap extends TileEntity{
}
private ItemStack generateLootForFishTrap() {
- int lootWeight = MathUtils.randInt(0, 100);
+ final int lootWeight = MathUtils.randInt(0, 100);
ItemStack loot;
if (lootWeight <= 10){
- loot = ItemUtils.getSimpleStack(Items.slime_ball);
+ loot = ItemUtils.getSimpleStack(Items.slime_ball);
}
else if (lootWeight <= 20){
loot = ItemUtils.getSimpleStack(Items.bone);
@@ -144,29 +144,29 @@ public class TileEntityFishTrap extends TileEntity{
this.tickCount++;
//Utils.LOG_INFO("Ticking "+this.tickCount);
//Check if the Tile is within water once per second.
- if (this.tickCount%20==0){
- this.isInWater = isSurroundedByWater();
+ if ((this.tickCount%20)==0){
+ this.isInWater = this.isSurroundedByWater();
}
else {
}
-
+
if (this.isInWater){
- calculateTickrate();
+ this.calculateTickrate();
}
-
+
//Try add some loot once every 30 seconds.
- if (this.tickCount%this.baseTickRate==0){
+ if ((this.tickCount%this.baseTickRate)==0){
if (this.isInWater){
//Add loot
Utils.LOG_INFO("Adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)");
- tryAddLoot();
- markDirty();
- }
+ this.tryAddLoot();
+ this.markDirty();
+ }
else {
Utils.LOG_INFO("This Trap does not have enough water around it.");
Utils.LOG_INFO("Not adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)");
- markDirty();
+ this.markDirty();
}
this.tickCount = 0;
}
@@ -177,21 +177,21 @@ public class TileEntityFishTrap extends TileEntity{
}
}
-
+
public void calculateTickrate(){
int calculateTickrate = 0;
if (this.waterSides < 2){
calculateTickrate = 0;
}
- else if (this.waterSides >= 2 && this.waterSides < 4){
+ else if ((this.waterSides >= 2) && (this.waterSides < 4)){
calculateTickrate = 3000;
}
- else if (this.waterSides >= 4 && this.waterSides < 6){
+ else if ((this.waterSides >= 4) && (this.waterSides < 6)){
calculateTickrate = 2000;
}
else if (this.waterSides == 6){
calculateTickrate = 900;
- }
+ }
this.baseTickRate = calculateTickrate;
}
@@ -199,7 +199,7 @@ public class TileEntityFishTrap extends TileEntity{
return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null;
}
- public NBTTagCompound getTag(NBTTagCompound nbt, String tag){
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){
if(!nbt.hasKey(tag)){
nbt.setTag(tag, new NBTTagCompound());
}
@@ -208,19 +208,19 @@ public class TileEntityFishTrap extends TileEntity{
@Override
- public void writeToNBT(NBTTagCompound nbt){
+ public void writeToNBT(final NBTTagCompound nbt){
super.writeToNBT(nbt);
//Utils.LOG_INFO("Trying to write NBT data to TE.");
- NBTTagCompound chestData = new NBTTagCompound();
- inventoryContents.writeToNBT(chestData);
+ final NBTTagCompound chestData = new NBTTagCompound();
+ this.inventoryContents.writeToNBT(chestData);
nbt.setTag("ContentsChest", chestData);
}
@Override
- public void readFromNBT(NBTTagCompound nbt){
+ public void readFromNBT(final NBTTagCompound nbt){
super.readFromNBT(nbt);
//Utils.LOG_INFO("Trying to read NBT data from TE.");
- inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest"));
+ this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest"));
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java
index 8767b6607c..7f5c0ed8da 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java
@@ -1,9 +1,8 @@
package gtPlusPlus.core.tileentities.general;
-import gtPlusPlus.core.block.ModBlocks;
-
import java.util.Random;
+import gtPlusPlus.core.block.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
@@ -14,7 +13,7 @@ public class TileEntityReverter extends TileEntity
{
private static final int REVERT_CHANCE = 10;
public int radius = 16;
- public int diameter = 8 * this.radius + 4;
+ public int diameter = (8 * this.radius) + 4;
public double requiredPlayerRange = 64.0D;
public Random rand = new Random();
private int tickCount;
@@ -23,38 +22,40 @@ public class TileEntityReverter extends TileEntity
private Block[] blockData;
private byte[] metaData;
+ @Override
public boolean canUpdate(){
return true;
}
+ @Override
public void updateEntity()
{
- if (anyPlayerInRange())
+ if (this.anyPlayerInRange())
{
this.tickCount += 1;
if (this.worldObj.isRemote)
{
- double var1 = this.xCoord + this.worldObj.rand.nextFloat();
- double var3 = this.yCoord + this.worldObj.rand.nextFloat();
- double var5 = this.zCoord + this.worldObj.rand.nextFloat();
+ final double var1 = this.xCoord + this.worldObj.rand.nextFloat();
+ final double var3 = this.yCoord + this.worldObj.rand.nextFloat();
+ final double var5 = this.zCoord + this.worldObj.rand.nextFloat();
this.worldObj.spawnParticle("enchantmenttable", var1, var3, var5, 0.0D, 0.0D, 0.0D);
if (this.rand.nextInt(5) == 0)
{
- makeRandomOutline();
- makeRandomOutline();
- makeRandomOutline();
+ this.makeRandomOutline();
+ this.makeRandomOutline();
+ this.makeRandomOutline();
}
}
else
{
if ((this.blockData == null) || (this.metaData == null))
{
- captureBlockData();
+ this.captureBlockData();
this.slowScan = true;
}
- if ((!this.slowScan) || (this.tickCount % 20 == 0)) {
- if (scanAndRevertChanges())
+ if ((!this.slowScan) || ((this.tickCount % 20) == 0)) {
+ if (this.scanAndRevertChanges())
{
this.slowScan = false;
this.ticksSinceChange = 0;
@@ -80,10 +81,10 @@ public class TileEntityReverter extends TileEntity
private void makeRandomOutline()
{
- makeOutline(this.rand.nextInt(12));
+ this.makeOutline(this.rand.nextInt(12));
}
- private void makeOutline(int outline)
+ private void makeOutline(final int outline)
{
double sx = this.xCoord;
double sy = this.yCoord;
@@ -94,57 +95,57 @@ public class TileEntityReverter extends TileEntity
double dz = this.zCoord;
switch (outline)
{
- case 0:
+ case 0:
sx -= this.radius;
dx -= this.radius;
sz -= this.radius;
dz += this.radius + 1;
- case 8:
+ case 8:
sx -= this.radius;
dx += this.radius + 1;
sz -= this.radius;
dz -= this.radius;
break;
- case 1:
- case 9:
+ case 1:
+ case 9:
sx -= this.radius;
dx -= this.radius;
sz -= this.radius;
dz += this.radius + 1;
break;
- case 2:
- case 10:
+ case 2:
+ case 10:
sx -= this.radius;
dx += this.radius + 1;
sz += this.radius + 1;
dz += this.radius + 1;
break;
- case 3:
- case 11:
+ case 3:
+ case 11:
sx += this.radius + 1;
dx += this.radius + 1;
sz -= this.radius;
dz += this.radius + 1;
break;
- case 4:
+ case 4:
sx -= this.radius;
dx -= this.radius;
sz -= this.radius;
dz -= this.radius;
break;
- case 5:
+ case 5:
sx += this.radius + 1;
dx += this.radius + 1;
sz -= this.radius;
dz -= this.radius;
break;
- case 6:
+ case 6:
sx += this.radius + 1;
dx += this.radius + 1;
sz += this.radius + 1;
dz += this.radius + 1;
break;
- case 7:
+ case 7:
sx -= this.radius;
dx -= this.radius;
sz += this.radius + 1;
@@ -152,45 +153,45 @@ public class TileEntityReverter extends TileEntity
}
switch (outline)
{
- case 0:
- case 1:
- case 2:
- case 3:
+ case 0:
+ case 1:
+ case 2:
+ case 3:
sy += this.radius + 1;
dy += this.radius + 1;
break;
- case 4:
- case 5:
- case 6:
- case 7:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
sy -= this.radius;
dy += this.radius + 1;
break;
- case 8:
- case 9:
- case 10:
- case 11:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
sy -= this.radius;
dy -= this.radius;
}
if (this.rand.nextBoolean()) {
- drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz);
+ this.drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz);
} else {
- drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D);
+ this.drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D);
}
- drawParticleLine(sx, sy, sz, dx, dy, dz);
+ this.drawParticleLine(sx, sy, sz, dx, dy, dz);
}
- protected void drawParticleLine(double srcX, double srcY, double srcZ, double destX, double destY, double destZ)
+ protected void drawParticleLine(final double srcX, final double srcY, final double srcZ, final double destX, final double destY, final double destZ)
{
- int particles = 16;
+ final int particles = 16;
for (int i = 0; i < particles; i++)
{
- double trailFactor = i / (particles - 1.0D);
+ final double trailFactor = i / (particles - 1.0D);
- double tx = srcX + (destX - srcX) * trailFactor + this.rand.nextFloat() * 0.005D;
- double ty = srcY + (destY - srcY) * trailFactor + this.rand.nextFloat() * 0.005D;
- double tz = srcZ + (destZ - srcZ) * trailFactor + this.rand.nextFloat() * 0.005D;
+ final double tx = srcX + ((destX - srcX) * trailFactor) + (this.rand.nextFloat() * 0.005D);
+ final double ty = srcY + ((destY - srcY) * trailFactor) + (this.rand.nextFloat() * 0.005D);
+ final double tz = srcZ + ((destZ - srcZ) * trailFactor) + (this.rand.nextFloat() * 0.005D);
this.worldObj.spawnParticle("portal", tx, ty, tz, 0.0D, 0.0D, 0.0D);
}
}
@@ -203,10 +204,10 @@ public class TileEntityReverter extends TileEntity
for (int y = -this.radius; y <= this.radius; y++) {
for (int z = -this.radius; z <= this.radius; z++)
{
- Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z);
- byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z);
+ final Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z);
+ final byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z);
if (this.blockData[index] != blockID) {
- if (revertBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z, blockID, meta, this.blockData[index], this.metaData[index]))
+ if (this.revertBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z, blockID, meta, this.blockData[index], this.metaData[index]))
{
reverted = true;
}
@@ -223,7 +224,7 @@ public class TileEntityReverter extends TileEntity
return reverted;
}
- private boolean revertBlock(int x, int y, int z, Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta)
+ private boolean revertBlock(final int x, final int y, final int z, final Block thereBlockID, final byte thereMeta, final Block replaceBlockID, byte replaceMeta)
{
/*if ((thereBlockID == Blocks.air) && (!replaceBlockID.getMaterial().blocksMovement()))
{
@@ -231,7 +232,7 @@ public class TileEntityReverter extends TileEntity
return false;
}*/
- if (isUnrevertable(thereBlockID, thereMeta, replaceBlockID, replaceMeta)) {
+ if (this.isUnrevertable(thereBlockID, thereMeta, replaceBlockID, replaceMeta)) {
return false;
}
if (this.rand.nextInt(5) == 0)
@@ -255,7 +256,7 @@ public class TileEntityReverter extends TileEntity
return true;
}
- private boolean isUnrevertable(Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta)
+ private boolean isUnrevertable(final Block thereBlockID, final byte thereMeta, final Block replaceBlockID, final byte replaceMeta)
{
if ((thereBlockID == ModBlocks.blockGriefSaver) || (replaceBlockID == ModBlocks.blockGriefSaver)) {
return true;
@@ -291,8 +292,8 @@ public class TileEntityReverter extends TileEntity
for (int y = -this.radius; y <= this.radius; y++) {
for (int z = -this.radius; z <= this.radius; z++)
{
- Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z);
- int meta = this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z);
+ final Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z);
+ final int meta = this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z);
this.blockData[index] = blockID;
this.metaData[index] = ((byte)meta);
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java
index 8a38269609..eac2724aa0 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java
@@ -1,15 +1,13 @@
package gtPlusPlus.core.tileentities.machines;
+import java.util.List;
+import java.util.Vector;
+
import gtPlusPlus.core.inventories.*;
import ic2.api.network.INetworkDataProvider;
import ic2.api.network.INetworkUpdateListener;
import ic2.api.tile.IWrenchable;
import ic2.core.IC2;
-import ic2.core.network.NetworkManager;
-
-import java.util.List;
-import java.util.Vector;
-
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCraftResult;
@@ -24,8 +22,8 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi
public InventoryWorkbenchChest inventoryChest;
public InventoryWorkbenchTools inventoryTool;
- public InventoryWorkbenchHoloSlots inventoryHolo;
- public InventoryWorkbenchHoloCrafting inventoryCrafting;
+ public InventoryWorkbenchHoloSlots inventoryHolo;
+ public InventoryWorkbenchHoloCrafting inventoryCrafting;
public IInventory inventoryCraftResult = new InventoryCraftResult();
@@ -38,7 +36,7 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi
}
@SuppressWarnings("static-method")
- public NBTTagCompound getTag(NBTTagCompound nbt, String tag)
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag)
{
if(!nbt.hasKey(tag))
{
@@ -48,75 +46,76 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi
}
@Override
- public void writeToNBT(NBTTagCompound nbt)
+ public void writeToNBT(final NBTTagCompound nbt)
{
super.writeToNBT(nbt);
-
+
nbt.setShort("facing", this.facing);
-
- inventoryChest.writeToNBT(getTag(nbt, "ContentsChest"));
- inventoryTool.writeToNBT(getTag(nbt, "ContentsTools"));
+
+ this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest"));
+ this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools"));
//inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting"));
- inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo"));
+ this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo"));
// Write Crafting Matrix to NBT
- NBTTagList craftingTag = new NBTTagList();
- for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) {
- if (inventoryCrafting.getStackInSlot(currentIndex) != null) {
- NBTTagCompound tagCompound = new NBTTagCompound();
+ final NBTTagList craftingTag = new NBTTagList();
+ for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) {
+ if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) {
+ final NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
- inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
+ this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
craftingTag.appendTag(tagCompound);
}
}
nbt.setTag("CraftingMatrix", craftingTag);
// Write craftingResult to NBT
- if (inventoryCraftResult.getStackInSlot(0) != null)
- nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
+ if (this.inventoryCraftResult.getStackInSlot(0) != null) {
+ nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
+ }
}
@Override
- public void readFromNBT(NBTTagCompound nbt)
+ public void readFromNBT(final NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.prevFacing = (this.facing = nbt.getShort("facing"));
-
- inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest"));
- inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools"));
+ this.prevFacing = (this.facing = nbt.getShort("facing"));
+
+ this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest"));
+ this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools"));
//inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting"));
- inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo"));
+ this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo"));
// Read in the Crafting Matrix from NBT
- NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
- inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
+ final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
+ this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
for (int i = 0; i < craftingTag.tagCount(); ++i) {
- NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
- byte slot = tagCompound.getByte("Slot");
- if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) {
- inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
+ final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i);
+ final byte slot = tagCompound.getByte("Slot");
+ if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) {
+ this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
}
}
// Read craftingResult from NBT
- NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult");
- inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
+ final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult");
+ this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
}
@Override
public List<String> getNetworkedFields(){
- List<String> ret = new Vector(2);
- ret.add("facing");
+ final List<String> ret = new Vector(2);
+ ret.add("facing");
return ret;
}
@Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
+ public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side)
{
return false;
}
@@ -125,11 +124,11 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi
public short prevFacing = 0;
@Override
- public void setFacing(short facing1)
+ public void setFacing(final short facing1)
{
this.facing = facing1;
if (this.prevFacing != facing1) {
- ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing");
+ IC2.network.get().updateTileEntityField(this, "facing");
}
this.prevFacing = facing1;
}
@@ -142,7 +141,7 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi
@Override
- public boolean wrenchCanRemove(EntityPlayer entityPlayer)
+ public boolean wrenchCanRemove(final EntityPlayer entityPlayer)
{
return true;
}
@@ -154,16 +153,16 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi
}
@Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
+ public ItemStack getWrenchDrop(final EntityPlayer entityPlayer)
{
return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
}
@Override
- public void onNetworkUpdate(String field) {
+ public void onNetworkUpdate(final String field) {
+
+ this.prevFacing = this.facing;
- this.prevFacing = this.facing;
-
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java
index 011498fd5d..fdf89e523b 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java
@@ -1,5 +1,8 @@
package gtPlusPlus.core.tileentities.machines;
+import java.util.List;
+import java.util.Vector;
+
import gtPlusPlus.core.inventories.*;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
@@ -8,11 +11,6 @@ import ic2.api.network.INetworkDataProvider;
import ic2.api.network.INetworkUpdateListener;
import ic2.api.tile.IWrenchable;
import ic2.core.IC2;
-import ic2.core.network.NetworkManager;
-
-import java.util.List;
-import java.util.Vector;
-
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCraftResult;
@@ -29,8 +27,8 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
public InventoryWorkbenchChest inventoryChest;
public InventoryWorkbenchToolsElectric inventoryTool;
- public InventoryWorkbenchHoloSlots inventoryHolo;
- public InventoryWorkbenchHoloCrafting inventoryCrafting;
+ public InventoryWorkbenchHoloSlots inventoryHolo;
+ public InventoryWorkbenchHoloCrafting inventoryCrafting;
public IInventory inventoryCraftResult = new InventoryCraftResult();
@@ -46,7 +44,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
private float guiChargeLevel;
- public TileEntityWorkbenchAdvanced(int maxenergy, int tier1){
+ public TileEntityWorkbenchAdvanced(final int maxenergy, final int tier1){
this.inventoryTool = new InventoryWorkbenchToolsElectric();//number of slots - without product slot
this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot
this.inventoryHolo = new InventoryWorkbenchHoloSlots();
@@ -60,7 +58,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
}
@SuppressWarnings("static-method")
- public NBTTagCompound getTag(NBTTagCompound nbt, String tag)
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag)
{
if(!nbt.hasKey(tag))
{
@@ -70,68 +68,69 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
}
@Override
- public void writeToNBT(NBTTagCompound nbt)
+ public void writeToNBT(final NBTTagCompound nbt)
{
super.writeToNBT(nbt);
nbt.setDouble("energy", this.energy);
nbt.setShort("facing", this.facing);
- inventoryChest.writeToNBT(getTag(nbt, "ContentsChest"));
- inventoryTool.writeToNBT(getTag(nbt, "ContentsTools"));
+ this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest"));
+ this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools"));
//inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting"));
- inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo"));
+ this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo"));
// Write Crafting Matrix to NBT
- NBTTagList craftingTag = new NBTTagList();
- for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) {
- if (inventoryCrafting.getStackInSlot(currentIndex) != null) {
- NBTTagCompound tagCompound = new NBTTagCompound();
+ final NBTTagList craftingTag = new NBTTagList();
+ for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) {
+ if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) {
+ final NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
- inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
+ this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
craftingTag.appendTag(tagCompound);
}
}
nbt.setTag("CraftingMatrix", craftingTag);
// Write craftingResult to NBT
- if (inventoryCraftResult.getStackInSlot(0) != null)
- nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
+ if (this.inventoryCraftResult.getStackInSlot(0) != null) {
+ nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
+ }
}
@Override
- public void readFromNBT(NBTTagCompound nbt)
+ public void readFromNBT(final NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.energy = nbt.getDouble("energy");
this.prevFacing = (this.facing = nbt.getShort("facing"));
- inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest"));
- inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools"));
+ this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest"));
+ this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools"));
//inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting"));
- inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo"));
+ this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo"));
// Read in the Crafting Matrix from NBT
- NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
- inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
+ final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
+ this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
for (int i = 0; i < craftingTag.tagCount(); ++i) {
- NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
- byte slot = tagCompound.getByte("Slot");
- if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) {
- inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
+ final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i);
+ final byte slot = tagCompound.getByte("Slot");
+ if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) {
+ this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
}
}
// Read craftingResult from NBT
- NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult");
- inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
+ final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult");
+ this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
}
@Override
- public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
+ public boolean acceptsEnergyFrom(final TileEntity emitter, final ForgeDirection direction)
{
return true;
}
@@ -149,7 +148,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
}
@Override
- public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
+ public double injectEnergy(final ForgeDirection directionFrom, final double amount, final double voltage)
{
if (this.energy >= this.maxEnergy) {
return amount;
@@ -163,12 +162,12 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
return this.guiChargeLevel;
}
- public void setTier(int tier1)
+ public void setTier(final int tier1)
{
if (this.tier == tier1) {
return;
}
- boolean addedToENet = this.addedToEnergyNet;
+ final boolean addedToENet = this.addedToEnergyNet;
if (addedToENet)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
@@ -176,7 +175,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
}
this.tier = tier1;
- for (int i=0; i<inventoryTool.getSizeInventory(); i++){
+ for (int i=0; i<this.inventoryTool.getSizeInventory(); i++){
//this.inventoryTool..setTier(tier1); TODO
}
@@ -189,24 +188,24 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
@Override
public List<String> getNetworkedFields(){
- List<String> ret = new Vector(2);
- ret.add("facing");
+ final List<String> ret = new Vector(2);
+ ret.add("facing");
return ret;
}
@Override
- public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
+ public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side)
{
return false;
}
@Override
- public void setFacing(short facing1)
+ public void setFacing(final short facing1)
{
this.facing = facing1;
if (this.prevFacing != facing1) {
- ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing");
+ IC2.network.get().updateTileEntityField(this, "facing");
}
this.prevFacing = facing1;
}
@@ -219,7 +218,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
@Override
- public boolean wrenchCanRemove(EntityPlayer entityPlayer)
+ public boolean wrenchCanRemove(final EntityPlayer entityPlayer)
{
return true;
}
@@ -231,13 +230,13 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi
}
@Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
+ public ItemStack getWrenchDrop(final EntityPlayer entityPlayer)
{
return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
}
@Override
- public void onNetworkUpdate(String field) {
+ public void onNetworkUpdate(final String field) {
this.prevFacing = this.facing;