Initial stab at 1.11

About halfway.
This commit is contained in:
Nicholas Ignoffo 2016-12-12 19:56:36 -08:00
parent ce52aea512
commit 00d6f8eb46
157 changed files with 1036 additions and 1554 deletions

View file

@ -35,7 +35,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
{
if (arrayEffect != null)
{
arrayEffect.onEntityCollidedWithBlock(this, worldObj, pos, state, entity);
arrayEffect.onEntityCollidedWithBlock(this, getWorld(), pos, state, entity);
}
}
@ -145,7 +145,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
{
this.decrStackSize(0, 1);
this.decrStackSize(1, 1);
this.worldObj.setBlockToAir(getPos());
this.getWorld().setBlockToAir(getPos());
}
return true;

View file

@ -76,7 +76,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
{
if (blockedSlots.contains(slot))
{
blockedSlots.remove((Object) slot);
blockedSlots.remove(slot);
} else
{
blockedSlots.add(slot);
@ -136,7 +136,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
{
if (this.isSlave())
{
TileEntity tile = worldObj.getTileEntity(connectedPos);
TileEntity tile = getWorld().getTileEntity(connectedPos);
if (tile instanceof TileAlchemyTable)
{
return (T) new SidedInvWrapper((TileAlchemyTable) tile, facing);
@ -172,7 +172,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
case DOWN:
return index != outputSlot && index != orbSlot && index != toolSlot;
case UP:
if (index == orbSlot && stack != null && stack.getItem() instanceof IBloodOrb)
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb)
{
return true;
} else if (index == toolSlot)
@ -195,7 +195,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
case DOWN:
return index == outputSlot;
case UP:
if (index == orbSlot && stack != null && stack.getItem() instanceof IBloodOrb)
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb)
{
return true;
} else if (index == toolSlot)
@ -237,7 +237,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
for (int i = 0; i < 6; i++)
{
if (getStackInSlot(i) != null)
if (!getStackInSlot(i).isEmpty())
{
inputList.add(getStackInSlot(i));
}
@ -246,12 +246,12 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
int tier = getTierOfOrb();
AlchemyTableRecipe recipe = AlchemyTableRecipeRegistry.getMatchingRecipe(inputList, getWorld(), getPos());
if (recipe != null && (burnTime > 0 || (!worldObj.isRemote && tier >= recipe.getTierRequired() && this.getContainedLp() >= recipe.getLpDrained())))
if (recipe != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipe.getTierRequired() && this.getContainedLp() >= recipe.getLpDrained())))
{
if (burnTime == 1)
{
IBlockState state = worldObj.getBlockState(pos);
worldObj.notifyBlockUpdate(getPos(), state, state, 3);
IBlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(getPos(), state, state, 3);
}
if (canCraft(inputList, recipe))
@ -261,18 +261,18 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
if (burnTime == ticksRequired)
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
int requiredLp = recipe.getLpDrained();
if (requiredLp > 0)
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
consumeLp(requiredLp);
}
}
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
craftItem(inputList, recipe);
}
@ -280,8 +280,8 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
burnTime = 0;
IBlockState state = worldObj.getBlockState(pos);
worldObj.notifyBlockUpdate(getPos(), state, state, 3);
IBlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(getPos(), state, state, 3);
} else if (burnTime > ticksRequired + 10)
{
burnTime = 0;
@ -310,13 +310,13 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
ItemStack outputStack = recipe.getRecipeOutput(inputList);
ItemStack currentOutputStack = getStackInSlot(outputSlot);
if (outputStack == null)
if (outputStack.isEmpty())
return false;
if (currentOutputStack == null)
if (currentOutputStack.isEmpty())
return true;
if (!currentOutputStack.isItemEqual(outputStack))
return false;
int result = currentOutputStack.stackSize + outputStack.stackSize;
int result = currentOutputStack.getCount() + outputStack.getCount();
return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize();
}
@ -324,7 +324,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
public int getTierOfOrb()
{
ItemStack orbStack = getStackInSlot(orbSlot);
if (orbStack != null)
if (!orbStack.isEmpty())
{
if (orbStack.getItem() instanceof IBloodOrb)
{
@ -338,7 +338,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
public int getContainedLp()
{
ItemStack orbStack = getStackInSlot(orbSlot);
if (orbStack != null)
if (!orbStack.isEmpty())
{
if (orbStack.getItem() instanceof IBloodOrb)
{
@ -372,12 +372,12 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
ItemStack outputStack = recipe.getRecipeOutput(inputList);
ItemStack currentOutputStack = getStackInSlot(outputSlot);
if (currentOutputStack == null)
if (currentOutputStack.isEmpty())
{
setInventorySlotContents(outputSlot, outputStack);
} else if (currentOutputStack.getItem() == currentOutputStack.getItem())
{
currentOutputStack.stackSize += outputStack.stackSize;
currentOutputStack.setCount(outputStack.getCount());
}
consumeInventory(recipe);
@ -388,7 +388,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
{
ItemStack orbStack = getStackInSlot(orbSlot);
if (orbStack != null)
if (!orbStack.isEmpty())
{
if (orbStack.getItem() instanceof IBloodOrb)
{
@ -416,24 +416,5 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
{
setInventorySlotContents(i, result[i]);
}
// for (int i = 0; i < 6; i++)
// {
// ItemStack inputStack = getStackInSlot(i);
// if (inputStack != null)
// {
// if (inputStack.getItem().hasContainerItem(inputStack))
// {
// setInventorySlotContents(i, inputStack.getItem().getContainerItem(inputStack));
// continue;
// }
//
// inputStack.stackSize--;
// if (inputStack.stackSize <= 0)
// {
// setInventorySlotContents(i, null);
// continue;
// }
// }
// }
}
}

View file

@ -30,14 +30,14 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
@Override
public void update()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
internalCounter++;
if (worldObj.isBlockPowered(getPos()))
if (getWorld().isBlockPowered(getPos()))
{
//TODO: Fill the contained gem if it is there.
ItemStack stack = this.getStackInSlot(0);
@ -70,28 +70,28 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
} else
{
ItemStack stack = this.getStackInSlot(0);
if (stack != null)
if (!stack.isEmpty())
{
if (stack.getItem() instanceof IDemonWillGem)
{
IDemonWillGem gemItem = (IDemonWillGem) stack.getItem();
for (EnumDemonWillType type : EnumDemonWillType.values())
{
double currentAmount = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
double drainAmount = Math.min(maxWill - currentAmount, gemDrainRate);
double filled = WorldDemonWillHandler.fillWillToMaximum(worldObj, pos, type, drainAmount, maxWill, false);
double filled = WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, drainAmount, maxWill, false);
filled = gemItem.drainWill(type, stack, filled, false);
if (filled > 0)
{
filled = gemItem.drainWill(type, stack, filled, true);
WorldDemonWillHandler.fillWillToMaximum(worldObj, pos, type, filled, maxWill, true);
WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, filled, maxWill, true);
}
}
} else if (stack.getItem() instanceof IDiscreteDemonWill) //TODO: Limit the speed of this process
{
IDiscreteDemonWill willItem = (IDiscreteDemonWill) stack.getItem();
EnumDemonWillType type = willItem.getType(stack);
double currentAmount = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
double needed = maxWill - currentAmount;
double discreteAmount = willItem.getDiscretization(stack);
if (needed >= discreteAmount)
@ -99,10 +99,10 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
double filled = willItem.drainWill(stack, discreteAmount);
if (filled > 0)
{
WorldDemonWillHandler.fillWillToMaximum(worldObj, pos, type, filled, maxWill, true);
if (stack.stackSize <= 0)
WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, filled, maxWill, true);
if (stack.getCount() <= 0)
{
this.setInventorySlotContents(0, null);
this.setInventorySlotContents(0, ItemStack.EMPTY);
}
}
}
@ -252,7 +252,7 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction)
{
return stack != null ? stack.getItem() instanceof IDemonWillGem || stack.getItem() instanceof IDiscreteDemonWill : false;
return !stack.isEmpty() && (stack.getItem() instanceof IDemonWillGem || stack.getItem() instanceof IDiscreteDemonWill);
}
@Override

View file

@ -41,7 +41,7 @@ public class TileDemonCrystal extends TileTicking
@Override
public void onUpdate()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
@ -52,20 +52,20 @@ public class TileDemonCrystal extends TileTicking
{
EnumDemonWillType type = EnumDemonWillType.values()[this.getBlockMetadata()];
double value = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
if (type != EnumDemonWillType.DEFAULT)
{
if (value >= 100)
{
double nextProgress = getCrystalGrowthPerSecond(value);
progressToNextCrystal += WorldDemonWillHandler.drainWill(worldObj, getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
} else
{
value = WorldDemonWillHandler.getCurrentWill(worldObj, pos, EnumDemonWillType.DEFAULT);
value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, EnumDemonWillType.DEFAULT);
if (value > 0.5)
{
double nextProgress = getCrystalGrowthPerSecond(value) * timeDelayForWrongWill;
progressToNextCrystal += WorldDemonWillHandler.drainWill(worldObj, getPos(), EnumDemonWillType.DEFAULT, nextProgress * defaultWillConversionRate, true) / defaultWillConversionRate;
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), EnumDemonWillType.DEFAULT, nextProgress * defaultWillConversionRate, true) / defaultWillConversionRate;
}
}
} else
@ -73,17 +73,17 @@ public class TileDemonCrystal extends TileTicking
if (value > 0.5)
{
double nextProgress = getCrystalGrowthPerSecond(value);
progressToNextCrystal += WorldDemonWillHandler.drainWill(worldObj, getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
}
}
checkAndGrowCrystal();
}
// if (worldObj.getWorldTime() % 200 == 0)
// if (getWorld().getWorldTime() % 200 == 0)
// {
// crystalCount = Math.min(crystalCount + 1, 7);
// worldObj.markBlockForUpdate(pos);
// getWorld().markBlockForUpdate(pos);
// }
}
@ -105,11 +105,11 @@ public class TileDemonCrystal extends TileTicking
return 0;
}
IBlockState state = worldObj.getBlockState(pos);
IBlockState state = getWorld().getBlockState(pos);
int meta = this.getBlockType().getMetaFromState(state);
EnumDemonWillType type = EnumDemonWillType.values()[meta];
double value = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
double percentDrain = willDrain <= 0 ? 1 : Math.min(1, value / willDrain);
if (percentDrain <= 0)
{
@ -117,7 +117,7 @@ public class TileDemonCrystal extends TileTicking
}
// Verification that you can actually drain the will from this chunk, for future proofing.
WorldDemonWillHandler.drainWill(worldObj, pos, type, percentDrain * willDrain, true);
WorldDemonWillHandler.drainWill(getWorld(), pos, type, percentDrain * willDrain, true);
progressToNextCrystal += percentDrain * progressPercentage;
checkAndGrowCrystal();
@ -131,8 +131,8 @@ public class TileDemonCrystal extends TileTicking
{
progressToNextCrystal--;
crystalCount++;
IBlockState thisState = worldObj.getBlockState(pos);
worldObj.notifyBlockUpdate(pos, thisState, thisState, 3);
IBlockState thisState = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(pos, thisState, thisState, 3);
markDirty();
}
}
@ -144,15 +144,15 @@ public class TileDemonCrystal extends TileTicking
public boolean dropSingleCrystal()
{
if (!worldObj.isRemote && crystalCount > 1)
if (!getWorld().isRemote && crystalCount > 1)
{
IBlockState state = worldObj.getBlockState(pos);
IBlockState state = getWorld().getBlockState(pos);
EnumDemonWillType type = state.getValue(BlockDemonCrystal.TYPE);
ItemStack stack = BlockDemonCrystal.getItemStackDropped(type, 1);
if (stack != null)
{
crystalCount--;
worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack));
getWorld().spawnEntity(new EntityItem(getWorld(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack));
return true;
}
}
@ -167,7 +167,7 @@ public class TileDemonCrystal extends TileTicking
public int getCrystalCountForRender()
{
return MathHelper.clamp_int(crystalCount - 1, 0, 6);
return MathHelper.clamp(crystalCount - 1, 0, 6);
}
@Override

