Run code formatter
🦀 Way is gone 🦀
This commit is contained in:
parent
7c1565a68c
commit
53b6030ba9
77 changed files with 1289 additions and 2232 deletions
|
@ -17,8 +17,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray
|
||||
{
|
||||
public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray {
|
||||
public boolean isActive = false;
|
||||
public int activeCounter = 0;
|
||||
public EnumFacing rotation = EnumFacing.HORIZONTALS[0];
|
||||
|
@ -28,22 +27,18 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
public AlchemyArrayEffect arrayEffect;
|
||||
private boolean doDropIngredients = true;
|
||||
|
||||
public TileAlchemyArray()
|
||||
{
|
||||
public TileAlchemyArray() {
|
||||
super(2, "alchemyArray");
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(IBlockState state, Entity entity)
|
||||
{
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(IBlockState state, Entity entity) {
|
||||
if (arrayEffect != null) {
|
||||
arrayEffect.onEntityCollidedWithBlock(this, getWorld(), pos, state, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tagCompound) {
|
||||
super.deserialize(tagCompound);
|
||||
this.isActive = tagCompound.getBoolean("isActive");
|
||||
this.activeCounter = tagCompound.getInteger("activeCounter");
|
||||
|
@ -51,23 +46,20 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
if (!tagCompound.hasKey("doDropIngredients")) //Check if the array is old
|
||||
{
|
||||
this.doDropIngredients = true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
this.doDropIngredients = tagCompound.getBoolean("doDropIngredients");
|
||||
}
|
||||
this.rotation = EnumFacing.HORIZONTALS[tagCompound.getInteger(Constants.NBT.DIRECTION)];
|
||||
|
||||
NBTTagCompound arrayTag = tagCompound.getCompoundTag("arrayTag");
|
||||
arrayEffect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(key);
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
arrayEffect.readFromNBT(arrayTag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
|
||||
super.serialize(tagCompound);
|
||||
tagCompound.setBoolean("isActive", isActive);
|
||||
tagCompound.setInteger("activeCounter", activeCounter);
|
||||
|
@ -76,8 +68,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
tagCompound.setInteger(Constants.NBT.DIRECTION, rotation.getHorizontalIndex());
|
||||
|
||||
NBTTagCompound arrayTag = new NBTTagCompound();
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
arrayEffect.writeToNBT(arrayTag);
|
||||
}
|
||||
tagCompound.setTag("arrayTag", arrayTag);
|
||||
|
@ -86,25 +77,20 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Use this to prevent the Array from dropping items - useful for arrays that need to "consume" ingredients well before the effect.
|
||||
public void setItemDrop(boolean dropItems)
|
||||
{
|
||||
public void setItemDrop(boolean dropItems) {
|
||||
this.doDropIngredients = dropItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (isActive && attemptCraft())
|
||||
{
|
||||
public void update() {
|
||||
if (isActive && attemptCraft()) {
|
||||
activeCounter++;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
isActive = false;
|
||||
doDropIngredients = true;
|
||||
activeCounter = 0;
|
||||
|
@ -119,61 +105,48 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
* This occurs when the block is destroyed.
|
||||
*/
|
||||
@Override
|
||||
public void dropItems()
|
||||
{
|
||||
if (arrayEffect == null || doDropIngredients)
|
||||
{
|
||||
public void dropItems() {
|
||||
if (arrayEffect == null || doDropIngredients) {
|
||||
super.dropItems();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attemptCraft()
|
||||
{
|
||||
public boolean attemptCraft() {
|
||||
AlchemyArrayEffect effect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(this.getStackInSlot(0), this.getStackInSlot(1));
|
||||
if (effect != null)
|
||||
{
|
||||
if (arrayEffect == null)
|
||||
{
|
||||
if (effect != null) {
|
||||
if (arrayEffect == null) {
|
||||
arrayEffect = effect;
|
||||
key = effect.getKey();
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
String effectKey = effect.getKey();
|
||||
if (effectKey.equals(key))
|
||||
{
|
||||
if (effectKey.equals(key)) {
|
||||
//Good! Moving on.
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
//Something has changed, therefore we have to move our stuffs.
|
||||
//TODO: Add an AlchemyArrayEffect.onBreak(); ?
|
||||
arrayEffect = effect;
|
||||
key = effect.getKey();
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
RecipeAlchemyArray recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArray(getStackInSlot(0), getStackInSlot(1));
|
||||
if (recipe == null)
|
||||
return false;
|
||||
|
||||
AlchemyArrayEffect newEffect = new AlchemyArrayEffectCraftingNew(recipe);
|
||||
if (arrayEffect == null)
|
||||
{
|
||||
if (arrayEffect == null) {
|
||||
arrayEffect = newEffect;
|
||||
key = newEffect.key;
|
||||
} else if (!newEffect.key.equals(key))
|
||||
{
|
||||
} else if (!newEffect.key.equals(key)) {
|
||||
arrayEffect = newEffect;
|
||||
key = newEffect.key;
|
||||
}
|
||||
}
|
||||
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
isActive = true;
|
||||
|
||||
if (arrayEffect.update(this, this.activeCounter))
|
||||
{
|
||||
if (arrayEffect.update(this, this.activeCounter)) {
|
||||
this.decrStackSize(0, 1);
|
||||
this.decrStackSize(1, 1);
|
||||
this.getWorld().setBlockToAir(getPos());
|
||||
|
@ -186,20 +159,17 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getRotation()
|
||||
{
|
||||
public EnumFacing getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(EnumFacing rotation)
|
||||
{
|
||||
public void setRotation(EnumFacing rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
{
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return Block.FULL_BLOCK_AABB.offset(getPos());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.apache.commons.lang3.ArrayUtils;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileAlchemyTable extends TileInventory implements ISidedInventory, ITickable
|
||||
{
|
||||
public class TileAlchemyTable extends TileInventory implements ISidedInventory, ITickable {
|
||||
public static final int orbSlot = 6;
|
||||
public static final int toolSlot = 7;
|
||||
public static final int outputSlot = 8;
|
||||
|
@ -41,43 +40,36 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
public int ticksRequired = 1;
|
||||
|
||||
public BlockPos connectedPos = BlockPos.ORIGIN;
|
||||
public boolean[] blockedSlots = new boolean[] { false, false, false, false, false, false };
|
||||
public boolean[] blockedSlots = new boolean[]{false, false, false, false, false, false};
|
||||
|
||||
public TileAlchemyTable()
|
||||
{
|
||||
public TileAlchemyTable() {
|
||||
super(9, "alchemyTable");
|
||||
}
|
||||
|
||||
public void setInitialTableParameters(EnumFacing direction, boolean isSlave, BlockPos connectedPos)
|
||||
{
|
||||
public void setInitialTableParameters(EnumFacing direction, boolean isSlave, BlockPos connectedPos) {
|
||||
this.isSlave = isSlave;
|
||||
this.connectedPos = connectedPos;
|
||||
|
||||
if (!isSlave)
|
||||
{
|
||||
if (!isSlave) {
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInvisible()
|
||||
{
|
||||
public boolean isInvisible() {
|
||||
return isSlave();
|
||||
}
|
||||
|
||||
public boolean isInputSlotAccessible(int slot)
|
||||
{
|
||||
public boolean isInputSlotAccessible(int slot) {
|
||||
return !(slot < 6 && slot >= 0) || !blockedSlots[slot];
|
||||
}
|
||||
|
||||
public void toggleInputSlotAccessible(int slot)
|
||||
{
|
||||
public void toggleInputSlotAccessible(int slot) {
|
||||
if (slot < 6 && slot >= 0)
|
||||
blockedSlots[slot] = !blockedSlots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
super.deserialize(tag);
|
||||
|
||||
isSlave = tag.getBoolean("isSlave");
|
||||
|
@ -93,8 +85,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
super.serialize(tag);
|
||||
|
||||
tag.setBoolean("isSlave", isSlave);
|
||||
|
@ -116,19 +107,14 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
|
||||
{
|
||||
if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
{
|
||||
if (this.isSlave())
|
||||
{
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
if (this.isSlave()) {
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave)
|
||||
{
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) {
|
||||
return (T) tile.getCapability(capability, facing);
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
}
|
||||
|
@ -137,89 +123,70 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case DOWN:
|
||||
return new int[] { outputSlot };
|
||||
case UP:
|
||||
return new int[] { orbSlot, toolSlot };
|
||||
default:
|
||||
return new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return new int[]{outputSlot};
|
||||
case UP:
|
||||
return new int[]{orbSlot, toolSlot};
|
||||
default:
|
||||
return new int[]{0, 1, 2, 3, 4, 5};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case DOWN:
|
||||
return index != outputSlot && index != orbSlot && index != toolSlot;
|
||||
case UP:
|
||||
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
return true;
|
||||
} else if (index == toolSlot)
|
||||
{
|
||||
return false; //TODO:
|
||||
} else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
if (this.isSlave)
|
||||
{
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave)
|
||||
{
|
||||
return ((TileAlchemyTable) tile).canInsertItem(index, stack, direction);
|
||||
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
switch (direction) {
|
||||
case DOWN:
|
||||
return index != outputSlot && index != orbSlot && index != toolSlot;
|
||||
case UP:
|
||||
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb) {
|
||||
return true;
|
||||
} else if (index == toolSlot) {
|
||||
return false; //TODO:
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return getAccessibleInputSlots(direction).contains(index);
|
||||
default:
|
||||
if (this.isSlave) {
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) {
|
||||
return ((TileAlchemyTable) tile).canInsertItem(index, stack, direction);
|
||||
}
|
||||
}
|
||||
return getAccessibleInputSlots(direction).contains(index);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case DOWN:
|
||||
return index == outputSlot;
|
||||
case UP:
|
||||
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
return true;
|
||||
} else if (index == toolSlot)
|
||||
{
|
||||
return true; //TODO:
|
||||
} else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
if (this.isSlave)
|
||||
{
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave)
|
||||
{
|
||||
return ((TileAlchemyTable) tile).canExtractItem(index, stack, direction);
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
switch (direction) {
|
||||
case DOWN:
|
||||
return index == outputSlot;
|
||||
case UP:
|
||||
if (index == orbSlot && !stack.isEmpty() && stack.getItem() instanceof IBloodOrb) {
|
||||
return true;
|
||||
} else if (index == toolSlot) {
|
||||
return true; //TODO:
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return getAccessibleInputSlots(direction).contains(index);
|
||||
default:
|
||||
if (this.isSlave) {
|
||||
TileEntity tile = getWorld().getTileEntity(connectedPos);
|
||||
if (tile instanceof TileAlchemyTable && !((TileAlchemyTable) tile).isSlave) {
|
||||
return ((TileAlchemyTable) tile).canExtractItem(index, stack, direction);
|
||||
}
|
||||
}
|
||||
return getAccessibleInputSlots(direction).contains(index);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getAccessibleInputSlots(EnumFacing direction)
|
||||
{
|
||||
public List<Integer> getAccessibleInputSlots(EnumFacing direction) {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (isInputSlotAccessible(i))
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (isInputSlotAccessible(i)) {
|
||||
list.add(i);
|
||||
}
|
||||
}
|
||||
|
@ -228,19 +195,15 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (isSlave())
|
||||
{
|
||||
public void update() {
|
||||
if (isSlave()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> inputList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (!getStackInSlot(i).isEmpty())
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (!getStackInSlot(i).isEmpty()) {
|
||||
inputList.add(getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
@ -249,31 +212,24 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
|
||||
// special recipes like dying
|
||||
AlchemyTableRecipe recipe = AlchemyTableRecipeRegistry.getMatchingRecipe(inputList, getWorld(), getPos());
|
||||
if (recipe != null && (burnTime > 0 || (!getWorld().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)
|
||||
notifyUpdate();
|
||||
|
||||
if (canCraft(recipe.getRecipeOutput(inputList)))
|
||||
{
|
||||
if (canCraft(recipe.getRecipeOutput(inputList))) {
|
||||
ticksRequired = recipe.getTicksRequired();
|
||||
burnTime++;
|
||||
|
||||
if (burnTime == ticksRequired)
|
||||
{
|
||||
if (!getWorld().isRemote)
|
||||
{
|
||||
if (burnTime == ticksRequired) {
|
||||
if (!getWorld().isRemote) {
|
||||
int requiredLp = recipe.getLpDrained();
|
||||
if (requiredLp > 0)
|
||||
{
|
||||
if (!getWorld().isRemote)
|
||||
{
|
||||
if (requiredLp > 0) {
|
||||
if (!getWorld().isRemote) {
|
||||
consumeLp(requiredLp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!getWorld().isRemote)
|
||||
{
|
||||
if (!getWorld().isRemote) {
|
||||
craftItem(inputList, recipe);
|
||||
}
|
||||
}
|
||||
|
@ -282,34 +238,25 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
|
||||
IBlockState state = getWorld().getBlockState(pos);
|
||||
getWorld().notifyBlockUpdate(getPos(), state, state, 3);
|
||||
} else if (burnTime > ticksRequired + 10)
|
||||
{
|
||||
} else if (burnTime > ticksRequired + 10) {
|
||||
burnTime = 0;
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
burnTime = 0;
|
||||
}
|
||||
} else
|
||||
{ // Simple recipes
|
||||
} else { // Simple recipes
|
||||
RecipeAlchemyTable recipeAlchemyTable = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyTable(inputList);
|
||||
if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon())))
|
||||
{
|
||||
if (recipeAlchemyTable != null && (burnTime > 0 || (!getWorld().isRemote && tier >= recipeAlchemyTable.getMinimumTier() && getContainedLp() >= recipeAlchemyTable.getSyphon()))) {
|
||||
if (burnTime == 1)
|
||||
notifyUpdate();
|
||||
|
||||
if (canCraft(recipeAlchemyTable.getOutput()))
|
||||
{
|
||||
if (canCraft(recipeAlchemyTable.getOutput())) {
|
||||
ticksRequired = recipeAlchemyTable.getTicks();
|
||||
burnTime++;
|
||||
if (burnTime >= ticksRequired)
|
||||
{
|
||||
if (!getWorld().isRemote)
|
||||
{
|
||||
if (recipeAlchemyTable.getSyphon() > 0)
|
||||
{
|
||||
if (consumeLp(recipeAlchemyTable.getSyphon()) < recipeAlchemyTable.getSyphon())
|
||||
{
|
||||
if (burnTime >= ticksRequired) {
|
||||
if (!getWorld().isRemote) {
|
||||
if (recipeAlchemyTable.getSyphon() > 0) {
|
||||
if (consumeLp(recipeAlchemyTable.getSyphon()) < recipeAlchemyTable.getSyphon()) {
|
||||
//There was not enough LP to craft or there was no orb
|
||||
burnTime = 0;
|
||||
notifyUpdate();
|
||||
|
@ -330,8 +277,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
else
|
||||
outputSlotStack.grow(event.getOutput().getCount());
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ItemStack currentStack = getStackInSlot(i);
|
||||
if (currentStack.getItem().hasContainerItem(currentStack))
|
||||
setInventorySlotContents(i, currentStack.getItem().getContainerItem(currentStack));
|
||||
|
@ -346,20 +292,17 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
burnTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double getProgressForGui()
|
||||
{
|
||||
public double getProgressForGui() {
|
||||
return ((double) burnTime) / ticksRequired;
|
||||
}
|
||||
|
||||
private boolean canCraft(ItemStack output)
|
||||
{
|
||||
private boolean canCraft(ItemStack output) {
|
||||
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
||||
if (output.isEmpty())
|
||||
return false;
|
||||
|
@ -371,13 +314,10 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize();
|
||||
}
|
||||
|
||||
public int getTierOfOrb()
|
||||
{
|
||||
public int getTierOfOrb() {
|
||||
ItemStack orbStack = getStackInSlot(orbSlot);
|
||||
if (!orbStack.isEmpty())
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (!orbStack.isEmpty()) {
|
||||
if (orbStack.getItem() instanceof IBloodOrb) {
|
||||
BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack);
|
||||
return orb == null ? 0 : orb.getTier();
|
||||
}
|
||||
|
@ -386,16 +326,12 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
return 0;
|
||||
}
|
||||
|
||||
public int getContainedLp()
|
||||
{
|
||||
public int getContainedLp() {
|
||||
ItemStack orbStack = getStackInSlot(orbSlot);
|
||||
if (!orbStack.isEmpty())
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (!orbStack.isEmpty()) {
|
||||
if (orbStack.getItem() instanceof IBloodOrb) {
|
||||
Binding binding = ((IBindable) orbStack.getItem()).getBinding(orbStack);
|
||||
if (binding == null)
|
||||
{
|
||||
if (binding == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -408,11 +344,9 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void craftItem(List<ItemStack> inputList, AlchemyTableRecipe recipe)
|
||||
{
|
||||
public void craftItem(List<ItemStack> inputList, AlchemyTableRecipe recipe) {
|
||||
ItemStack outputStack = recipe.getRecipeOutput(inputList);
|
||||
if (this.canCraft(outputStack))
|
||||
{
|
||||
if (this.canCraft(outputStack)) {
|
||||
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
||||
|
||||
ItemStack[] inputs = new ItemStack[0];
|
||||
|
@ -423,11 +357,9 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
MinecraftForge.EVENT_BUS.post(event);
|
||||
outputStack = event.getOutput();
|
||||
|
||||
if (currentOutputStack.isEmpty())
|
||||
{
|
||||
if (currentOutputStack.isEmpty()) {
|
||||
setInventorySlotContents(outputSlot, outputStack);
|
||||
} else if (ItemHandlerHelper.canItemStacksStack(outputStack, currentOutputStack))
|
||||
{
|
||||
} else if (ItemHandlerHelper.canItemStacksStack(outputStack, currentOutputStack)) {
|
||||
currentOutputStack.grow(outputStack.getCount());
|
||||
}
|
||||
|
||||
|
@ -435,16 +367,12 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
}
|
||||
}
|
||||
|
||||
public int consumeLp(int requested)
|
||||
{
|
||||
public int consumeLp(int requested) {
|
||||
ItemStack orbStack = getStackInSlot(orbSlot);
|
||||
|
||||
if (!orbStack.isEmpty())
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (NetworkHelper.syphonFromContainer(orbStack, SoulTicket.item(orbStack, world, pos, requested)))
|
||||
{
|
||||
if (!orbStack.isEmpty()) {
|
||||
if (orbStack.getItem() instanceof IBloodOrb) {
|
||||
if (NetworkHelper.syphonFromContainer(orbStack, SoulTicket.item(orbStack, world, pos, requested))) {
|
||||
return requested;
|
||||
}
|
||||
}
|
||||
|
@ -453,64 +381,52 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void consumeInventory(AlchemyTableRecipe recipe)
|
||||
{
|
||||
public void consumeInventory(AlchemyTableRecipe recipe) {
|
||||
ItemStack[] input = new ItemStack[6];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
input[i] = getStackInSlot(i);
|
||||
}
|
||||
|
||||
ItemStack[] result = recipe.getRemainingItems(input);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
setInventorySlotContents(i, result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public EnumFacing getDirection()
|
||||
{
|
||||
public EnumFacing getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public boolean isSlave()
|
||||
{
|
||||
public boolean isSlave() {
|
||||
return isSlave;
|
||||
}
|
||||
|
||||
public int getBurnTime()
|
||||
{
|
||||
public int getBurnTime() {
|
||||
return burnTime;
|
||||
}
|
||||
|
||||
public int getTicksRequired()
|
||||
{
|
||||
public int getTicksRequired() {
|
||||
return ticksRequired;
|
||||
}
|
||||
|
||||
public BlockPos getConnectedPos()
|
||||
{
|
||||
public BlockPos getConnectedPos() {
|
||||
return connectedPos;
|
||||
}
|
||||
|
||||
public boolean[] getBlockedSlots()
|
||||
{
|
||||
public boolean[] getBlockedSlots() {
|
||||
return blockedSlots;
|
||||
}
|
||||
|
||||
public static int getOrbSlot()
|
||||
{
|
||||
public static int getOrbSlot() {
|
||||
return orbSlot;
|
||||
}
|
||||
|
||||
public static int getToolSlot()
|
||||
{
|
||||
public static int getToolSlot() {
|
||||
return toolSlot;
|
||||
}
|
||||
|
||||
public static int getOutputSlot()
|
||||
{
|
||||
public static int getOutputSlot() {
|
||||
return outputSlot;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class TileDemonCrystal extends TileTicking
|
||||
{
|
||||
public class TileDemonCrystal extends TileTicking {
|
||||
public static final double sameWillConversionRate = 50;
|
||||
public static final double defaultWillConversionRate = 100;
|
||||
public static final double timeDelayForWrongWill = 0.6;
|
||||
|
@ -25,45 +24,35 @@ public class TileDemonCrystal extends TileTicking
|
|||
public int crystalCount = 1;
|
||||
public EnumFacing placement = EnumFacing.UP; //Side that this crystal is placed on.
|
||||
|
||||
public TileDemonCrystal()
|
||||
{
|
||||
public TileDemonCrystal() {
|
||||
this.crystalCount = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if (getWorld().isRemote)
|
||||
{
|
||||
public void onUpdate() {
|
||||
if (getWorld().isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
internalCounter++;
|
||||
|
||||
if (internalCounter % 20 == 0 && crystalCount < 7)
|
||||
{
|
||||
if (internalCounter % 20 == 0 && crystalCount < 7) {
|
||||
EnumDemonWillType type = getType();
|
||||
|
||||
double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
|
||||
if (type != EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
if (value >= 0.5)
|
||||
{
|
||||
if (type != EnumDemonWillType.DEFAULT) {
|
||||
if (value >= 0.5) {
|
||||
double nextProgress = getCrystalGrowthPerSecond(value);
|
||||
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, EnumDemonWillType.DEFAULT);
|
||||
if (value > 0.5)
|
||||
{
|
||||
if (value > 0.5) {
|
||||
double nextProgress = getCrystalGrowthPerSecond(value) * timeDelayForWrongWill;
|
||||
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), EnumDemonWillType.DEFAULT, nextProgress * defaultWillConversionRate, true) / defaultWillConversionRate;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (value > 0.5)
|
||||
{
|
||||
} else {
|
||||
if (value > 0.5) {
|
||||
|
||||
double nextProgress = getCrystalGrowthPerSecond(value);
|
||||
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
|
||||
|
@ -84,17 +73,14 @@ public class TileDemonCrystal extends TileTicking
|
|||
* Encourages the crystal to grow by a large percentage by telling it to
|
||||
* drain will from the aura.
|
||||
*
|
||||
* @param willDrain
|
||||
* The amount of drain that is needed for the crystal to grow
|
||||
* successfully for the desired amount. Can be more than the base
|
||||
* amount.
|
||||
* @param willDrain The amount of drain that is needed for the crystal to grow
|
||||
* successfully for the desired amount. Can be more than the base
|
||||
* amount.
|
||||
* @param progressPercentage
|
||||
* @return percentage actually grown.
|
||||
*/
|
||||
public double growCrystalWithWillAmount(double willDrain, double progressPercentage)
|
||||
{
|
||||
if (crystalCount >= 7)
|
||||
{
|
||||
public double growCrystalWithWillAmount(double willDrain, double progressPercentage) {
|
||||
if (crystalCount >= 7) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -104,8 +90,7 @@ public class TileDemonCrystal extends TileTicking
|
|||
|
||||
double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
|
||||
double percentDrain = willDrain <= 0 ? 1 : Math.min(1, value / willDrain);
|
||||
if (percentDrain <= 0)
|
||||
{
|
||||
if (percentDrain <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -118,15 +103,12 @@ public class TileDemonCrystal extends TileTicking
|
|||
return percentDrain * progressPercentage;
|
||||
}
|
||||
|
||||
public EnumDemonWillType getType()
|
||||
{
|
||||
public EnumDemonWillType getType() {
|
||||
return EnumDemonWillType.values()[this.getBlockMetadata()];
|
||||
}
|
||||
|
||||
public void checkAndGrowCrystal()
|
||||
{
|
||||
if (progressToNextCrystal >= 1 && internalCounter % 100 == 0)
|
||||
{
|
||||
public void checkAndGrowCrystal() {
|
||||
if (progressToNextCrystal >= 1 && internalCounter % 100 == 0) {
|
||||
progressToNextCrystal--;
|
||||
crystalCount++;
|
||||
markDirty();
|
||||
|
@ -134,20 +116,16 @@ public class TileDemonCrystal extends TileTicking
|
|||
}
|
||||
}
|
||||
|
||||
public double getMaxWillForCrystal()
|
||||
{
|
||||
public double getMaxWillForCrystal() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
public boolean dropSingleCrystal()
|
||||
{
|
||||
if (!getWorld().isRemote && crystalCount > 1)
|
||||
{
|
||||
public boolean dropSingleCrystal() {
|
||||
if (!getWorld().isRemote && crystalCount > 1) {
|
||||
IBlockState state = getWorld().getBlockState(pos);
|
||||
EnumDemonWillType type = state.getValue(BlockDemonCrystal.TYPE);
|
||||
ItemStack stack = BlockDemonCrystal.getItemStackDropped(type, 1);
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
if (!stack.isEmpty()) {
|
||||
crystalCount--;
|
||||
InventoryHelper.spawnItemStack(getWorld(), pos.getX(), pos.getY(), pos.getZ(), stack);
|
||||
notifyUpdate();
|
||||
|
@ -158,19 +136,16 @@ public class TileDemonCrystal extends TileTicking
|
|||
return false;
|
||||
}
|
||||
|
||||
public double getCrystalGrowthPerSecond(double will)
|
||||
{
|
||||
public double getCrystalGrowthPerSecond(double will) {
|
||||
return 1.0 / 200 * Math.sqrt(will / 200);
|
||||
}
|
||||
|
||||
public int getCrystalCountForRender()
|
||||
{
|
||||
public int getCrystalCountForRender() {
|
||||
return MathHelper.clamp(crystalCount - 1, 0, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
holder.readFromNBT(tag, "Will");
|
||||
crystalCount = tag.getInteger("crystalCount");
|
||||
placement = EnumFacing.byIndex(tag.getInteger("placement"));
|
||||
|
@ -178,8 +153,7 @@ public class TileDemonCrystal extends TileTicking
|
|||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
holder.writeToNBT(tag, "Will");
|
||||
tag.setInteger("crystalCount", crystalCount);
|
||||
tag.setInteger("placement", placement.getIndex());
|
||||
|
@ -187,23 +161,19 @@ public class TileDemonCrystal extends TileTicking
|
|||
return tag;
|
||||
}
|
||||
|
||||
public int getCrystalCount()
|
||||
{
|
||||
public int getCrystalCount() {
|
||||
return crystalCount;
|
||||
}
|
||||
|
||||
public void setCrystalCount(int crystalCount)
|
||||
{
|
||||
public void setCrystalCount(int crystalCount) {
|
||||
this.crystalCount = crystalCount;
|
||||
}
|
||||
|
||||
public EnumFacing getPlacement()
|
||||
{
|
||||
public EnumFacing getPlacement() {
|
||||
return placement;
|
||||
}
|
||||
|
||||
public void setPlacement(EnumFacing placement)
|
||||
{
|
||||
public void setPlacement(EnumFacing placement) {
|
||||
this.placement = placement;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
|||
import WayofTime.bloodmagic.soul.IDemonWillConduit;
|
||||
import WayofTime.bloodmagic.tile.base.TileTicking;
|
||||
|
||||
public class TileDemonCrystallizer extends TileTicking implements IDemonWillConduit
|
||||
{
|
||||
public class TileDemonCrystallizer extends TileTicking implements IDemonWillConduit {
|
||||
public static final int maxWill = 100;
|
||||
public static final double drainRate = 1;
|
||||
public static final double willToFormCrystal = 99;
|
||||
|
@ -21,16 +20,13 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
public DemonWillHolder holder = new DemonWillHolder();
|
||||
public double internalCounter = 0;
|
||||
|
||||
public TileDemonCrystallizer()
|
||||
{
|
||||
public TileDemonCrystallizer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if (getWorld().isRemote)
|
||||
{
|
||||
public void onUpdate() {
|
||||
if (getWorld().isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -39,15 +35,11 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
{
|
||||
EnumDemonWillType highestType = WorldDemonWillHandler.getHighestDemonWillType(getWorld(), pos);
|
||||
double amount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, highestType);
|
||||
if (amount >= willToFormCrystal)
|
||||
{
|
||||
if (amount >= willToFormCrystal) {
|
||||
internalCounter += getCrystalFormationRate(amount);
|
||||
if (internalCounter >= totalFormationTime)
|
||||
{
|
||||
if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal)
|
||||
{
|
||||
if (formCrystal(highestType, offsetPos))
|
||||
{
|
||||
if (internalCounter >= totalFormationTime) {
|
||||
if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal) {
|
||||
if (formCrystal(highestType, offsetPos)) {
|
||||
WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, true);
|
||||
internalCounter = 0;
|
||||
}
|
||||
|
@ -57,12 +49,10 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
}
|
||||
}
|
||||
|
||||
public boolean formCrystal(EnumDemonWillType type, BlockPos position)
|
||||
{
|
||||
public boolean formCrystal(EnumDemonWillType type, BlockPos position) {
|
||||
getWorld().setBlockState(position, RegistrarBloodMagicBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()));
|
||||
TileEntity tile = getWorld().getTileEntity(position);
|
||||
if (tile instanceof TileDemonCrystal)
|
||||
{
|
||||
if (tile instanceof TileDemonCrystal) {
|
||||
((TileDemonCrystal) tile).setPlacement(EnumFacing.UP);
|
||||
return true;
|
||||
}
|
||||
|
@ -70,21 +60,18 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
return false;
|
||||
}
|
||||
|
||||
public double getCrystalFormationRate(double currentWill)
|
||||
{
|
||||
public double getCrystalFormationRate(double currentWill) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
holder.readFromNBT(tag, "Will");
|
||||
internalCounter = tag.getDouble("internalCounter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
holder.writeToNBT(tag, "Will");
|
||||
tag.setDouble("internalCounter", internalCounter);
|
||||
return tag;
|
||||
|
@ -93,26 +80,21 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
// IDemonWillConduit
|
||||
|
||||
@Override
|
||||
public int getWeight()
|
||||
{
|
||||
public int getWeight() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill) {
|
||||
if (amount <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!canFill(type))
|
||||
{
|
||||
if (!canFill(type)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!doFill)
|
||||
{
|
||||
if (!doFill) {
|
||||
return Math.min(maxWill - holder.getWill(type), amount);
|
||||
}
|
||||
|
||||
|
@ -120,17 +102,14 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
}
|
||||
|
||||
@Override
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain)
|
||||
{
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain) {
|
||||
double drained = amount;
|
||||
double current = holder.getWill(type);
|
||||
if (current < drained)
|
||||
{
|
||||
if (current < drained) {
|
||||
drained = current;
|
||||
}
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
if (doDrain) {
|
||||
return holder.drainWill(type, amount);
|
||||
}
|
||||
|
||||
|
@ -138,20 +117,17 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumDemonWillType type)
|
||||
{
|
||||
public boolean canFill(EnumDemonWillType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumDemonWillType type)
|
||||
{
|
||||
public boolean canDrain(EnumDemonWillType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentWill(EnumDemonWillType type)
|
||||
{
|
||||
public double getCurrentWill(EnumDemonWillType type) {
|
||||
return holder.getWill(type);
|
||||
}
|
||||
}
|
|
@ -42,7 +42,7 @@ public class TileMimic extends TileInventory implements ITickable {
|
|||
public NBTTagCompound tileTag = new NBTTagCompound();
|
||||
public TileEntity mimicedTile = null;
|
||||
IBlockState stateOfReplacedBlock = Blocks.AIR.getDefaultState();
|
||||
|
||||
|
||||
public int playerCheckRadius = 5;
|
||||
public int potionSpawnRadius = 5;
|
||||
public int potionSpawnInterval = 40;
|
||||
|
@ -137,7 +137,7 @@ public class TileMimic extends TileInventory implements ITickable {
|
|||
|
||||
Utils.insertItemToTile(this, player, 0);
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
if(stateOfReplacedBlock == Blocks.AIR.getDefaultState()) {
|
||||
if (stateOfReplacedBlock == Blocks.AIR.getDefaultState()) {
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
stateOfReplacedBlock = block.getDefaultState();
|
||||
|
@ -273,7 +273,7 @@ public class TileMimic extends TileInventory implements ITickable {
|
|||
tag.setInteger("playerCheckRadius", playerCheckRadius);
|
||||
tag.setInteger("potionSpawnRadius", potionSpawnRadius);
|
||||
tag.setInteger("potionSpawnInterval", potionSpawnInterval);
|
||||
tag.setString("stateOfReplacedBlock",stateOfReplacedBlock.toString());
|
||||
tag.setString("stateOfReplacedBlock", stateOfReplacedBlock.toString());
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
@ -296,11 +296,11 @@ public class TileMimic extends TileInventory implements ITickable {
|
|||
public IBlockState getReplacedState() {
|
||||
return stateOfReplacedBlock;
|
||||
}
|
||||
|
||||
|
||||
public void setReplacedState(IBlockState state) {
|
||||
stateOfReplacedBlock = state;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
return slot == 0 && dropItemsOnBreak;
|
||||
|
@ -312,7 +312,7 @@ public class TileMimic extends TileInventory implements ITickable {
|
|||
|
||||
replaceMimicWithBlockActual(world, pos, mimic.getStackInSlot(0), mimic.tileTag, mimic.stateOfReplacedBlock);
|
||||
}
|
||||
|
||||
|
||||
public static boolean replaceMimicWithBlockActual(World world, BlockPos pos, ItemStack stack, NBTTagCompound tileTag, IBlockState replacementState) {
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TilePhantomBlock extends TileTicking {
|
|||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if(!world.isRemote) {
|
||||
if (!world.isRemote) {
|
||||
EntityPlayer player = world.getClosestPlayer(getPos().getX(), getPos().getY(), getPos().getZ(), 10.0D, ItemSigilPhantomBridge.IS_PHANTOM_ACTIVE);
|
||||
if (player != null && !player.isSneaking())
|
||||
return;
|
||||
|
|
|
@ -16,8 +16,7 @@ import net.minecraft.world.World;
|
|||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable
|
||||
{
|
||||
public class TileMasterRoutingNode extends TileInventory implements IMasterRoutingNode, ITickable {
|
||||
public static final int tickRate = 20;
|
||||
private int currentInput;
|
||||
// A list of connections
|
||||
|
@ -26,16 +25,13 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
private List<BlockPos> outputNodeList = new LinkedList<>();
|
||||
private List<BlockPos> inputNodeList = new LinkedList<>();
|
||||
|
||||
public TileMasterRoutingNode()
|
||||
{
|
||||
public TileMasterRoutingNode() {
|
||||
super(0, "masterRoutingNode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (!getWorld().isRemote)
|
||||
{
|
||||
public void update() {
|
||||
if (!getWorld().isRemote) {
|
||||
// currentInput = getWorld().isBlockIndirectlyGettingPowered(pos);
|
||||
currentInput = getWorld().getStrongPower(pos);
|
||||
|
||||
|
@ -50,31 +46,23 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
Map<Integer, List<IItemFilter>> outputMap = new TreeMap<>();
|
||||
Map<Integer, List<IFluidFilter>> outputFluidMap = new TreeMap<>();
|
||||
|
||||
for (BlockPos outputPos : outputNodeList)
|
||||
{
|
||||
for (BlockPos outputPos : outputNodeList) {
|
||||
TileEntity outputTile = getWorld().getTileEntity(outputPos);
|
||||
if (this.isConnected(new LinkedList<>(), outputPos))
|
||||
{
|
||||
if (outputTile instanceof IOutputItemRoutingNode)
|
||||
{
|
||||
if (this.isConnected(new LinkedList<>(), outputPos)) {
|
||||
if (outputTile instanceof IOutputItemRoutingNode) {
|
||||
IOutputItemRoutingNode outputNode = (IOutputItemRoutingNode) outputTile;
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES)
|
||||
{
|
||||
if (!outputNode.isInventoryConnectedToSide(facing) || !outputNode.isOutput(facing))
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
if (!outputNode.isInventoryConnectedToSide(facing) || !outputNode.isOutput(facing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IItemFilter filter = outputNode.getOutputFilterForSide(facing);
|
||||
if (filter != null)
|
||||
{
|
||||
if (filter != null) {
|
||||
int priority = outputNode.getPriority(facing);
|
||||
if (outputMap.containsKey(priority))
|
||||
{
|
||||
if (outputMap.containsKey(priority)) {
|
||||
outputMap.get(priority).add(filter);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
List<IItemFilter> filterList = new LinkedList<>();
|
||||
filterList.add(filter);
|
||||
outputMap.put(priority, filterList);
|
||||
|
@ -83,26 +71,20 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
}
|
||||
|
||||
if (outputTile instanceof IOutputFluidRoutingNode)
|
||||
{
|
||||
if (outputTile instanceof IOutputFluidRoutingNode) {
|
||||
IOutputFluidRoutingNode outputNode = (IOutputFluidRoutingNode) outputTile;
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES)
|
||||
{
|
||||
if (!outputNode.isTankConnectedToSide(facing) || !outputNode.isFluidOutput(facing))
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
if (!outputNode.isTankConnectedToSide(facing) || !outputNode.isFluidOutput(facing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IFluidFilter filter = outputNode.getOutputFluidFilterForSide(facing);
|
||||
if (filter != null)
|
||||
{
|
||||
if (filter != null) {
|
||||
int priority = outputNode.getPriority(facing);
|
||||
if (outputFluidMap.containsKey(priority))
|
||||
{
|
||||
if (outputFluidMap.containsKey(priority)) {
|
||||
outputFluidMap.get(priority).add(filter);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
List<IFluidFilter> filterList = new LinkedList<>();
|
||||
filterList.add(filter);
|
||||
outputFluidMap.put(priority, filterList);
|
||||
|
@ -116,31 +98,23 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
Map<Integer, List<IItemFilter>> inputMap = new TreeMap<>();
|
||||
Map<Integer, List<IFluidFilter>> inputFluidMap = new TreeMap<>();
|
||||
|
||||
for (BlockPos inputPos : inputNodeList)
|
||||
{
|
||||
for (BlockPos inputPos : inputNodeList) {
|
||||
TileEntity inputTile = getWorld().getTileEntity(inputPos);
|
||||
if (this.isConnected(new LinkedList<>(), inputPos))
|
||||
{
|
||||
if (inputTile instanceof IInputItemRoutingNode)
|
||||
{
|
||||
if (this.isConnected(new LinkedList<>(), inputPos)) {
|
||||
if (inputTile instanceof IInputItemRoutingNode) {
|
||||
IInputItemRoutingNode inputNode = (IInputItemRoutingNode) inputTile;
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES)
|
||||
{
|
||||
if (!inputNode.isInventoryConnectedToSide(facing) || !inputNode.isInput(facing))
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
if (!inputNode.isInventoryConnectedToSide(facing) || !inputNode.isInput(facing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IItemFilter filter = inputNode.getInputFilterForSide(facing);
|
||||
if (filter != null)
|
||||
{
|
||||
if (filter != null) {
|
||||
int priority = inputNode.getPriority(facing);
|
||||
if (inputMap.containsKey(priority))
|
||||
{
|
||||
if (inputMap.containsKey(priority)) {
|
||||
inputMap.get(priority).add(filter);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
List<IItemFilter> filterList = new LinkedList<>();
|
||||
filterList.add(filter);
|
||||
inputMap.put(priority, filterList);
|
||||
|
@ -149,26 +123,20 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
}
|
||||
|
||||
if (inputTile instanceof IInputFluidRoutingNode)
|
||||
{
|
||||
if (inputTile instanceof IInputFluidRoutingNode) {
|
||||
IInputFluidRoutingNode inputNode = (IInputFluidRoutingNode) inputTile;
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES)
|
||||
{
|
||||
if (!inputNode.isTankConnectedToSide(facing) || !inputNode.isFluidInput(facing))
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
if (!inputNode.isTankConnectedToSide(facing) || !inputNode.isFluidInput(facing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IFluidFilter filter = inputNode.getInputFluidFilterForSide(facing);
|
||||
if (filter != null)
|
||||
{
|
||||
if (filter != null) {
|
||||
int priority = inputNode.getPriority(facing);
|
||||
if (inputFluidMap.containsKey(priority))
|
||||
{
|
||||
if (inputFluidMap.containsKey(priority)) {
|
||||
inputFluidMap.get(priority).add(filter);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
List<IFluidFilter> filterList = new LinkedList<>();
|
||||
filterList.add(filter);
|
||||
inputFluidMap.put(priority, filterList);
|
||||
|
@ -182,19 +150,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
int maxTransfer = this.getMaxTransferForDemonWill(WorldDemonWillHandler.getCurrentWill(getWorld(), pos, EnumDemonWillType.DEFAULT));
|
||||
int maxFluidTransfer = 1000;
|
||||
|
||||
for (Entry<Integer, List<IItemFilter>> outputEntry : outputMap.entrySet())
|
||||
{
|
||||
for (Entry<Integer, List<IItemFilter>> outputEntry : outputMap.entrySet()) {
|
||||
List<IItemFilter> outputList = outputEntry.getValue();
|
||||
for (IItemFilter outputFilter : outputList)
|
||||
{
|
||||
for (Entry<Integer, List<IItemFilter>> inputEntry : inputMap.entrySet())
|
||||
{
|
||||
for (IItemFilter outputFilter : outputList) {
|
||||
for (Entry<Integer, List<IItemFilter>> inputEntry : inputMap.entrySet()) {
|
||||
List<IItemFilter> inputList = inputEntry.getValue();
|
||||
for (IItemFilter inputFilter : inputList)
|
||||
{
|
||||
for (IItemFilter inputFilter : inputList) {
|
||||
maxTransfer -= inputFilter.transferThroughInputFilter(outputFilter, maxTransfer);
|
||||
if (maxTransfer <= 0)
|
||||
{
|
||||
if (maxTransfer <= 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -202,19 +165,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
}
|
||||
|
||||
for (Entry<Integer, List<IFluidFilter>> outputEntry : outputFluidMap.entrySet())
|
||||
{
|
||||
for (Entry<Integer, List<IFluidFilter>> outputEntry : outputFluidMap.entrySet()) {
|
||||
List<IFluidFilter> outputList = outputEntry.getValue();
|
||||
for (IFluidFilter outputFilter : outputList)
|
||||
{
|
||||
for (Entry<Integer, List<IFluidFilter>> inputEntry : inputFluidMap.entrySet())
|
||||
{
|
||||
for (IFluidFilter outputFilter : outputList) {
|
||||
for (Entry<Integer, List<IFluidFilter>> inputEntry : inputFluidMap.entrySet()) {
|
||||
List<IFluidFilter> inputList = inputEntry.getValue();
|
||||
for (IFluidFilter inputFilter : inputList)
|
||||
{
|
||||
for (IFluidFilter inputFilter : inputList) {
|
||||
maxFluidTransfer -= inputFilter.transferThroughInputFilter(outputFilter, maxFluidTransfer);
|
||||
if (maxFluidTransfer <= 0)
|
||||
{
|
||||
if (maxFluidTransfer <= 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -223,18 +181,15 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
}
|
||||
|
||||
public int getMaxTransferForDemonWill(double will)
|
||||
{
|
||||
public int getMaxTransferForDemonWill(double will) {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
super.serialize(tag);
|
||||
NBTTagList tags = new NBTTagList();
|
||||
for (BlockPos pos : generalNodeList)
|
||||
{
|
||||
for (BlockPos pos : generalNodeList) {
|
||||
NBTTagCompound posTag = new NBTTagCompound();
|
||||
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
|
||||
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
|
||||
|
@ -244,8 +199,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
tag.setTag(Constants.NBT.ROUTING_MASTER_GENERAL, tags);
|
||||
|
||||
tags = new NBTTagList();
|
||||
for (BlockPos pos : inputNodeList)
|
||||
{
|
||||
for (BlockPos pos : inputNodeList) {
|
||||
NBTTagCompound posTag = new NBTTagCompound();
|
||||
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
|
||||
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
|
||||
|
@ -255,8 +209,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
tag.setTag(Constants.NBT.ROUTING_MASTER_INPUT, tags);
|
||||
|
||||
tags = new NBTTagList();
|
||||
for (BlockPos pos : outputNodeList)
|
||||
{
|
||||
for (BlockPos pos : outputNodeList) {
|
||||
NBTTagCompound posTag = new NBTTagCompound();
|
||||
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
|
||||
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
|
||||
|
@ -268,29 +221,25 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
super.deserialize(tag);
|
||||
|
||||
NBTTagList tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_GENERAL, 10);
|
||||
for (int i = 0; i < tags.tagCount(); i++)
|
||||
{
|
||||
for (int i = 0; i < tags.tagCount(); i++) {
|
||||
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
|
||||
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
|
||||
generalNodeList.add(newPos);
|
||||
}
|
||||
|
||||
tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_INPUT, 10);
|
||||
for (int i = 0; i < tags.tagCount(); i++)
|
||||
{
|
||||
for (int i = 0; i < tags.tagCount(); i++) {
|
||||
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
|
||||
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
|
||||
inputNodeList.add(newPos);
|
||||
}
|
||||
|
||||
tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_OUTPUT, 10);
|
||||
for (int i = 0; i < tags.tagCount(); i++)
|
||||
{
|
||||
for (int i = 0; i < tags.tagCount(); i++) {
|
||||
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
|
||||
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
|
||||
outputNodeList.add(newPos);
|
||||
|
@ -298,16 +247,14 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected(List<BlockPos> path, BlockPos nodePos)
|
||||
{
|
||||
public boolean isConnected(List<BlockPos> path, BlockPos nodePos) {
|
||||
//TODO: Figure out how to make it so the path is obtained
|
||||
// if (!connectionMap.containsKey(nodePos))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
TileEntity tile = getWorld().getTileEntity(nodePos);
|
||||
if (!(tile instanceof IRoutingNode))
|
||||
{
|
||||
if (!(tile instanceof IRoutingNode)) {
|
||||
// connectionMap.remove(nodePos);
|
||||
return false;
|
||||
}
|
||||
|
@ -316,22 +263,17 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
List<BlockPos> connectionList = node.getConnected();
|
||||
// List<BlockPos> testPath = path.subList(0, path.size());
|
||||
path.add(nodePos);
|
||||
for (BlockPos testPos : connectionList)
|
||||
{
|
||||
if (path.contains(testPos))
|
||||
{
|
||||
for (BlockPos testPos : connectionList) {
|
||||
if (path.contains(testPos)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (testPos.equals(this.getPos()) && node.isConnectionEnabled(testPos))
|
||||
{
|
||||
if (testPos.equals(this.getPos()) && node.isConnectionEnabled(testPos)) {
|
||||
// path.clear();
|
||||
// path.addAll(testPath);
|
||||
return true;
|
||||
} else if (NodeHelper.isNodeConnectionEnabled(getWorld(), node, testPos))
|
||||
{
|
||||
if (isConnected(path, testPos))
|
||||
{
|
||||
} else if (NodeHelper.isNodeConnectionEnabled(getWorld(), node, testPos)) {
|
||||
if (isConnected(path, testPos)) {
|
||||
// path.clear();
|
||||
// path.addAll(testPath);
|
||||
return true;
|
||||
|
@ -343,56 +285,44 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectionEnabled(BlockPos testPos)
|
||||
{
|
||||
public boolean isConnectionEnabled(BlockPos testPos) {
|
||||
return currentInput <= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNodeToList(IRoutingNode node)
|
||||
{
|
||||
public void addNodeToList(IRoutingNode node) {
|
||||
BlockPos newPos = node.getBlockPos();
|
||||
if (!generalNodeList.contains(newPos))
|
||||
{
|
||||
if (!generalNodeList.contains(newPos)) {
|
||||
generalNodeList.add(newPos);
|
||||
}
|
||||
if (node instanceof IInputItemRoutingNode && !inputNodeList.contains(newPos))
|
||||
{
|
||||
if (node instanceof IInputItemRoutingNode && !inputNodeList.contains(newPos)) {
|
||||
inputNodeList.add(newPos);
|
||||
}
|
||||
if (node instanceof IOutputItemRoutingNode && !outputNodeList.contains(newPos))
|
||||
{
|
||||
if (node instanceof IOutputItemRoutingNode && !outputNodeList.contains(newPos)) {
|
||||
outputNodeList.add(newPos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnections(BlockPos pos, List<BlockPos> connectionList)
|
||||
{
|
||||
for (BlockPos testPos : connectionList)
|
||||
{
|
||||
public void addConnections(BlockPos pos, List<BlockPos> connectionList) {
|
||||
for (BlockPos testPos : connectionList) {
|
||||
addConnection(pos, testPos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnection(BlockPos pos1, BlockPos pos2)
|
||||
{
|
||||
if (connectionMap.containsKey(pos1) && !connectionMap.get(pos1).contains(pos2))
|
||||
{
|
||||
public void addConnection(BlockPos pos1, BlockPos pos2) {
|
||||
if (connectionMap.containsKey(pos1) && !connectionMap.get(pos1).contains(pos2)) {
|
||||
connectionMap.get(pos1).add(pos2);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
List<BlockPos> list = new LinkedList<>();
|
||||
list.add(pos2);
|
||||
connectionMap.put(pos1, list);
|
||||
}
|
||||
|
||||
if (connectionMap.containsKey(pos2) && !connectionMap.get(pos2).contains(pos1))
|
||||
{
|
||||
if (connectionMap.containsKey(pos2) && !connectionMap.get(pos2).contains(pos1)) {
|
||||
connectionMap.get(pos2).add(pos1);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
List<BlockPos> list = new LinkedList<>();
|
||||
list.add(pos1);
|
||||
connectionMap.put(pos2, list);
|
||||
|
@ -400,84 +330,69 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
|
|||
}
|
||||
|
||||
@Override
|
||||
public void removeConnection(BlockPos pos1, BlockPos pos2)
|
||||
{
|
||||
if (connectionMap.containsKey(pos1))
|
||||
{
|
||||
public void removeConnection(BlockPos pos1, BlockPos pos2) {
|
||||
if (connectionMap.containsKey(pos1)) {
|
||||
List<BlockPos> posList = connectionMap.get(pos1);
|
||||
posList.remove(pos2);
|
||||
if (posList.isEmpty())
|
||||
{
|
||||
if (posList.isEmpty()) {
|
||||
connectionMap.remove(pos1);
|
||||
}
|
||||
}
|
||||
|
||||
if (connectionMap.containsKey(pos2))
|
||||
{
|
||||
if (connectionMap.containsKey(pos2)) {
|
||||
List<BlockPos> posList = connectionMap.get(pos2);
|
||||
posList.remove(pos1);
|
||||
if (posList.isEmpty())
|
||||
{
|
||||
if (posList.isEmpty()) {
|
||||
connectionMap.remove(pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectMasterToRemainingNode(World world, List<BlockPos> alreadyChecked, IMasterRoutingNode master)
|
||||
{
|
||||
public void connectMasterToRemainingNode(World world, List<BlockPos> alreadyChecked, IMasterRoutingNode master) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getBlockPos()
|
||||
{
|
||||
public BlockPos getBlockPos() {
|
||||
return this.getPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockPos> getConnected()
|
||||
{
|
||||
public List<BlockPos> getConnected() {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getMasterPos()
|
||||
{
|
||||
public BlockPos getMasterPos() {
|
||||
return this.getPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaster(IMasterRoutingNode master)
|
||||
{
|
||||
public boolean isMaster(IMasterRoutingNode master) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnection(BlockPos pos1)
|
||||
{
|
||||
public void addConnection(BlockPos pos1) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnection(BlockPos pos1)
|
||||
{
|
||||
public void removeConnection(BlockPos pos1) {
|
||||
generalNodeList.remove(pos1);
|
||||
inputNodeList.remove(pos1);
|
||||
outputNodeList.remove(pos1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllConnections()
|
||||
{
|
||||
public void removeAllConnections() {
|
||||
List<BlockPos> list = generalNodeList.subList(0, generalNodeList.size());
|
||||
Iterator<BlockPos> itr = list.iterator();
|
||||
while (itr.hasNext())
|
||||
{
|
||||
while (itr.hasNext()) {
|
||||
BlockPos testPos = itr.next();
|
||||
TileEntity tile = getWorld().getTileEntity(testPos);
|
||||
if (tile instanceof IRoutingNode)
|
||||
{
|
||||
if (tile instanceof IRoutingNode) {
|
||||
((IRoutingNode) tile).removeConnection(pos);
|
||||
getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(testPos), getWorld().getBlockState(testPos), 3);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue