Auto formatted, and cleaned imports

This commit is contained in:
Modmuss50 2015-04-15 16:23:12 +01:00
parent c001231216
commit 8e7d6b011e
64 changed files with 2268 additions and 2587 deletions

View file

@ -38,35 +38,35 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
public void updateEntity() {
super.updateEntity();
energy.updateEntity();
if(!worldObj.isRemote){
if(isRunning){
if(ItemUtils.isItemEqual(currentRecipe.getInputItem(), getStackInSlot(0), true, true)){
if(!hasTakenCells){
if(getStackInSlot(1) != null && getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName().equals("ic2.itemFluidCell")){
if(getStackInSlot(1).stackSize >= currentRecipe.getCells()){
if (!worldObj.isRemote) {
if (isRunning) {
if (ItemUtils.isItemEqual(currentRecipe.getInputItem(), getStackInSlot(0), true, true)) {
if (!hasTakenCells) {
if (getStackInSlot(1) != null && getStackInSlot(1) != null && getStackInSlot(1).getUnlocalizedName().equals("ic2.itemFluidCell")) {
if (getStackInSlot(1).stackSize >= currentRecipe.getCells()) {
decrStackSize(1, currentRecipe.getCells());
hasTakenCells = true;
}
}
}
if(hasTakenCells && hasTakenItem){
if(tickTime == currentRecipe.getTickTime()) {
if(areAnyOutputsFull()){
if (hasTakenCells && hasTakenItem) {
if (tickTime == currentRecipe.getTickTime()) {
if (areAnyOutputsFull()) {
return;
}
if(areOutputsEmpty()){
if (areOutputsEmpty()) {
setOutput(1, currentRecipe.getOutput1());
setOutput(2, currentRecipe.getOutput2());
setOutput(3, currentRecipe.getOutput3());
setOutput(4, currentRecipe.getOutput4());
} else if(areOutputsEqual()){
if(currentRecipe.getOutput1() != null)
} else if (areOutputsEqual()) {
if (currentRecipe.getOutput1() != null)
increacseItemStack(1, 1);
if(currentRecipe.getOutput2() != null)
if (currentRecipe.getOutput2() != null)
increacseItemStack(2, 1);
if(currentRecipe.getOutput3() != null)
if (currentRecipe.getOutput3() != null)
increacseItemStack(3, 1);
if(currentRecipe.getOutput4() != null)
if (currentRecipe.getOutput4() != null)
increacseItemStack(4, 1);
}
tickTime = 0;
@ -76,10 +76,10 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
syncWithAll();
return;
}
if(energy.canUseEnergy(euTick)){
if(getStackInSlot(0) != null && ItemUtils.isItemEqual(getStackInSlot(0), currentRecipe.getInputItem(), true, true)){
if(energy.useEnergy(5)){
tickTime ++;
if (energy.canUseEnergy(euTick)) {
if (getStackInSlot(0) != null && ItemUtils.isItemEqual(getStackInSlot(0), currentRecipe.getInputItem(), true, true)) {
if (energy.useEnergy(5)) {
tickTime++;
}
}
}
@ -87,17 +87,17 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
}
} else {
//sets a new recipe
if(getStackInSlot(0) != null && currentRecipe == null){
for(CentrifugeRecipie recipie: TechRebornAPI.centrifugeRecipies){
if(ItemUtils.isItemEqual(recipie.getInputItem(), getStackInSlot(0), true, true)){
if (getStackInSlot(0) != null && currentRecipe == null) {
for (CentrifugeRecipie recipie : TechRebornAPI.centrifugeRecipies) {
if (ItemUtils.isItemEqual(recipie.getInputItem(), getStackInSlot(0), true, true)) {
currentRecipe = new CentrifugeRecipie(recipie);
}
}
}
if(!isRunning && currentRecipe != null){
if(areOutputsEqual() || !areAnyOutputsFull()){
if(getStackInSlot(0) != null && currentRecipe.getInputItem().stackSize <= getStackInSlot(0).stackSize){
if(energy.canUseEnergy(euTick)){
if (!isRunning && currentRecipe != null) {
if (areOutputsEqual() || !areAnyOutputsFull()) {
if (getStackInSlot(0) != null && currentRecipe.getInputItem().stackSize <= getStackInSlot(0).stackSize) {
if (energy.canUseEnergy(euTick)) {
decrStackSize(0, currentRecipe.getInputItem().stackSize);
hasTakenItem = true;
tickTime = 0;
@ -111,59 +111,59 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
}
}
public boolean areOutputsEqual(){
if(currentRecipe == null){
public boolean areOutputsEqual() {
if (currentRecipe == null) {
return false;
}
boolean boo = false;
if(currentRecipe.getOutput1() != null && ItemUtils.isItemEqual(getOutputItemStack(1), currentRecipe.getOutput1(), false, true)){
boo = true;
}
if(currentRecipe.getOutput2() != null && ItemUtils.isItemEqual(getOutputItemStack(2), currentRecipe.getOutput2(), false, true)){
if (currentRecipe.getOutput1() != null && ItemUtils.isItemEqual(getOutputItemStack(1), currentRecipe.getOutput1(), false, true)) {
boo = true;
}
if(currentRecipe.getOutput3() != null && ItemUtils.isItemEqual(getOutputItemStack(3), currentRecipe.getOutput3(), false, true)){
if (currentRecipe.getOutput2() != null && ItemUtils.isItemEqual(getOutputItemStack(2), currentRecipe.getOutput2(), false, true)) {
boo = true;
}
if(currentRecipe.getOutput4() != null && ItemUtils.isItemEqual(getOutputItemStack(4), currentRecipe.getOutput4(), false, true)){
if (currentRecipe.getOutput3() != null && ItemUtils.isItemEqual(getOutputItemStack(3), currentRecipe.getOutput3(), false, true)) {
boo = true;
}
if (currentRecipe.getOutput4() != null && ItemUtils.isItemEqual(getOutputItemStack(4), currentRecipe.getOutput4(), false, true)) {
boo = true;
}
return boo;
}
public boolean areOutputsEmpty(){
public boolean areOutputsEmpty() {
return getOutputItemStack(1) == null && getOutputItemStack(2) == null && getOutputItemStack(3) == null && getOutputItemStack(4) == null;
}
public boolean areAnyOutputsFull(){
if(currentRecipe.getOutput1() != null && getOutputItemStack(1) != null && getOutputItemStack(1).stackSize + currentRecipe.getOutput1().stackSize > currentRecipe.getOutput1().getMaxStackSize()){
return true;
}
if(currentRecipe.getOutput2() != null && getOutputItemStack(2) != null && getOutputItemStack(2).stackSize + currentRecipe.getOutput2().stackSize > currentRecipe.getOutput1().getMaxStackSize()){
public boolean areAnyOutputsFull() {
if (currentRecipe.getOutput1() != null && getOutputItemStack(1) != null && getOutputItemStack(1).stackSize + currentRecipe.getOutput1().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true;
}
if(currentRecipe.getOutput3() != null && getOutputItemStack(3) != null && getOutputItemStack(3).stackSize + currentRecipe.getOutput3().stackSize > currentRecipe.getOutput1().getMaxStackSize()){
if (currentRecipe.getOutput2() != null && getOutputItemStack(2) != null && getOutputItemStack(2).stackSize + currentRecipe.getOutput2().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true;
}
if(currentRecipe.getOutput4() != null && getOutputItemStack(4) != null && getOutputItemStack(4).stackSize + currentRecipe.getOutput4().stackSize > currentRecipe.getOutput1().getMaxStackSize()){
if (currentRecipe.getOutput3() != null && getOutputItemStack(3) != null && getOutputItemStack(3).stackSize + currentRecipe.getOutput3().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true;
}
if (currentRecipe.getOutput4() != null && getOutputItemStack(4) != null && getOutputItemStack(4).stackSize + currentRecipe.getOutput4().stackSize > currentRecipe.getOutput1().getMaxStackSize()) {
return true;
}
return false;
}
public ItemStack getOutputItemStack(int slot){
public ItemStack getOutputItemStack(int slot) {
return getStackInSlot(slot + 1);
}
public void increacseItemStack(int slot, int amount) {
if(getOutputItemStack(slot) == null){
if (getOutputItemStack(slot) == null) {
return;
}
decrStackSize(slot + 1, -amount);
}
public void setOutput(int slot, ItemStack stack){
if(stack == null){
public void setOutput(int slot, ItemStack stack) {
if (stack == null) {
return;
}
setInventorySlotContents(slot + 1, stack);
@ -174,8 +174,8 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
super.readFromNBT(tagCompound);
inventory.readFromNBT(tagCompound);
String recipeName = tagCompound.getString("recipe");
for(CentrifugeRecipie recipie : TechRebornAPI.centrifugeRecipies){
if(recipie.getInputItem().getUnlocalizedName().equals(recipeName)){
for (CentrifugeRecipie recipie : TechRebornAPI.centrifugeRecipies) {
if (recipie.getInputItem().getUnlocalizedName().equals(recipeName)) {
currentRecipe = new CentrifugeRecipie(recipie);
}
}
@ -193,7 +193,7 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
}
public void writeUpdateToNBT(NBTTagCompound tagCompound) {
if(currentRecipe != null){
if (currentRecipe != null) {
tagCompound.setString("recipe", currentRecipe.getInputItem().getUnlocalizedName());
} else {
tagCompound.setString("recipe", "none");
@ -297,7 +297,8 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
}
@Override
public void setFacing(short facing) {}
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
@ -317,11 +318,11 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
@Override
public int[] getAccessibleSlotsFromSide(int side) {
//Top
if(side == 1){
if (side == 1) {
return new int[]{0};
}
//Bottom
if(side == 0){
if (side == 0) {
return new int[]{1};
}
//Not bottom or top
@ -331,11 +332,11 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side) {
//Bottom
if(side == 0){
if (side == 0) {
return stack.getUnlocalizedName().equals("ic2.itemFluidCell");
}
//Not bottom or top
if(side >= 2){
if (side >= 2) {
return false;
}
return true;

View file

@ -21,9 +21,9 @@ public class TileMachineBase extends TileEntity {
}
@SideOnly(Side.CLIENT)
public void addWailaInfo(List<String> info) {
public void addWailaInfo(List<String> info) {
}
}
public void syncWithAll() {
if (!worldObj.isRemote) {

View file

@ -15,7 +15,7 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class TileQuantumChest extends TileMachineBase implements IInventory ,IWrenchable{
public class TileQuantumChest extends TileMachineBase implements IInventory, IWrenchable {
//Slot 0 = Input
//Slot 1 = Output
@ -27,7 +27,7 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
@Override
public void updateEntity() {
if(storedItem != null){
if (storedItem != null) {
ItemStack fakeStack = storedItem.copy();
fakeStack.stackSize = 1;
setInventorySlotContents(2, fakeStack);
@ -35,26 +35,26 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
setInventorySlotContents(2, null);
}
if(getStackInSlot(0) != null){
if(storedItem == null){
if (getStackInSlot(0) != null) {
if (storedItem == null) {
storedItem = getStackInSlot(0);
setInventorySlotContents(0, null);
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)){
if(storedItem.stackSize <=Integer.MAX_VALUE - getStackInSlot(0).stackSize){
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)) {
if (storedItem.stackSize <= Integer.MAX_VALUE - getStackInSlot(0).stackSize) {
storedItem.stackSize += getStackInSlot(0).stackSize;
decrStackSize(0, getStackInSlot(0).stackSize);
}
}
}
if(storedItem != null && getStackInSlot(1) == null){
if (storedItem != null && getStackInSlot(1) == null) {
ItemStack itemStack = storedItem.copy();
itemStack.stackSize = itemStack.getMaxStackSize();
setInventorySlotContents(1, itemStack);
storedItem.stackSize -= itemStack.getMaxStackSize();
} else if(ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)){
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) {
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize;
if(storedItem.stackSize >= wanted){
if (storedItem.stackSize >= wanted) {
decrStackSize(1, -wanted);
storedItem.stackSize -= wanted;
} else {
@ -89,13 +89,12 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
storedItem = null;
if (tagCompound.hasKey("storedStack"))
{
if (tagCompound.hasKey("storedStack")) {
storedItem = ItemStack.
loadItemStackFromNBT((NBTTagCompound)tagCompound.getTag("storedStack"));
loadItemStackFromNBT((NBTTagCompound) tagCompound.getTag("storedStack"));
}
if(storedItem != null){
if (storedItem != null) {
storedItem.stackSize = tagCompound.getInteger("storedQuantity");
}
}
@ -108,12 +107,10 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
public void writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
inventory.writeToNBT(tagCompound);
if (storedItem != null)
{
if (storedItem != null) {
tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound()));
tagCompound.setInteger("storedQuantity", storedItem.stackSize);
}
else
} else
tagCompound.setInteger("storedQuantity", 0);
}
@ -177,34 +174,34 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
return inventory.isItemValidForSlot(slot, stack);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {
}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1F;
}
@Override
public float getWrenchDropRate() {
return 1F;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return getDropWithNBT();
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return getDropWithNBT();
}
public ItemStack getDropWithNBT() {
NBTTagCompound tileEntity = new NBTTagCompound();
@ -220,11 +217,11 @@ public class TileQuantumChest extends TileMachineBase implements IInventory ,IWr
super.addWailaInfo(info);
int size = 0;
String name = "of nothing";
if(storedItem != null){
if (storedItem != null) {
name = storedItem.getDisplayName();
size += storedItem.stackSize;
}
if( getStackInSlot(1) != null){
if (getStackInSlot(1) != null) {
name = getStackInSlot(1).getDisplayName();
size += getStackInSlot(1).stackSize;
}

View file

@ -1,9 +1,6 @@
package techreborn.tiles;
import ic2.api.tile.IWrenchable;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -21,6 +18,8 @@ import techreborn.util.FluidUtils;
import techreborn.util.Inventory;
import techreborn.util.Tank;
import java.util.List;
public class TileQuantumTank extends TileMachineBase implements IFluidHandler, IInventory, IWrenchable {
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
@ -66,9 +65,9 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler, I
super.updateEntity();
FluidUtils.drainContainers(this, inventory, 0, 1);
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
if(tank.getFluidType() != null && getStackInSlot(2) == null){
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
} else if(tank.getFluidType() == null && getStackInSlot(2) != null){
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
setInventorySlotContents(2, null);
}
}
@ -206,7 +205,7 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler, I
@Override
public void addWailaInfo(List<String> info) {
super.addWailaInfo(info);
if(tank.getFluid() != null){
if (tank.getFluid() != null) {
info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName());
} else {
info.add("Empty");

View file

@ -1,66 +1,61 @@
package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import ic2.api.energy.prefab.BasicSink;
import ic2.api.tile.IWrenchable;
import techreborn.api.CentrifugeRecipie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import techreborn.api.RollingMachineRecipie;
import techreborn.api.TechRebornAPI;
import techreborn.init.ModBlocks;
import techreborn.util.Inventory;
public class TileRollingMachine extends TileMachineBase implements IWrenchable{
public BasicSink energy;
public class TileRollingMachine extends TileMachineBase implements IWrenchable {
public BasicSink energy;
public Inventory inventory = new Inventory(10, "TileRollingMachine", 64);
public boolean isRunning;
public int tickTime;
public RollingMachineRecipie currentRecipe;
public int euTick = 5;
public TileRollingMachine()
{
public TileRollingMachine() {
energy = new BasicSink(this, 100000, 1);
}
@Override
public void updateEntity()
{
super.updateEntity();
energy.updateEntity();
public void updateEntity() {
super.updateEntity();
energy.updateEntity();
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
return false;
}
@Override
public short getFacing() {
return 0;
}
@Override
public short getFacing() {
return 0;
}
@Override
public void setFacing(short facing) {}
@Override
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return true;
}
@Override
public float getWrenchDropRate() {
return 1.0F;
}
@Override
public float getWrenchDropRate() {
return 1.0F;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.RollingMachine, 1);
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.RollingMachine, 1);
}
}

View file

@ -11,12 +11,7 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.*;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.util.FluidUtils;
@ -45,7 +40,8 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
}
@Override
public void setFacing(short facing) {}
public void setFacing(short facing) {
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
@ -69,7 +65,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return tank.drain(resource.amount, doDrain);
return tank.drain(resource.amount, doDrain);
}
@Override
@ -130,13 +126,13 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
super.updateEntity();
FluidUtils.drainContainers(this, inventory, 0, 1);
energySource.updateEntity();
if(tank.getFluidAmount() > 0 && energySource.getCapacity() - energySource.getEnergyStored() >= euTick){
if (tank.getFluidAmount() > 0 && energySource.getCapacity() - energySource.getEnergyStored() >= euTick) {
tank.drain(1, true);
energySource.addEnergy(euTick);
}
if(tank.getFluidType() != null && getStackInSlot(2) == null){
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
} else if(tank.getFluidType() == null && getStackInSlot(2) != null){
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
setInventorySlotContents(2, null);
}
}