View file

@ -30,26 +30,26 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
@Override
public void onUpdate()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
BlockPos offsetPos = pos.offset(EnumFacing.UP);
if (worldObj.isAirBlock(offsetPos)) //Room for a crystal to grow
if (getWorld().isAirBlock(offsetPos)) //Room for a crystal to grow
{
EnumDemonWillType highestType = WorldDemonWillHandler.getHighestDemonWillType(worldObj, pos);
double amount = WorldDemonWillHandler.getCurrentWill(worldObj, pos, highestType);
EnumDemonWillType highestType = WorldDemonWillHandler.getHighestDemonWillType(getWorld(), pos);
double amount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, highestType);
if (amount >= willToFormCrystal)
{
internalCounter += getCrystalFormationRate(amount);
if (internalCounter >= totalFormationTime)
{
if (WorldDemonWillHandler.drainWill(worldObj, getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal)
if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal)
{
if (highestType == EnumDemonWillType.DEFAULT && formRandomSpecialCrystal(offsetPos) || formCrystal(highestType, offsetPos))
{
WorldDemonWillHandler.drainWill(worldObj, getPos(), highestType, willToFormCrystal, true);
WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, true);
internalCounter = 0;
}
}
@ -60,8 +60,8 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
public boolean formCrystal(EnumDemonWillType type, BlockPos position)
{
worldObj.setBlockState(position, ModBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()));
TileEntity tile = worldObj.getTileEntity(position);
getWorld().setBlockState(position, ModBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()));
TileEntity tile = getWorld().getTileEntity(position);
if (tile instanceof TileDemonCrystal)
{
((TileDemonCrystal) tile).setPlacement(EnumFacing.UP);
@ -73,11 +73,11 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
public boolean formRandomSpecialCrystal(BlockPos position)
{
if (worldObj.rand.nextDouble() > 0.1)
if (getWorld().rand.nextDouble() > 0.1)
{
return formCrystal(EnumDemonWillType.DEFAULT, position);
}
EnumDemonWillType crystalType = EnumDemonWillType.values()[worldObj.rand.nextInt(EnumDemonWillType.values().length - 1) + 1];
EnumDemonWillType crystalType = EnumDemonWillType.values()[getWorld().rand.nextInt(EnumDemonWillType.values().length - 1) + 1];
return formCrystal(crystalType, position);
}

View file

@ -23,24 +23,24 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit
@Override
public void onUpdate()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
for (EnumDemonWillType type : EnumDemonWillType.values())
{
double currentAmount = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
for (EnumFacing side : EnumFacing.HORIZONTALS)
{
BlockPos offsetPos = pos.offset(side, 16);
double sideAmount = WorldDemonWillHandler.getCurrentWill(worldObj, offsetPos, type);
double sideAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), offsetPos, type);
if (sideAmount > currentAmount)
{
double drainAmount = Math.min((sideAmount - currentAmount) / 2, drainRate);
double drain = WorldDemonWillHandler.drainWill(worldObj, offsetPos, type, drainAmount, true);
WorldDemonWillHandler.fillWill(worldObj, pos, type, drain, true);
double drain = WorldDemonWillHandler.drainWill(getWorld(), offsetPos, type, drainAmount, true);
WorldDemonWillHandler.fillWill(getWorld(), pos, type, drain, true);
}
}
}

View file

