Run formatter

This commit is contained in:
Nicholas Ignoffo 2017-08-15 21:30:48 -07:00
parent 61c44a831b
commit 08258fd6ef
606 changed files with 13464 additions and 22975 deletions

View file

@ -1,5 +1,7 @@
package WayofTime.bloodmagic.tile.container;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.tile.TileAlchemyTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
@ -7,15 +9,11 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.tile.TileAlchemyTable;
public class ContainerAlchemyTable extends Container
{
public class ContainerAlchemyTable extends Container {
private final IInventory tileTable;
public ContainerAlchemyTable(InventoryPlayer inventoryPlayer, IInventory tileTable)
{
public ContainerAlchemyTable(InventoryPlayer inventoryPlayer, IInventory tileTable) {
this.tileTable = tileTable;
this.addSlotToContainer(new Slot(tileTable, 0, 62, 15));
this.addSlotToContainer(new Slot(tileTable, 1, 80, 51));
@ -27,30 +25,24 @@ public class ContainerAlchemyTable extends Container
this.addSlotToContainer(new SlotOrb(tileTable, TileAlchemyTable.orbSlot, 152, 69));
this.addSlotToContainer(new SlotOutput(tileTable, TileAlchemyTable.outputSlot, 44, 51));
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 123 + i * 18));
}
}
for (int i = 0; i < 9; i++)
{
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 181));
}
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player)
{
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
InventoryPlayer inventoryPlayer = player.inventory;
if (slotId < 6 && slotId >= 0)
{
if (slotId < 6 && slotId >= 0) {
Slot slot = this.getSlot(slotId);
if (!slot.getHasStack() && inventoryPlayer.getItemStack().isEmpty())
{
if (!slot.getHasStack() && inventoryPlayer.getItemStack().isEmpty()) {
((TileAlchemyTable) tileTable).toggleInputSlotAccessible(slotId);
}
}
@ -59,51 +51,40 @@ public class ContainerAlchemyTable extends Container
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack())
{
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (index == 8)
{
if (!this.mergeItemStack(itemstack1, 9, 9 + 36, true))
{
if (index == 8) {
if (!this.mergeItemStack(itemstack1, 9, 9 + 36, true)) {
return ItemStack.EMPTY;
}
slot.onSlotChange(itemstack1, itemstack);
} else if (index > 8)
{
if (itemstack1.getItem() instanceof IBloodOrb)
{
} else if (index > 8) {
if (itemstack1.getItem() instanceof IBloodOrb) {
if (!this.mergeItemStack(itemstack1, 7, 8, false)) //TODO: Add alchemy tools to list
{
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 0, 6, false))
{
} else if (!this.mergeItemStack(itemstack1, 0, 6, false)) {
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 9, 9 + 36, false))
{
} else if (!this.mergeItemStack(itemstack1, 9, 9 + 36, false)) {
return ItemStack.EMPTY;
}
if (itemstack1.getCount() == 0)
{
if (itemstack1.getCount() == 0) {
slot.putStack(ItemStack.EMPTY);
} else
{
} else {
slot.onSlotChanged();
}
if (itemstack1.getCount() == itemstack.getCount())
{
if (itemstack1.getCount() == itemstack.getCount()) {
return ItemStack.EMPTY;
}
@ -114,35 +95,28 @@ public class ContainerAlchemyTable extends Container
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
public boolean canInteractWith(EntityPlayer playerIn) {
return this.tileTable.isUsableByPlayer(playerIn);
}
private class SlotOrb extends Slot
{
public SlotOrb(IInventory inventory, int slotIndex, int x, int y)
{
private class SlotOrb extends Slot {
public SlotOrb(IInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
public boolean isItemValid(ItemStack itemStack) {
return itemStack.getItem() instanceof IBloodOrb;
}
}
private class SlotOutput extends Slot
{
public SlotOutput(IInventory inventory, int slotIndex, int x, int y)
{
private class SlotOutput extends Slot {
public SlotOutput(IInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack stack)
{
public boolean isItemValid(ItemStack stack) {
return false;
}
}

View file

@ -1,7 +1,8 @@
package WayofTime.bloodmagic.tile.container;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.item.routing.IRoutingFilterProvider;
import WayofTime.bloodmagic.tile.routing.TileFilteredRoutingNode;
import WayofTime.bloodmagic.util.GhostItemHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@ -10,54 +11,43 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.item.routing.IRoutingFilterProvider;
import WayofTime.bloodmagic.tile.routing.TileFilteredRoutingNode;
public class ContainerItemRoutingNode extends Container
{
import javax.annotation.Nullable;
public class ContainerItemRoutingNode extends Container {
private final IInventory tileItemRoutingNode;
// private final ItemInventory itemInventory;
private final TileFilteredRoutingNode inventory;
public int lastGhostSlotClicked = -1;
// private final ItemInventory itemInventory;
private int slotsOccupied;
private final TileFilteredRoutingNode inventory;
public int lastGhostSlotClicked = -1;
public ContainerItemRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileItemRoutingNode)
{
public ContainerItemRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileItemRoutingNode) {
this.tileItemRoutingNode = tileItemRoutingNode;
inventory = (TileFilteredRoutingNode) tileItemRoutingNode;
this.addSlotToContainer(new SlotItemFilter(this, tileItemRoutingNode, 0, 8, 33));
ItemInventory itemInventory = inventory.itemInventory;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
addSlotToContainer(new SlotGhostItem(itemInventory, j + i * 3, 26 + j * 18, 15 + i * 18));
}
}
slotsOccupied = 10;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 87 + i * 18));
}
}
for (int i = 0; i < 9; i++)
{
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 145));
}
}
public void resetItemInventory(ItemStack masterStack)
{
public void resetItemInventory(ItemStack masterStack) {
inventory.itemInventory.initializeInventory(masterStack);
}
@ -65,34 +55,28 @@ public class ContainerItemRoutingNode extends Container
* Overridden in order to handle ghost item slots.
*/
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player)
{
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
InventoryPlayer inventoryPlayer = player.inventory;
// if (!player.worldObj.isRemote)
{
if (slotId >= 0)
{
if (slotId >= 0) {
Slot slot = this.inventorySlots.get(slotId);
if (slot instanceof SlotGhostItem) //TODO: make the slot clicking work!
{
lastGhostSlotClicked = slot.getSlotIndex();
if ((dragType == 0 || dragType == 1))
{
if ((dragType == 0 || dragType == 1)) {
ItemStack slotStack = slot.getStack();
ItemStack heldStack = inventoryPlayer.getItemStack();
if (dragType == 0) //Left mouse click-eth
{
{
if (heldStack.isEmpty() && !slotStack.isEmpty())
{
if (heldStack.isEmpty() && !slotStack.isEmpty()) {
//I clicked on the slot with an empty hand. Selecting!
} else if (!heldStack.isEmpty() && slotStack.isEmpty())
{
if (!((SlotGhostItem) slot).canBeAccessed())
{
} else if (!heldStack.isEmpty() && slotStack.isEmpty()) {
if (!((SlotGhostItem) slot).canBeAccessed()) {
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
@ -102,8 +86,7 @@ public class ContainerItemRoutingNode extends Container
slot.putStack(copyStack);
ItemStack filterStack = this.inventorySlots.get(0).getStack();
if (filterStack.getItem() instanceof IRoutingFilterProvider)
{
if (filterStack.getItem() instanceof IRoutingFilterProvider) {
ItemStack filterCopy = ((IRoutingFilterProvider) filterStack.getItem()).getContainedStackForItem(filterStack, heldStack);
slot.putStack(filterCopy);
}
@ -123,55 +106,44 @@ public class ContainerItemRoutingNode extends Container
}
@Override
public void detectAndSendChanges()
{
public void detectAndSendChanges() {
super.detectAndSendChanges();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack())
{
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (index == 0)
{
if (!this.mergeItemStack(itemstack1, slotsOccupied, slotsOccupied + 36, true))
{
if (index == 0) {
if (!this.mergeItemStack(itemstack1, slotsOccupied, slotsOccupied + 36, true)) {
return null;
}
slot.onSlotChange(itemstack1, itemstack);
} else if (index > 0)
{
} else if (index > 0) {
// return null;
if (itemstack1.getItem() instanceof IRoutingFilterProvider) // Change to check item is a filter
{
if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
return ItemStack.EMPTY;
}
}
} else if (!this.mergeItemStack(itemstack1, slotsOccupied, 36 + slotsOccupied, false))
{
} else if (!this.mergeItemStack(itemstack1, slotsOccupied, 36 + slotsOccupied, false)) {
return ItemStack.EMPTY;
}
if (itemstack1.isEmpty())
{
if (itemstack1.isEmpty()) {
slot.putStack(ItemStack.EMPTY);
} else
{
} else {
slot.onSlotChanged();
}
if (itemstack1.getCount() == itemstack.getCount())
{
if (itemstack1.getCount() == itemstack.getCount()) {
return ItemStack.EMPTY;
}
@ -182,85 +154,71 @@ public class ContainerItemRoutingNode extends Container
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
public boolean canInteractWith(EntityPlayer playerIn) {
return this.tileItemRoutingNode.isUsableByPlayer(playerIn);
}
private class SlotItemFilter extends Slot
{
private class SlotItemFilter extends Slot {
public ContainerItemRoutingNode container;
public TileFilteredRoutingNode inventory;
public SlotItemFilter(ContainerItemRoutingNode container, IInventory inventory, int slotIndex, int x, int y)
{
public SlotItemFilter(ContainerItemRoutingNode container, IInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
this.container = container;
this.inventory = (TileFilteredRoutingNode) inventory;
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
public boolean isItemValid(ItemStack itemStack) {
return itemStack.getItem() instanceof IRoutingFilterProvider; //TODO: Create a new Item that holds the filter.
}
@Override
public void onSlotChanged()
{
public void onSlotChanged() {
super.onSlotChanged();
container.resetItemInventory(getStack());
for (int i = 1; i <= 9; i++)
{
for (int i = 1; i <= 9; i++) {
Slot slot = container.getSlot(i);
slot.onSlotChanged();
}
}
@Override
public ItemStack getStack()
{
public ItemStack getStack() {
return this.inventory.getStackInSlot(getActiveSlot());
}
@Override
public void putStack(@Nullable ItemStack stack)
{
public void putStack(@Nullable ItemStack stack) {
this.inventory.setInventorySlotContents(getActiveSlot(), stack);
this.onSlotChanged();
}
@Override
public ItemStack decrStackSize(int amount)
{
public ItemStack decrStackSize(int amount) {
return this.inventory.decrStackSize(getActiveSlot(), amount);
}
public int getActiveSlot()
{
public int getActiveSlot() {
return inventory.currentActiveSlot;
}
}
private class SlotGhostItem extends Slot
{
private class SlotGhostItem extends Slot {
private ItemInventory itemInv;
public SlotGhostItem(ItemInventory inventory, int slotIndex, int x, int y)
{
public SlotGhostItem(ItemInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
itemInv = inventory;
}
@Override
public boolean isItemValid(ItemStack stack)
{
public boolean isItemValid(ItemStack stack) {
return false;
}
@Override
public boolean canTakeStack(EntityPlayer playerIn)
{
public boolean canTakeStack(EntityPlayer playerIn) {
return false;
}
@ -270,8 +228,7 @@ public class ContainerItemRoutingNode extends Container
// return itemInv.canInventoryBeManipulated() && super.isHere(inv, slotIn);
// }
public boolean canBeAccessed()
{
public boolean canBeAccessed() {
return itemInv.canInventoryBeManipulated();
}
}

View file

@ -5,19 +5,16 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
public class ContainerMasterRoutingNode extends Container
{
public class ContainerMasterRoutingNode extends Container {
private final IInventory tileMasterRoutingNode;
public ContainerMasterRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileMasterRoutingNode)
{
public ContainerMasterRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileMasterRoutingNode) {
this.tileMasterRoutingNode = tileMasterRoutingNode;
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
public boolean canInteractWith(EntityPlayer playerIn) {
return this.tileMasterRoutingNode.isUsableByPlayer(playerIn);
}
}

View file

@ -10,12 +10,10 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerSoulForge extends Container
{
public class ContainerSoulForge extends Container {
private final IInventory tileForge;
public ContainerSoulForge(InventoryPlayer inventoryPlayer, IInventory tileForge)
{
public ContainerSoulForge(InventoryPlayer inventoryPlayer, IInventory tileForge) {
this.tileForge = tileForge;
this.addSlotToContainer(new Slot(tileForge, 0, 8, 15));
this.addSlotToContainer(new Slot(tileForge, 1, 80, 15));
@ -24,66 +22,51 @@ public class ContainerSoulForge extends Container
this.addSlotToContainer(new SlotSoul(tileForge, TileSoulForge.soulSlot, 152, 51));
this.addSlotToContainer(new SlotOutput(tileForge, TileSoulForge.outputSlot, 44, 51));
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 123 + i * 18));
}
}
for (int i = 0; i < 9; i++)
{
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 181));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack())
{
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (index == 5)
{
if (!this.mergeItemStack(itemstack1, 6, 6 + 36, true))
{
if (index == 5) {
if (!this.mergeItemStack(itemstack1, 6, 6 + 36, true)) {
return ItemStack.EMPTY;
}
slot.onSlotChange(itemstack1, itemstack);
} else if (index > 5)
{
if (itemstack1.getItem() instanceof IDemonWill || itemstack1.getItem() instanceof IDemonWillGem)
{
if (!this.mergeItemStack(itemstack1, 4, 5, false))
{
} else if (index > 5) {
if (itemstack1.getItem() instanceof IDemonWill || itemstack1.getItem() instanceof IDemonWillGem) {
if (!this.mergeItemStack(itemstack1, 4, 5, false)) {
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 0, 4, false))
{
} else if (!this.mergeItemStack(itemstack1, 0, 4, false)) {
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(itemstack1, 6, 42, false))
{
} else if (!this.mergeItemStack(itemstack1, 6, 42, false)) {
return ItemStack.EMPTY;
}
if (itemstack1.getCount() == 0)
{
if (itemstack1.getCount() == 0) {
slot.putStack(ItemStack.EMPTY);
} else
{
} else {
slot.onSlotChanged();
}
if (itemstack1.getCount() == itemstack.getCount())
{
if (itemstack1.getCount() == itemstack.getCount()) {
return ItemStack.EMPTY;
}
@ -94,35 +77,28 @@ public class ContainerSoulForge extends Container
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
public boolean canInteractWith(EntityPlayer playerIn) {
return this.tileForge.isUsableByPlayer(playerIn);
}
private class SlotSoul extends Slot
{
public SlotSoul(IInventory inventory, int slotIndex, int x, int y)
{
private class SlotSoul extends Slot {
public SlotSoul(IInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
public boolean isItemValid(ItemStack itemStack) {
return itemStack.getItem() instanceof IDemonWillGem || itemStack.getItem() instanceof IDemonWill;
}
}
private class SlotOutput extends Slot
{
public SlotOutput(IInventory inventory, int slotIndex, int x, int y)
{
private class SlotOutput extends Slot {
public SlotOutput(IInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack stack)
{
public boolean isItemValid(ItemStack stack) {
return false;
}
}

View file

@ -8,65 +8,51 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerTeleposer extends Container
{
public class ContainerTeleposer extends Container {
private final IInventory tileTeleposer;
public ContainerTeleposer(InventoryPlayer inventoryPlayer, IInventory tileTeleposer)
{
public ContainerTeleposer(InventoryPlayer inventoryPlayer, IInventory tileTeleposer) {
this.tileTeleposer = tileTeleposer;
this.addSlotToContainer(new SlotTeleposer(tileTeleposer, 0, 80, 33));
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 57 + i * 18));
}
}
for (int i = 0; i < 9; i++)
{
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 115));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
{
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
ItemStack stack = ItemStack.EMPTY;
Slot slotObject = inventorySlots.get(slot);
int slots = inventorySlots.size();
if (slotObject != null && slotObject.getHasStack())
{
if (slotObject != null && slotObject.getHasStack()) {
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
if (stack.getItem() instanceof ItemTelepositionFocus)
{
if (slot <= slots)
{
if (!this.mergeItemStack(stackInSlot, 0, slots, false))
{
if (stack.getItem() instanceof ItemTelepositionFocus) {
if (slot <= slots) {
if (!this.mergeItemStack(stackInSlot, 0, slots, false)) {
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, false))
{
} else if (!this.mergeItemStack(stackInSlot, slots, 36 + slots, false)) {
return ItemStack.EMPTY;
}
}
if (stackInSlot.getCount() == 0)
{
if (stackInSlot.getCount() == 0) {
slotObject.putStack(ItemStack.EMPTY);
} else
{
} else {
slotObject.onSlotChanged();
}
if (stackInSlot.getCount() == stack.getCount())
{
if (stackInSlot.getCount() == stack.getCount()) {
return ItemStack.EMPTY;
}
@ -77,21 +63,17 @@ public class ContainerTeleposer extends Container
}
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
public boolean canInteractWith(EntityPlayer playerIn) {
return this.tileTeleposer.isUsableByPlayer(playerIn);
}
private class SlotTeleposer extends Slot
{
public SlotTeleposer(IInventory inventory, int slotIndex, int x, int y)
{
private class SlotTeleposer extends Slot {
public SlotTeleposer(IInventory inventory, int slotIndex, int x, int y) {
super(inventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
public boolean isItemValid(ItemStack itemStack) {
return itemStack.getItem() instanceof ItemTelepositionFocus;
}
}