@ -42,13 +42,13 @@ public class TileIncenseAltar extends TileInventory implements ITickable
public void update()
{
AxisAlignedBB aabb = incenseArea.getAABB(getPos());
List<EntityPlayer> playerList = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
List<EntityPlayer> playerList = getWorld().getEntitiesWithinAABB(EntityPlayer.class, aabb);
if (playerList.isEmpty())
{
return;
}
if (worldObj.getTotalWorldTime() % 100 == 0)
if (getWorld().getTotalWorldTime() % 100 == 0)
{
recheckConstruction();
}
@ -65,9 +65,9 @@ public class TileIncenseAltar extends TileInventory implements ITickable
if (hasPerformed)
{
if (worldObj.rand.nextInt(4) == 0 && worldObj instanceof WorldServer)
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof WorldServer)
{
WorldServer server = (WorldServer) worldObj;
WorldServer server = (WorldServer) getWorld();
server.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 1, 0.02, 0.03, 0.02, 0, new int[0]);
}
}
@ -113,9 +113,9 @@ public class TileIncenseAltar extends TileInventory implements ITickable
for (int j = -1; j <= 1; j++)
{
BlockPos offsetPos = facingOffsetPos.offset(horizontalFacing.rotateY(), j);
IBlockState state = worldObj.getBlockState(offsetPos);
IBlockState state = getWorld().getBlockState(offsetPos);
Block block = state.getBlock();
if (!(block instanceof IIncensePath && ((IIncensePath) block).getLevelOfPath(worldObj, offsetPos, state) >= currentDistance - 2))
if (!(block instanceof IIncensePath && ((IIncensePath) block).getLevelOfPath(getWorld(), offsetPos, state) >= currentDistance - 2))
{
canFormRoad = false;
break level;
@ -144,9 +144,9 @@ public class TileIncenseAltar extends TileInventory implements ITickable
for (int y = 0 + yOffset; y <= 2 + yOffset; y++)
{
BlockPos offsetPos = pos.add(i, y, j);
IBlockState state = worldObj.getBlockState(offsetPos);
IBlockState state = getWorld().getBlockState(offsetPos);
Block block = state.getBlock();
TranquilityStack stack = IncenseTranquilityRegistry.getTranquilityOfBlock(worldObj, offsetPos, block, state);
TranquilityStack stack = IncenseTranquilityRegistry.getTranquilityOfBlock(getWorld(), offsetPos, block, state);
if (stack != null)
{
if (!tranquilityMap.containsKey(stack.type))
@ -186,7 +186,7 @@ public class TileIncenseAltar extends TileInventory implements ITickable
appliedTranquility += Math.sqrt(entry.getValue());
}
double bonus = IncenseAltarHandler.getIncenseBonusFromComponents(worldObj, pos, appliedTranquility, roadDistance);
double bonus = IncenseAltarHandler.getIncenseBonusFromComponents(getWorld(), pos, appliedTranquility, roadDistance);
incenseAddition = bonus;
this.tranquility = appliedTranquility;
}

View file

@ -61,7 +61,7 @@ public class TileInventory extends TileBase implements IInventory
if (j >= 0 && j < inventory.length)
{
inventory[j] = ItemStack.loadItemStackFromNBT(data);
inventory[j] = new ItemStack(data);
}
}
}
@ -75,7 +75,7 @@ public class TileInventory extends TileBase implements IInventory
for (int i = 0; i < inventory.length; i++)
{
if ((inventory[i] != null) && !isSyncedSlot(i))
if ((!inventory[i].isEmpty()) && !isSyncedSlot(i))
{
NBTTagCompound data = new NBTTagCompound();
data.setByte("Slot", (byte) i);
@ -115,7 +115,7 @@ public class TileInventory extends TileBase implements IInventory
if (!getWorld().isRemote)
getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
if (inventory[index].stackSize <= count)
if (inventory[index].getCount() <= count)
{
ItemStack itemStack = inventory[index];
inventory[index] = null;
@ -124,7 +124,7 @@ public class TileInventory extends TileBase implements IInventory
}
ItemStack itemStack = inventory[index].splitStack(count);
if (inventory[index].stackSize == 0)
if (inventory[index].getCount() == 0)
inventory[index] = null;
markDirty();
@ -150,8 +150,8 @@ public class TileInventory extends TileBase implements IInventory
public void setInventorySlotContents(int slot, ItemStack stack)
{
inventory[slot] = stack;
if (stack != null && stack.stackSize > getInventoryStackLimit())
stack.stackSize = getInventoryStackLimit();
if (!stack.isEmpty() && stack.getCount() > getInventoryStackLimit())
stack.setCount(getInventoryStackLimit());
markDirty();
if (!getWorld().isRemote)
getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
@ -163,12 +163,6 @@ public class TileInventory extends TileBase implements IInventory
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return true;
}
@Override
public void openInventory(EntityPlayer player)
{
@ -211,6 +205,20 @@ public class TileInventory extends TileBase implements IInventory
this.inventory = new ItemStack[size];
}
@Override
public boolean isEmpty() {
for (ItemStack stack : inventory)
if (!stack.isEmpty())
return false;
return true;
}
@Override
public boolean isUsableByPlayer(EntityPlayer player) {
return true;
}
// IWorldNameable
@Override

View file

@ -82,23 +82,23 @@ public class TileInversionPillar extends TileTicking
{
if (animationOffsetValue < 0)
{
animationOffsetValue = worldObj.getTotalWorldTime() * worldObj.rand.nextFloat();
animationOffsetValue = getWorld().getTotalWorldTime() * getWorld().rand.nextFloat();
animationOffset.setValue(animationOffsetValue);
}
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
if (!isRegistered)
{
isRegistered = InversionPillarHandler.addPillarToMap(worldObj, getType(), getPos());
isRegistered = InversionPillarHandler.addPillarToMap(getWorld(), getType(), getPos());
}
counter++;
double currentWill = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double currentWill = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
if (counter % 1 == 0)
{
List<BlockPos> pillarList = getNearbyPillarsExcludingThis();
@ -151,17 +151,17 @@ public class TileInversionPillar extends TileTicking
if (currentInfectionRadius >= 8 && currentInversion >= inversionToAddPillar)
{
//TODO: Improve algorithm
List<BlockPos> allConnectedPos = InversionPillarHandler.getAllConnectedPillars(worldObj, type, pos);
BlockPos candidatePos = findCandidatePositionForPillar(worldObj, type, pos, allConnectedPos, 5, 10);
List<BlockPos> allConnectedPos = InversionPillarHandler.getAllConnectedPillars(getWorld(), type, pos);
BlockPos candidatePos = findCandidatePositionForPillar(getWorld(), type, pos, allConnectedPos, 5, 10);
if (!candidatePos.equals(BlockPos.ORIGIN))
{
currentInversion = 0;
IBlockState pillarState = ModBlocks.INVERSION_PILLAR.getStateFromMeta(type.ordinal());
IBlockState bottomState = ModBlocks.INVERSION_PILLAR_END.getStateFromMeta(type.ordinal() * 2);
IBlockState topState = ModBlocks.INVERSION_PILLAR_END.getStateFromMeta(type.ordinal() * 2 + 1);
worldObj.setBlockState(candidatePos, pillarState);
worldObj.setBlockState(candidatePos.down(), bottomState);
worldObj.setBlockState(candidatePos.up(), topState);
getWorld().setBlockState(candidatePos, pillarState);
getWorld().setBlockState(candidatePos.down(), bottomState);
getWorld().setBlockState(candidatePos.up(), topState);
}
}
}
@ -176,11 +176,11 @@ public class TileInversionPillar extends TileTicking
{
if (currentInversion > 1000)
{
Vec3d vec = new Vec3d(worldObj.rand.nextDouble() * 2 - 1, worldObj.rand.nextDouble() * 2 - 1, worldObj.rand.nextDouble() * 2 - 1).normalize().scale(2 * currentInfectionRadius);
Vec3d vec = new Vec3d(getWorld().rand.nextDouble() * 2 - 1, getWorld().rand.nextDouble() * 2 - 1, getWorld().rand.nextDouble() * 2 - 1).normalize().scale(2 * currentInfectionRadius);
BlockPos centralPos = pos.add(vec.xCoord, vec.yCoord, vec.zCoord);
worldObj.setBlockState(centralPos, ModBlocks.DEMON_EXTRAS.getStateFromMeta(0));
getWorld().setBlockState(centralPos, ModBlocks.DEMON_EXTRAS.getStateFromMeta(0));
currentInversion -= 1000;
}
}
@ -236,7 +236,7 @@ public class TileInversionPillar extends TileTicking
public void spreadWillToSurroundingChunks()
{
double currentAmount = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
if (currentAmount <= minimumWillForChunkWhenSpreading)
{
return;
@ -245,7 +245,7 @@ public class TileInversionPillar extends TileTicking
for (EnumFacing side : EnumFacing.HORIZONTALS)
{
BlockPos offsetPos = pos.offset(side, 16);
double sideAmount = WorldDemonWillHandler.getCurrentWill(worldObj, offsetPos, type);
double sideAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), offsetPos, type);
if (currentAmount > sideAmount)
{
double drainAmount = Math.min((currentAmount - sideAmount) / 2, willPushRate);
@ -254,8 +254,8 @@ public class TileInversionPillar extends TileTicking
continue;
}
double drain = WorldDemonWillHandler.drainWill(worldObj, pos, type, drainAmount, true);
drain = WorldDemonWillHandler.fillWillToMaximum(worldObj, offsetPos, type, drain, maxWillForChunk, true);
double drain = WorldDemonWillHandler.drainWill(getWorld(), pos, type, drainAmount, true);
drain = WorldDemonWillHandler.fillWillToMaximum(getWorld(), offsetPos, type, drain, maxWillForChunk, true);
currentInversion -= drain * inversionCostPerWillSpread;
}
@ -264,15 +264,15 @@ public class TileInversionPillar extends TileTicking
public void removePillarFromMap()
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
InversionPillarHandler.removePillarFromMap(worldObj, type, pos);
InversionPillarHandler.removePillarFromMap(getWorld(), type, pos);
}
}
public List<BlockPos> getNearbyPillarsExcludingThis()
{
return InversionPillarHandler.getNearbyPillars(worldObj, type, pos);
return InversionPillarHandler.getNearbyPillars(getWorld(), type, pos);
}
@Override
@ -322,7 +322,7 @@ public class TileInversionPillar extends TileTicking
if (totalGeneratedWill > 0)
{
WorldDemonWillHandler.fillWillToMaximum(worldObj, pos, type, totalGeneratedWill, maxWillForChunk, true);
WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, totalGeneratedWill, maxWillForChunk, true);
}
}
@ -359,9 +359,9 @@ public class TileInversionPillar extends TileTicking
for (int i = 0; i < currentInfectionRadius; i++)
{
double xOff = (worldObj.rand.nextBoolean() ? 1 : -1) * (worldObj.rand.nextGaussian() + 1) * (currentInfectionRadius);
double yOff = (worldObj.rand.nextBoolean() ? 1 : -1) * (worldObj.rand.nextGaussian() + 1) * (currentInfectionRadius);
double zOff = (worldObj.rand.nextBoolean() ? 1 : -1) * (worldObj.rand.nextGaussian() + 1) * (currentInfectionRadius);
double xOff = (getWorld().rand.nextBoolean() ? 1 : -1) * (getWorld().rand.nextGaussian() + 1) * (currentInfectionRadius);
double yOff = (getWorld().rand.nextBoolean() ? 1 : -1) * (getWorld().rand.nextGaussian() + 1) * (currentInfectionRadius);
double zOff = (getWorld().rand.nextBoolean() ? 1 : -1) * (getWorld().rand.nextGaussian() + 1) * (currentInfectionRadius);
double r2 = xOff * xOff + yOff * yOff + zOff * zOff;
int maxInfectionRadius2 = (9 * currentInfectionRadius * currentInfectionRadius);
if (r2 > maxInfectionRadius2)
@ -378,16 +378,16 @@ public class TileInversionPillar extends TileTicking
return 1; //Invalid block (itself!)
}
IBlockState state = worldObj.getBlockState(offsetPos);
if (!state.getBlock().isAir(state, worldObj, offsetPos))
IBlockState state = getWorld().getBlockState(offsetPos);
if (!state.getBlock().isAir(state, getWorld(), offsetPos))
{
//Consume Will and set this block
Block block = state.getBlock();
if (block == Blocks.DIRT || block == Blocks.STONE || block == Blocks.GRASS)
{
if (worldObj.setBlockState(offsetPos, ModBlocks.DEMON_EXTRAS.getStateFromMeta(0)))
if (getWorld().setBlockState(offsetPos, ModBlocks.DEMON_EXTRAS.getStateFromMeta(0)))
{
WorldDemonWillHandler.drainWill(worldObj, pos, type, willPerOperation, true);
WorldDemonWillHandler.drainWill(getWorld(), pos, type, willPerOperation, true);
currentInversion -= inversionPerOperation;
return 0; //Successfully placed

View file

@ -51,7 +51,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
@Override
public void onUpdate()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
return;
if (getWorld().isBlockPowered(getPos()) && isActive())

View file

@ -32,6 +32,8 @@ import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;
import javax.annotation.Nullable;
public class TileMimic extends TileInventory implements ITickable
{
private static Field _blockMetadata = ReflectionHelper.findField(TileEntity.class, "blockMetadata", "field_145847_g");
@ -55,7 +57,7 @@ public class TileMimic extends TileInventory implements ITickable
@Override
public void update()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
@ -67,36 +69,36 @@ public class TileMimic extends TileInventory implements ITickable
if (potionStack != null)
{
AxisAlignedBB bb = new AxisAlignedBB(this.getPos()).expand(playerCheckRadius, playerCheckRadius, playerCheckRadius);
List<EntityPlayer> playerList = worldObj.getEntitiesWithinAABB(EntityPlayer.class, bb);
List<EntityPlayer> playerList = getWorld().getEntitiesWithinAABB(EntityPlayer.class, bb);
for (EntityPlayer player : playerList)
{
if (!player.capabilities.isCreativeMode)
{
double posX = this.pos.getX() + 0.5 + (2 * worldObj.rand.nextDouble() - 1) * potionSpawnRadius;
double posY = this.pos.getY() + 0.5 + (2 * worldObj.rand.nextDouble() - 1) * potionSpawnRadius;
double posZ = this.pos.getZ() + 0.5 + (2 * worldObj.rand.nextDouble() - 1) * potionSpawnRadius;
double posX = this.pos.getX() + 0.5 + (2 * getWorld().rand.nextDouble() - 1) * potionSpawnRadius;
double posY = this.pos.getY() + 0.5 + (2 * getWorld().rand.nextDouble() - 1) * potionSpawnRadius;
double posZ = this.pos.getZ() + 0.5 + (2 * getWorld().rand.nextDouble() - 1) * potionSpawnRadius;
ItemStack newStack = new ItemStack(potionStack.getItem() == ModItems.POTION_FLASK ? Items.SPLASH_POTION : potionStack.getItem());
newStack.setTagCompound(potionStack.getTagCompound());
EntityPotion potionEntity = new EntityPotion(worldObj, posX, posY, posZ, newStack);
EntityPotion potionEntity = new EntityPotion(getWorld(), posX, posY, posZ, newStack);
worldObj.spawnEntityInWorld(potionEntity);
getWorld().spawnEntity(potionEntity);
break;
}
}
}
}
if (this.getBlockMetadata() == BlockMimic.sentientMimicMeta && worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(mimicedTile instanceof IInventory))
if (this.getBlockMetadata() == BlockMimic.sentientMimicMeta && getWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(mimicedTile instanceof IInventory))
{
AxisAlignedBB bb = new AxisAlignedBB(this.getPos()).expand(playerCheckRadius, playerCheckRadius, playerCheckRadius);
List<EntityPlayer> playerList = worldObj.getEntitiesWithinAABB(EntityPlayer.class, bb);
List<EntityPlayer> playerList = getWorld().getEntitiesWithinAABB(EntityPlayer.class, bb);
for (EntityPlayer player : playerList)
{
if (!player.capabilities.isCreativeMode && Utils.canEntitySeeBlock(worldObj, player, getPos()))
if (!player.capabilities.isCreativeMode && Utils.canEntitySeeBlock(getWorld(), player, getPos()))
{
spawnMimicEntity(player);
break;
@ -108,10 +110,10 @@ public class TileMimic extends TileInventory implements ITickable
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side)
{
if (heldItem != null && player.capabilities.isCreativeMode)
if (!heldItem.isEmpty() && player.capabilities.isCreativeMode)
{
List<PotionEffect> list = PotionUtils.getEffectsFromStack(heldItem);
if (list != null && !list.isEmpty())
if (!list.isEmpty())
{
if (!world.isRemote)
{
@ -141,10 +143,10 @@ public class TileMimic extends TileInventory implements ITickable
if (player.isSneaking())
return false;
if (player.getHeldItem(hand) != null && player.getHeldItem(hand).getItem() == new ItemStack(ModBlocks.MIMIC).getItem())
if (!player.getHeldItem(hand).isEmpty() && player.getHeldItem(hand).getItem() == new ItemStack(ModBlocks.MIMIC).getItem())
return false;
if (getStackInSlot(0) != null && player.getHeldItem(hand) != null)
if (!getStackInSlot(0).isEmpty() && !player.getHeldItem(hand).isEmpty())
return false;
if (!dropItemsOnBreak && !player.capabilities.isCreativeMode)
@ -155,7 +157,7 @@ public class TileMimic extends TileInventory implements ITickable
if (player.capabilities.isCreativeMode)
{
dropItemsOnBreak = getStackInSlot(0) == null;
dropItemsOnBreak = getStackInSlot(0).isEmpty();
}
world.notifyBlockUpdate(pos, state, state, 3);
@ -189,7 +191,7 @@ public class TileMimic extends TileInventory implements ITickable
return false;
}
if (player.getActiveItemStack() == null && getStackInSlot(1) != null)
if (player.getActiveItemStack().isEmpty() && !getStackInSlot(1).isEmpty())
{
switch (sideHit)
{
@ -242,31 +244,31 @@ public class TileMimic extends TileInventory implements ITickable
public boolean spawnMimicEntity(EntityPlayer target)
{
if (this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
if (this.getWorld().getDifficulty() == EnumDifficulty.PEACEFUL)
{
return false;
}
if (this.getStackInSlot(0) == null || worldObj.isRemote)
if (this.getStackInSlot(0).isEmpty() || getWorld().isRemote)
{
return false;
}
EntityMimic mimicEntity = new EntityMimic(worldObj);
EntityMimic mimicEntity = new EntityMimic(getWorld());
mimicEntity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
mimicEntity.initializeMimic(getStackInSlot(0), tileTag, dropItemsOnBreak, metaOfReplacedBlock, playerCheckRadius, pos);
tileTag = null;
mimicedTile = null;
this.setInventorySlotContents(0, null);
this.setInventorySlotContents(0, ItemStack.EMPTY);
worldObj.spawnEntityInWorld(mimicEntity);
getWorld().spawnEntity(mimicEntity);
if (target != null)
{
mimicEntity.setAttackTarget(target);
}
worldObj.setBlockToAir(pos);
getWorld().setBlockToAir(pos);
return true;
}
@ -277,7 +279,7 @@ public class TileMimic extends TileInventory implements ITickable
{
dropMimicedTileInventory();
}
mimicedTile = getTileFromStackWithTag(worldObj, pos, getStackInSlot(0), tileTag, metaOfReplacedBlock);
mimicedTile = getTileFromStackWithTag(getWorld(), pos, getStackInSlot(0), tileTag, metaOfReplacedBlock);
}
@Override
@ -288,7 +290,7 @@ public class TileMimic extends TileInventory implements ITickable
dropItemsOnBreak = tag.getBoolean("dropItemsOnBreak");
tileTag = tag.getCompoundTag("tileTag");
metaOfReplacedBlock = tag.getInteger("metaOfReplacedBlock");
mimicedTile = getTileFromStackWithTag(worldObj, pos, getStackInSlot(0), tileTag, metaOfReplacedBlock);
mimicedTile = getTileFromStackWithTag(getWorld(), pos, getStackInSlot(0), tileTag, metaOfReplacedBlock);
playerCheckRadius = tag.getInteger("playerCheckRadius");
potionSpawnRadius = tag.getInteger("potionSpawnRadius");
potionSpawnInterval = Math.max(1, tag.getInteger("potionSpawnInterval"));
@ -319,7 +321,7 @@ public class TileMimic extends TileInventory implements ITickable
public static boolean replaceMimicWithBlockActual(World world, BlockPos pos, ItemStack stack, NBTTagCompound tileTag, int replacedMeta)
{
if (stack != null && stack.getItem() instanceof ItemBlock)
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock) stack.getItem()).getBlock();
IBlockState state = block.getStateFromMeta(replacedMeta);
@ -341,9 +343,10 @@ public class TileMimic extends TileInventory implements ITickable
return false;
}
public static TileEntity getTileFromStackWithTag(World world, BlockPos pos, ItemStack stack, NBTTagCompound tag, int replacementMeta)
@Nullable
public static TileEntity getTileFromStackWithTag(World world, BlockPos pos, ItemStack stack, @Nullable NBTTagCompound tag, int replacementMeta)
{
if (stack != null && stack.getItem() instanceof ItemBlock)
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock)
{
Block block = ((ItemBlock) stack.getItem()).getBlock();
IBlockState state = block.getStateFromMeta(stack.getItemDamage());
@ -356,14 +359,14 @@ public class TileMimic extends TileInventory implements ITickable
if (tag != null)
{
NBTTagCompound copyTag = (NBTTagCompound) (tag.copy());
NBTTagCompound copyTag = tag.copy();
copyTag.setInteger("x", pos.getX());
copyTag.setInteger("y", pos.getY());
copyTag.setInteger("z", pos.getZ());
tile.readFromNBT(copyTag);
}
tile.setWorldObj(world);
tile.setWorld(world);
try
{
@ -396,7 +399,7 @@ public class TileMimic extends TileInventory implements ITickable
public void dropMimicedTileInventory()
{
if (!worldObj.isRemote && mimicedTile instanceof IInventory)
if (!getWorld().isRemote && mimicedTile instanceof IInventory)
{
InventoryHelper.dropInventoryItems(getWorld(), getPos(), (IInventory) mimicedTile);
}

View file

@ -35,8 +35,8 @@ public class TilePhantomBlock extends TileTicking
if (ticksRemaining <= 0)
{
worldObj.setBlockToAir(getPos());
worldObj.removeTileEntity(getPos());
getWorld().setBlockToAir(getPos());
getWorld().removeTileEntity(getPos());
}
}
}

View file

@ -33,7 +33,7 @@ public class TilePurificationAltar extends TileInventory implements ITickable
if (totalPurity <= 0)
{
ItemStack stack = this.getStackInSlot(0);
if (stack != null && stack.getItem() instanceof IPurificationAsh)
if (!stack.isEmpty() && stack.getItem() instanceof IPurificationAsh)
{
totalPurity = ((IPurificationAsh) stack.getItem()).getTotalPurity(stack);
maxPurity = ((IPurificationAsh) stack.getItem()).getMaxPurity(stack);
@ -45,7 +45,7 @@ public class TilePurificationAltar extends TileInventory implements ITickable
}
AxisAlignedBB aabb = purityArea.getAABB(getPos());
List<EntityAnimal> animalList = worldObj.getEntitiesWithinAABB(EntityAnimal.class, aabb);
List<EntityAnimal> animalList = getWorld().getEntitiesWithinAABB(EntityAnimal.class, aabb);
if (animalList.isEmpty())
{
return;
@ -65,9 +65,9 @@ public class TilePurificationAltar extends TileInventory implements ITickable
if (hasPerformed)
{
if (worldObj.rand.nextInt(4) == 0 && worldObj instanceof WorldServer)
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof WorldServer)
{
WorldServer server = (WorldServer) worldObj;
WorldServer server = (WorldServer) getWorld();
server.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 1, 0.02, 0.03, 0.02, 0, new int[0]);
}
}

View file

@ -52,22 +52,22 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
@Override
public void update()
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
for (EnumDemonWillType type : EnumDemonWillType.values())
{
double willInWorld = WorldDemonWillHandler.getCurrentWill(worldObj, pos, type);
double willInWorld = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
double filled = Math.min(willInWorld, worldWillTransferRate);
if (filled > 0)
{
filled = this.fillDemonWill(type, filled, false);
filled = WorldDemonWillHandler.drainWill(worldObj, pos, type, filled, false);
filled = WorldDemonWillHandler.drainWill(getWorld(), pos, type, filled, false);
if (filled > 0)
{
this.fillDemonWill(type, filled, true);
WorldDemonWillHandler.drainWill(worldObj, pos, type, filled, true);
WorldDemonWillHandler.drainWill(getWorld(), pos, type, filled, true);
}
}
}
@ -85,7 +85,7 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
for (int i = 0; i < 4; i++)
{
if (getStackInSlot(i) != null)
if (!getStackInSlot(i).isEmpty())
{
inputList.add(getStackInSlot(i));
}
@ -100,18 +100,18 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
if (burnTime == ticksRequired)
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
double requiredSouls = recipe.getSoulsDrained();
if (requiredSouls > 0)
{
if (!worldObj.isRemote && soulsInGem >= recipe.getMinimumSouls())
if (!getWorld().isRemote && soulsInGem >= recipe.getMinimumSouls())
{
consumeSouls(EnumDemonWillType.DEFAULT, requiredSouls);
}
}
if (!worldObj.isRemote && soulsInGem >= recipe.getMinimumSouls())
if (!getWorld().isRemote && soulsInGem >= recipe.getMinimumSouls())
craftItem(recipe);
}
@ -144,13 +144,13 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
ItemStack outputStack = recipe.getRecipeOutput();
ItemStack currentOutputStack = getStackInSlot(outputSlot);
if (outputStack == null)
if (outputStack.isEmpty())
return false;
if (currentOutputStack == null)
if (currentOutputStack.isEmpty())
return true;
if (!currentOutputStack.isItemEqual(outputStack))
return false;
int result = currentOutputStack.stackSize + outputStack.stackSize;
int result = currentOutputStack.getCount() + outputStack.getCount();
return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize();
}
@ -162,12 +162,12 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
ItemStack outputStack = recipe.getRecipeOutput();
ItemStack currentOutputStack = getStackInSlot(outputSlot);
if (currentOutputStack == null)
if (currentOutputStack.isEmpty())
{
setInventorySlotContents(outputSlot, outputStack);
} else if (currentOutputStack.getItem() == currentOutputStack.getItem())
{
currentOutputStack.stackSize += outputStack.stackSize;
currentOutputStack.grow(outputStack.getCount());
}
consumeInventory();
@ -178,7 +178,7 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
{
ItemStack soulStack = getStackInSlot(soulSlot);
if (soulStack != null)
if (!soulStack.isEmpty())
{
if (soulStack.getItem() instanceof IDemonWill || soulStack.getItem() instanceof IDemonWillGem)
{
@ -243,7 +243,7 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
for (int i = 0; i < 4; i++)
{
ItemStack inputStack = getStackInSlot(i);
if (inputStack != null)
if (!inputStack.isEmpty())
{
if (inputStack.getItem().hasContainerItem(inputStack))
{
@ -251,11 +251,10 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
continue;
}
inputStack.stackSize--;
if (inputStack.stackSize <= 0)
inputStack.shrink(1);
if (inputStack.isEmpty())
{
setInventorySlotContents(i, null);
continue;
setInventorySlotContents(i, ItemStack.EMPTY);
}
}
}
@ -281,23 +280,20 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
}
ItemStack stack = this.getStackInSlot(soulSlot);
if (stack == null || !(stack.getItem() instanceof IDemonWillGem))
if (stack.isEmpty() || !(stack.getItem() instanceof IDemonWillGem))
{
return 0;
}
IDemonWillGem willGem = (IDemonWillGem) stack.getItem();
double filled = willGem.fillWill(type, stack, amount, doFill);
return filled;
return willGem.fillWill(type, stack, amount, doFill);
}
@Override
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain)
{
ItemStack stack = this.getStackInSlot(soulSlot);
if (stack == null || !(stack.getItem() instanceof IDemonWillGem))
if (stack.isEmpty() || !(stack.getItem() instanceof IDemonWillGem))
{
return 0;
}

View file

@ -42,7 +42,7 @@ public class TileSpectralBlock extends TileTicking
@Override
public void onUpdate()
{
if (worldObj.isRemote)
if (getWorld().isRemote)
{
return;
}
@ -79,7 +79,7 @@ public class TileSpectralBlock extends TileTicking
if (!Strings.isNullOrEmpty(containedBlockName))
block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(containedBlockName));
if (block != null && worldObj.setBlockState(pos, block.getStateFromMeta(containedBlockMeta)))
if (block != null && getWorld().setBlockState(pos, block.getStateFromMeta(containedBlockMeta)))
getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
}

View file

@ -52,9 +52,9 @@ public class TileTeleposer extends TileInventory implements ITickable
@Override
public void update()
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
int currentInput = worldObj.getStrongPower(pos);
int currentInput = getWorld().getStrongPower(pos);
if (previousInput == 0 && currentInput != 0)
{
@ -67,17 +67,16 @@ public class TileTeleposer extends TileInventory implements ITickable
public void initiateTeleport()
{
if (!worldObj.isRemote && worldObj.getTileEntity(pos) != null && worldObj.getTileEntity(pos) instanceof TileTeleposer && canInitiateTeleport((TileTeleposer) worldObj.getTileEntity(pos)) && worldObj.getBlockState(pos).getBlock() instanceof BlockTeleposer)
if (!getWorld().isRemote && canInitiateTeleport(this) && getBlockType() instanceof BlockTeleposer)
{
TileTeleposer teleposer = (TileTeleposer) worldObj.getTileEntity(pos);
ItemStack focusStack = NBTHelper.checkNBT(teleposer.getStackInSlot(0));
ItemStack focusStack = NBTHelper.checkNBT(getStackInSlot(0));
ItemTelepositionFocus focus = (ItemTelepositionFocus) focusStack.getItem();
BlockPos focusPos = focus.getBlockPos(teleposer.getStackInSlot(0));
World focusWorld = focus.getWorld(teleposer.getStackInSlot(0));
BlockPos focusPos = focus.getBlockPos(getStackInSlot(0));
World focusWorld = focus.getWorld(getStackInSlot(0));
if (focusWorld != null && focusWorld.getTileEntity(focusPos) instanceof TileTeleposer && !focusWorld.getTileEntity(focusPos).equals(this))
{
final int focusLevel = (teleposer.getStackInSlot(0).getItemDamage() + 1);
final int focusLevel = (getStackInSlot(0).getItemDamage() + 1);
final int lpToBeDrained = (int) (0.5F * Math.sqrt((pos.getX() - focusPos.getX()) * (pos.getX() - focusPos.getX()) + (pos.getY() - focusPos.getY() + 1) * (pos.getY() - focusPos.getY() + 1) + (pos.getZ() - focusPos.getZ()) * (pos.getZ() - focusPos.getZ())));
if (NetworkHelper.getSoulNetwork(focus.getOwnerUUID(focusStack)).syphonAndDamage(PlayerHelper.getPlayerFromUUID(focus.getOwnerUUID(focusStack)), lpToBeDrained * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1)))
@ -90,7 +89,7 @@ public class TileTeleposer extends TileInventory implements ITickable
{
for (int k = -(focusLevel - 1); k <= (focusLevel - 1); k++)
{
TeleposeEvent event = new TeleposeEvent(worldObj, pos.add(i, 1 + j, k), focusWorld, focusPos.add(i, 1 + j, k));
TeleposeEvent event = new TeleposeEvent(getWorld(), pos.add(i, 1 + j, k), focusWorld, focusPos.add(i, 1 + j, k));
if (Utils.swapLocations(event.initalWorld, event.initialBlockPos, event.finalWorld, event.finalBlockPos) && !MinecraftForge.EVENT_BUS.post(event))
{
blocksTransported++;
@ -104,11 +103,11 @@ public class TileTeleposer extends TileInventory implements ITickable
List<Entity> originalWorldEntities;
List<Entity> focusWorldEntities;
AxisAlignedBB originalArea = new AxisAlignedBB(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, Math.min(focusWorld.getHeight(), pos.getY() + 2 * focusLevel), pos.getZ() + 1).expand(focusLevel - 1, 0, focusLevel - 1);
originalWorldEntities = worldObj.getEntitiesWithinAABB(Entity.class, originalArea);
originalWorldEntities = getWorld().getEntitiesWithinAABB(Entity.class, originalArea);
AxisAlignedBB focusArea = new AxisAlignedBB(focusPos.getX(), focusPos.getY() + 1, focusPos.getZ(), focusPos.getX() + 1, Math.min(focusWorld.getHeight(), focusPos.getY() + 2 * focusLevel), focusPos.getZ() + 1).expand(focusLevel - 1, 0, focusLevel - 1);
focusWorldEntities = focusWorld.getEntitiesWithinAABB(Entity.class, focusArea);
if (focusWorld.equals(worldObj))
if (focusWorld.equals(getWorld()))
{
if (!originalWorldEntities.isEmpty())
{
@ -131,7 +130,7 @@ public class TileTeleposer extends TileInventory implements ITickable
{
for (Entity entity : originalWorldEntities)
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), worldObj, focusWorld.provider.getDimension(), true));
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), getWorld(), focusWorld.provider.getDimension(), true));
}
}
@ -139,7 +138,7 @@ public class TileTeleposer extends TileInventory implements ITickable
{
for (Entity entity : focusWorldEntities)
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), focusWorld, worldObj.provider.getDimension(), true));
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), focusWorld, getWorld().provider.getDimension(), true));
}
}
}
@ -150,6 +149,6 @@ public class TileTeleposer extends TileInventory implements ITickable
private boolean canInitiateTeleport(TileTeleposer teleposer)
{
return teleposer.getStackInSlot(0) != null && teleposer.getStackInSlot(0).getItem() instanceof ItemTelepositionFocus && !Strings.isNullOrEmpty(((ItemTelepositionFocus) teleposer.getStackInSlot(0).getItem()).getOwnerName(teleposer.getStackInSlot(0)));
return !teleposer.getStackInSlot(0).isEmpty() && teleposer.getStackInSlot(0).getItem() instanceof ItemTelepositionFocus && !Strings.isNullOrEmpty(((ItemTelepositionFocus) teleposer.getStackInSlot(0).getItem()).getOwnerName(teleposer.getStackInSlot(0)));
}
}

View file

@ -49,7 +49,7 @@ public class ContainerAlchemyTable extends Container
if (slotId < 6 && slotId >= 0)
{
Slot slot = this.getSlot(slotId);
if (!slot.getHasStack() && inventoryPlayer.getItemStack() == null)
if (!slot.getHasStack() && inventoryPlayer.getItemStack().isEmpty())
{
((TileAlchemyTable) tileTable).toggleInputSlotAccessible(slotId);
}
@ -61,7 +61,7 @@ public class ContainerAlchemyTable extends Container
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
ItemStack itemstack = null;
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack())
@ -73,7 +73,7 @@ public class ContainerAlchemyTable extends Container
{
if (!this.mergeItemStack(itemstack1, 9, 9 + 36, true))
{
return null;
return ItemStack.EMPTY;
}
slot.onSlotChange(itemstack1, itemstack);
@ -83,31 +83,31 @@ public class ContainerAlchemyTable extends Container
{
if (!this.mergeItemStack(itemstack1, 7, 8, false)) //TODO: Add alchemy tools to list
{
return null;
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 0, 6, false))
{
return null;
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 9, 9 + 36, false))
{
return null;
return ItemStack.EMPTY;
}
if (itemstack1.stackSize == 0)
if (itemstack1.getCount() == 0)
{
slot.putStack(null);
slot.putStack(ItemStack.EMPTY);
} else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize)
if (itemstack1.getCount() == itemstack.getCount())
{
return null;
return ItemStack.EMPTY;
}
slot.onPickupFromSlot(playerIn, itemstack1);
slot.onTake(playerIn, itemstack1);
}
return itemstack;
@ -116,7 +116,7 @@ public class ContainerAlchemyTable extends Container
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileTable.isUseableByPlayer(playerIn);
return this.tileTable.isUsableByPlayer(playerIn);
}
private class SlotOrb extends Slot

View file

@ -98,7 +98,7 @@ public class ContainerItemRoutingNode extends Container
ItemStack copyStack = heldStack.copy();
GhostItemHelper.setItemGhostAmount(copyStack, 0);
copyStack.stackSize = 1;
copyStack.setCount(1);
slot.putStack(copyStack);
}
}
@ -124,7 +124,7 @@ public class ContainerItemRoutingNode extends Container
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
ItemStack itemstack = null;
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack())
@ -136,7 +136,7 @@ public class ContainerItemRoutingNode extends Container
{
if (!this.mergeItemStack(itemstack1, slotsOccupied, slotsOccupied + 36, true))
{
return null;
return ItemStack.EMPTY;
}
slot.onSlotChange(itemstack1, itemstack);
@ -147,28 +147,28 @@ public class ContainerItemRoutingNode extends Container
{
if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null;
return ItemStack.EMPTY;
}
}
} else if (!this.mergeItemStack(itemstack1, 0 + slotsOccupied, 36 + slotsOccupied, false))
} else if (!this.mergeItemStack(itemstack1, slotsOccupied, 36 + slotsOccupied, false))
{
return null;
return ItemStack.EMPTY;
}
if (itemstack1.stackSize == 0)
if (itemstack1.getCount() == 0)
{
slot.putStack(null);
slot.putStack(ItemStack.EMPTY);
} else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize)
if (itemstack1.getCount() == itemstack.getCount())
{
return null;
return ItemStack.EMPTY;
}
slot.onPickupFromSlot(playerIn, itemstack1);
slot.onTake(playerIn, itemstack1);
}
return itemstack;
@ -177,7 +177,7 @@ public class ContainerItemRoutingNode extends Container
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileItemRoutingNode.isUseableByPlayer(playerIn);
return this.tileItemRoutingNode.isUsableByPlayer(playerIn);
}
private class SlotItemFilter extends Slot

View file

@ -18,6 +18,6 @@ public class ContainerMasterRoutingNode extends Container
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileMasterRoutingNode.isUseableByPlayer(playerIn);
return this.tileMasterRoutingNode.isUsableByPlayer(playerIn);
}
}

View file

@ -41,7 +41,7 @@ public class ContainerSoulForge extends Container
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
ItemStack itemstack = null;
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack())
@ -53,7 +53,7 @@ public class ContainerSoulForge extends Container
{
if (!this.mergeItemStack(itemstack1, 6, 6 + 36, true))
{
return null;
return ItemStack.EMPTY;
}
slot.onSlotChange(itemstack1, itemstack);
@ -63,31 +63,31 @@ public class ContainerSoulForge extends Container
{
if (!this.mergeItemStack(itemstack1, 4, 5, false))
{
return null;
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 0, 4, false))
{
return null;
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 6, 42, false))
{
return null;
return ItemStack.EMPTY;
}
if (itemstack1.stackSize == 0)
if (itemstack1.getCount() == 0)
{
slot.putStack(null);
slot.putStack(ItemStack.EMPTY);
} else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize)
if (itemstack1.getCount() == itemstack.getCount())
{
return null;
return ItemStack.EMPTY;
}
slot.onPickupFromSlot(playerIn, itemstack1);
slot.onTake(playerIn, itemstack1);
}
return itemstack;
@ -96,7 +96,7 @@ public class ContainerSoulForge extends Container
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileForge.isUseableByPlayer(playerIn);
return this.tileForge.isUsableByPlayer(playerIn);
}
private class SlotSoul extends Slot

View file

@ -34,7 +34,7 @@ public class ContainerTeleposer extends Container
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
{
ItemStack stack = null;
ItemStack stack = ItemStack.EMPTY;
Slot slotObject = inventorySlots.get(slot);
int slots = inventorySlots.size();
@ -49,28 +49,28 @@ public class ContainerTeleposer extends Container
{
if (!this.mergeItemStack(stackInSlot, 0, slots, false))
{
return null;
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, false))
{
return null;
return ItemStack.EMPTY;
}
}
if (stackInSlot.stackSize == 0)
if (stackInSlot.getCount() == 0)
{
slotObject.putStack(null);
slotObject.putStack(ItemStack.EMPTY);
} else
{
slotObject.onSlotChanged();
}
if (stackInSlot.stackSize == stack.stackSize)
if (stackInSlot.getCount() == stack.getCount())
{
return null;
return ItemStack.EMPTY;
}
slotObject.onPickupFromSlot(player, stackInSlot);
slotObject.onTake(player, stackInSlot);
}
return stack;
@ -79,7 +79,7 @@ public class ContainerTeleposer extends Container
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return this.tileTeleposer.isUseableByPlayer(playerIn);
return this.tileTeleposer.isUsableByPlayer(playerIn);
}
private class SlotTeleposer extends Slot

View file

@ -32,7 +32,7 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
public void setGhostItemAmount(int ghostItemSlot, int amount)
{
ItemStack stack = itemInventory.getStackInSlot(ghostItemSlot);
if (stack != null)
if (!stack.isEmpty())
{
GhostItemHelper.setItemGhostAmount(stack, amount);
}
@ -70,10 +70,10 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
if (j == 0)
{
inventory[currentActiveSlot] = ItemStack.loadItemStackFromNBT(data);
inventory[currentActiveSlot] = new ItemStack(data);
} else if (j >= 1 && j < inventory.length + 1)
{
inventory[j - 1] = ItemStack.loadItemStackFromNBT(data);
inventory[j - 1] = new ItemStack(data);
}
}
}
@ -126,14 +126,14 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
public void incrementCurrentPriotiryToMaximum(int max)
{
priorities[currentActiveSlot] = Math.min(priorities[currentActiveSlot] + 1, max);
IBlockState state = worldObj.getBlockState(pos);
worldObj.notifyBlockUpdate(pos, state, state, 3);
IBlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(pos, state, state, 3);
}
public void decrementCurrentPriority()
{
priorities[currentActiveSlot] = Math.max(priorities[currentActiveSlot] - 1, 0);
IBlockState state = worldObj.getBlockState(pos);
worldObj.notifyBlockUpdate(pos, state, state, 3);
IBlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(pos, state, state, 3);
}
}

View file

@ -26,7 +26,7 @@ public class TileInputRoutingNode extends TileFilteredRoutingNode implements IIn
@Override
public IItemFilter getInputFilterForSide(EnumFacing side)
{
TileEntity tile = worldObj.getTileEntity(pos.offset(side));
TileEntity tile = getWorld().getTileEntity(pos.offset(side));
if (tile != null)
{
IItemHandler handler = Utils.getInventory(tile, side.getOpposite());
@ -34,7 +34,7 @@ public class TileInputRoutingNode extends TileFilteredRoutingNode implements IIn
{
ItemStack filterStack = this.getFilterStack(side);
if (filterStack == null || !(filterStack.getItem() instanceof IItemFilterProvider))
if (filterStack.isEmpty() || !(filterStack.getItem() instanceof IItemFilterProvider))
{
IItemFilter filter = new DefaultItemFilter();
filter.initializeFilter(null, tile, handler, false);

View file

@ -45,15 +45,15 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
@Override
public void update()
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
// currentInput = worldObj.isBlockIndirectlyGettingPowered(pos);
currentInput = worldObj.getStrongPower(pos);
// currentInput = getWorld().isBlockIndirectlyGettingPowered(pos);
currentInput = getWorld().getStrongPower(pos);
// System.out.println(currentInput);
}
if (worldObj.isRemote || worldObj.getTotalWorldTime() % tickRate != 0) //Temporary tick rate solver
if (getWorld().isRemote || getWorld().getTotalWorldTime() % tickRate != 0) //Temporary tick rate solver
{
return;
}
@ -62,7 +62,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
for (BlockPos outputPos : outputNodeList)
{
TileEntity outputTile = worldObj.getTileEntity(outputPos);
TileEntity outputTile = getWorld().getTileEntity(outputPos);
if (outputTile instanceof IOutputItemRoutingNode && this.isConnected(new LinkedList<BlockPos>(), outputPos))
{
IOutputItemRoutingNode outputNode = (IOutputItemRoutingNode) outputTile;
@ -96,7 +96,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
for (BlockPos inputPos : inputNodeList)
{
TileEntity inputTile = worldObj.getTileEntity(inputPos);
TileEntity inputTile = getWorld().getTileEntity(inputPos);
if (inputTile instanceof IInputItemRoutingNode && this.isConnected(new LinkedList<BlockPos>(), inputPos))
{
IInputItemRoutingNode inputNode = (IInputItemRoutingNode) inputTile;
@ -126,7 +126,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
}
int maxTransfer = this.getMaxTransferForDemonWill(WorldDemonWillHandler.getCurrentWill(worldObj, pos, EnumDemonWillType.DEFAULT));
int maxTransfer = this.getMaxTransferForDemonWill(WorldDemonWillHandler.getCurrentWill(getWorld(), pos, EnumDemonWillType.DEFAULT));
for (Entry<Integer, List<IItemFilter>> outputEntry : outputMap.entrySet())
{
@ -231,7 +231,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
// {
// return false;
// }
TileEntity tile = worldObj.getTileEntity(nodePos);
TileEntity tile = getWorld().getTileEntity(nodePos);
if (!(tile instanceof IRoutingNode))
{
// connectionMap.remove(nodePos);
@ -254,7 +254,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
// path.clear();
// path.addAll(testPath);
return true;
} else if (NodeHelper.isNodeConnectionEnabled(worldObj, node, testPos))
} else if (NodeHelper.isNodeConnectionEnabled(getWorld(), node, testPos))
{
if (isConnected(path, testPos))
{
@ -401,7 +401,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
while (itr.hasNext())
{
BlockPos testPos = itr.next();
TileEntity tile = worldObj.getTileEntity(testPos);
TileEntity tile = getWorld().getTileEntity(testPos);
if (tile instanceof IRoutingNode)
{
((IRoutingNode) tile).removeConnection(pos);

View file

@ -26,7 +26,7 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
@Override
public IItemFilter getOutputFilterForSide(EnumFacing side)
{
TileEntity tile = worldObj.getTileEntity(pos.offset(side));
TileEntity tile = getWorld().getTileEntity(pos.offset(side));
if (tile != null)
{
IItemHandler handler = Utils.getInventory(tile, side.getOpposite());
@ -34,7 +34,7 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
{
ItemStack filterStack = this.getFilterStack(side);
if (filterStack == null || !(filterStack.getItem() instanceof IItemFilterProvider))
if (filterStack.isEmpty() || !(filterStack.getItem() instanceof IItemFilterProvider))
{
IItemFilter filter = new DefaultItemFilter();
filter.initializeFilter(null, tile, handler, true);

View file

@ -30,10 +30,10 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
@Override
public void update()
{
if (!worldObj.isRemote)
if (!getWorld().isRemote)
{
currentInput = worldObj.isBlockIndirectlyGettingPowered(pos);
// currentInput = worldObj.getStrongPower(pos);
currentInput = getWorld().isBlockIndirectlyGettingPowered(pos);
// currentInput = getWorld().getStrongPower(pos);
}
}
@ -83,14 +83,14 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
@Override
public void removeAllConnections()
{
TileEntity testTile = worldObj.getTileEntity(getMasterPos());
TileEntity testTile = getWorld().getTileEntity(getMasterPos());
if (testTile instanceof IMasterRoutingNode)
{
((IMasterRoutingNode) testTile).removeConnection(pos); // Remove this node from the master
}
for (BlockPos testPos : connectionList)
{
TileEntity tile = worldObj.getTileEntity(testPos);
TileEntity tile = getWorld().getTileEntity(testPos);
if (tile instanceof IRoutingNode)
{
((IRoutingNode) tile).removeConnection(pos);