Fix subtle bugs, not finished yet in a long shot
This commit is contained in:
@@ -107,7 +107,7 @@ public abstract class BlockBase extends Block {
|
||||
IItemHandler handler = ((TileBase) tile).getDrops();
|
||||
|
||||
for (int i = 0; i < handler.getSlots(); ++i) {
|
||||
if (handler.getStackInSlot(i) != null) {
|
||||
if (!handler.getStackInSlot(i).isEmpty()) {
|
||||
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), handler.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
@@ -198,4 +198,8 @@ public class BlockCable extends BlockNode {
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public EnumPlacementType getPlacementType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -63,10 +63,8 @@ public class BlockController extends BlockBase {
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileController controller = (TileController) world.getTileEntity(pos);
|
||||
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(ENERGY, controller.getEnergyScaledForDisplay());
|
||||
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaledForDisplay());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -57,8 +57,8 @@ public abstract class ContainerBase extends Container {
|
||||
public ItemStack slotClick(int id, int dragType, ClickType clickType, EntityPlayer player) {
|
||||
Slot slot = id >= 0 ? getSlot(id) : null;
|
||||
|
||||
if (slot instanceof SlotSpecimen) {
|
||||
if (((SlotSpecimen) slot).isWithSize()) {
|
||||
if (slot instanceof SlotFilter) {
|
||||
if (((SlotFilter) slot).isWithSize()) {
|
||||
if (clickType == ClickType.QUICK_MOVE) {
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else if (!player.inventory.getItemStack().isEmpty()) {
|
||||
@@ -83,7 +83,7 @@ public abstract class ContainerBase extends Container {
|
||||
}
|
||||
|
||||
return player.inventory.getItemStack();
|
||||
} else if (slot instanceof SlotSpecimenLegacy) {
|
||||
} else if (slot instanceof SlotFilterLegacy) {
|
||||
if (player.inventory.getItemStack().isEmpty()) {
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else if (slot.isItemValid(player.inventory.getItemStack())) {
|
||||
@@ -92,7 +92,7 @@ public abstract class ContainerBase extends Container {
|
||||
|
||||
return player.inventory.getItemStack();
|
||||
} else if (slot instanceof SlotDisabled) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return super.slotClick(id, dragType, clickType, player);
|
||||
@@ -117,21 +117,21 @@ public abstract class ContainerBase extends Container {
|
||||
slot.putStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
slot.onSlotChanged();
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private ItemStack getStackFromSlot(Slot slot) {
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
|
||||
if (stackInSlot == null) {
|
||||
if (slot instanceof SlotSpecimenFluid) {
|
||||
stackInSlot = ((SlotSpecimenFluid) slot).getRealStack();
|
||||
} else if (slot instanceof SlotSpecimenType) {
|
||||
stackInSlot = ((SlotSpecimenType) slot).getRealStack();
|
||||
if (stackInSlot.isEmpty()) {
|
||||
if (slot instanceof SlotFilterFluid) {
|
||||
stackInSlot = ((SlotFilterFluid) slot).getRealStack();
|
||||
} else if (slot instanceof SlotFilterType) {
|
||||
stackInSlot = ((SlotFilterType) slot).getRealStack();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -15,30 +15,30 @@ public class ContainerConstructor extends ContainerBase {
|
||||
addSlotToContainer(new SlotItemHandler(constructor.getUpgrades(), i, 187, 6 + (i * 18)));
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotSpecimenType(constructor, 0, 80, 20));
|
||||
addSlotToContainer(new SlotFilterType(constructor, 0, 80, 20));
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4) {
|
||||
if (!mergeItemStack(stack, 4, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 4, 4 + 1);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -23,23 +23,23 @@ public class ContainerCrafter extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 9 + 4) {
|
||||
if (!mergeItemStack(stack, 9 + 4, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 9 + 4, false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -16,7 +16,7 @@ public class ContainerDestructor extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenType(destructor, i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterType(destructor, i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
@@ -24,23 +24,23 @@ public class ContainerDestructor extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4) {
|
||||
if (!mergeItemStack(stack, 4 + 9, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDetector;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -10,7 +10,7 @@ public class ContainerDetector extends ContainerBase {
|
||||
public ContainerDetector(TileDetector detector, EntityPlayer player) {
|
||||
super(detector, player);
|
||||
|
||||
addSlotToContainer(new SlotSpecimenType(detector, 0, 107, 20));
|
||||
addSlotToContainer(new SlotFilterType(detector, 0, 107, 20));
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class ContainerDetector extends ContainerBase {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack() && index > 0) {
|
||||
if (slot.getHasStack() && index > 0) {
|
||||
return mergeItemStackToSpecimen(slot.getStack(), 0, 1);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -19,7 +19,7 @@ public class ContainerDiskDrive extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenType(drive, i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterType(drive, i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 141);
|
||||
@@ -27,23 +27,23 @@ public class ContainerDiskDrive extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 8) {
|
||||
if (!mergeItemStack(stack, 8 + 9, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 8, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 8, 8 + 9);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDiskManipulator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -24,7 +24,7 @@ public class ContainerDiskManipulator extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenType(manipulator, i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterType(manipulator, i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 129);
|
||||
@@ -32,23 +32,23 @@ public class ContainerDiskManipulator extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4 + 6) {
|
||||
if (!mergeItemStack(stack, 4 + 6 + 9, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4 + 3, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 4 + 6, 4 + 6 + 9);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -16,7 +16,7 @@ public class ContainerExporter extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenType(exporter, i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterType(exporter, i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
@@ -24,23 +24,23 @@ public class ContainerExporter extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4) {
|
||||
if (!mergeItemStack(stack, 4 + 9, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.externalstorage.TileExternalStorage;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -11,7 +11,7 @@ public class ContainerExternalStorage extends ContainerBase {
|
||||
super(tile, player);
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenType(tile, i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterType(tile, i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 141);
|
||||
@@ -21,10 +21,10 @@ public class ContainerExternalStorage extends ContainerBase {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack() && index >= 8) {
|
||||
if (slot.getHasStack() && index >= 8) {
|
||||
return mergeItemStackToSpecimen(slot.getStack(), 0, 9);
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenFluid;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterFluid;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -16,30 +16,30 @@ public class ContainerFluidInterface extends ContainerBase {
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotItemHandler(fluidInterface.getIn(), 0, 44, 32));
|
||||
addSlotToContainer(new SlotSpecimenFluid(!fluidInterface.getWorld().isRemote, fluidInterface.getOut(), 0, 116, 32));
|
||||
addSlotToContainer(new SlotFilterFluid(!fluidInterface.getWorld().isRemote, fluidInterface.getOut(), 0, 116, 32));
|
||||
|
||||
addPlayerInventory(8, 122);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4 + 2) {
|
||||
if (!mergeItemStack(stack, 4 + 2, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4 + 1, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 5, 6);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenFluid;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterFluid;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidStorage;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -11,7 +11,7 @@ public class ContainerFluidStorage extends ContainerBase {
|
||||
super(tile, player);
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenFluid(!tile.getWorld().isRemote, tile.getFilters(), i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterFluid(!tile.getWorld().isRemote, tile.getFilters(), i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 141);
|
||||
@@ -21,10 +21,10 @@ public class ContainerFluidStorage extends ContainerBase {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack() && index >= 8) {
|
||||
if (slot.getHasStack() && index >= 8) {
|
||||
return mergeItemStackToSpecimen(slot.getStack(), 0, 9);
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
@@ -47,7 +48,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
int y = 96;
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenLegacy(((TileGrid) grid).getMatrix(), i, x, y));
|
||||
addSlotToContainer(new SlotFilterLegacy(((TileGrid) grid).getMatrix(), i, x, y));
|
||||
|
||||
x += 18;
|
||||
|
||||
@@ -79,8 +80,8 @@ public class ContainerGrid extends ContainerBase {
|
||||
Slot slot = inventorySlots.get(i);
|
||||
|
||||
if (slot instanceof SlotGridCrafting || slot == craftingResultSlot) {
|
||||
for (int j = 0; j < listeners.size(); ++j) {
|
||||
listeners.get(j).sendSlotContents(this, i, slot.getStack());
|
||||
for (IContainerListener listener : listeners) {
|
||||
listener.sendSlotContents(this, i, slot.getStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,7 +109,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
if (slot.getHasStack()) {
|
||||
if (slot == craftingResultSlot) {
|
||||
((TileGrid) grid).onCraftedShift(this, player);
|
||||
} else if (slot != patternResultSlot && !(slot instanceof SlotSpecimenLegacy)) {
|
||||
} else if (slot != patternResultSlot && !(slot instanceof SlotFilterLegacy)) {
|
||||
if (grid.getType() != EnumGridType.FLUID && grid.getItemHandler() != null) {
|
||||
slot.putStack(RSUtils.getStack(grid.getItemHandler().onInsert((EntityPlayerMP) player, slot.getStack())));
|
||||
} else if (grid.getType() == EnumGridType.FLUID && grid.getFluidHandler() != null) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimen;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerGridFilter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -17,7 +17,7 @@ public class ContainerGridFilter extends ContainerBase {
|
||||
this.filter = new ItemHandlerGridFilter(stack);
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimen(filter, i, 8 + (i * 18), 20));
|
||||
addSlotToContainer(new SlotFilter(filter, i, 8 + (i * 18), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 70);
|
||||
@@ -29,18 +29,18 @@ public class ContainerGridFilter extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index > 9 - 1) {
|
||||
return mergeItemStackToSpecimen(stack, 0, 9);
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimenType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -16,7 +16,7 @@ public class ContainerImporter extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimenType(importer, i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilterType(importer, i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 55);
|
||||
@@ -24,23 +24,23 @@ public class ContainerImporter extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4) {
|
||||
if (!mergeItemStack(stack, 4 + 9, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotOutput;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimen;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -17,7 +17,7 @@ public class ContainerInterface extends ContainerBase {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimen(tile.getExportSpecimenItems(), i, 8 + (18 * i), 54, SlotSpecimen.SPECIMEN_SIZE));
|
||||
addSlotToContainer(new SlotFilter(tile.getExportSpecimenItems(), i, 8 + (18 * i), 54, SlotFilter.SPECIMEN_SIZE));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
@@ -33,23 +33,23 @@ public class ContainerInterface extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 9) {
|
||||
if (!mergeItemStack(stack, 9 + 9 + 9 + 4, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 9, false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -19,23 +19,23 @@ public class ContainerNetworkTransmitter extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index <= 1) {
|
||||
if (!mergeItemStack(stack, 2, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 2, false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotOutput;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimen;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileProcessingPatternEncoder;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -22,7 +22,7 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
||||
int y = 20;
|
||||
|
||||
for (int i = 0; i < 9 * 2; ++i) {
|
||||
addSlotToContainer(new SlotSpecimen(encoder.getConfiguration(), i, x, y, SlotSpecimen.SPECIMEN_SIZE));
|
||||
addSlotToContainer(new SlotFilter(encoder.getConfiguration(), i, x, y, SlotFilter.SPECIMEN_SIZE));
|
||||
|
||||
x += 18;
|
||||
|
||||
@@ -43,23 +43,23 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && !(slot instanceof SlotSpecimen) && slot.getHasStack()) {
|
||||
if (!(slot instanceof SlotFilter) && slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 2) {
|
||||
if (!mergeItemStack(stack, 2 + 18, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 1, false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
||||
|
||||
public void clearInputsAndOutputs() {
|
||||
for (int i = 2; i < 2 + (9 * 2); ++i) {
|
||||
getSlot(i).putStack(null);
|
||||
getSlot(i).putStack(ItemStack.EMPTY);
|
||||
getSlot(i).onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
@@ -32,31 +32,31 @@ public class ContainerSolderer extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
if (slot.getHasStack()) {
|
||||
stack = slot.getStack();
|
||||
|
||||
if (index < 4) {
|
||||
if (!mergeItemStack(stack, 4 + 4, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (index < 4 + 4) {
|
||||
if (!mergeItemStack(stack, 4 + 4, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else {
|
||||
if (stack.getItem() != RSItems.UPGRADE || !mergeItemStack(stack, 4, 4 + 4, false)) {
|
||||
if (!mergeItemStack(stack, 0, 3, false)) { // 0 - 3 because we can't shift click to output slot
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimen;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileStorage;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -11,7 +11,7 @@ public class ContainerStorage extends ContainerBase {
|
||||
super(tile, player);
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
addSlotToContainer(new SlotSpecimen(tile.getFilters(), i, 8 + (18 * i), 20));
|
||||
addSlotToContainer(new SlotFilter(tile.getFilters(), i, 8 + (18 * i), 20));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 141);
|
||||
@@ -21,10 +21,10 @@ public class ContainerStorage extends ContainerBase {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
if (slot != null && slot.getHasStack() && index >= 8) {
|
||||
if (slot.getHasStack() && index >= 8) {
|
||||
return mergeItemStackToSpecimen(slot.getStack(), 0, 9);
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ public class ContainerWirelessTransmitter extends ContainerBase {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack stack = null;
|
||||
ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
Slot slot = getSlot(index);
|
||||
|
||||
@@ -28,14 +28,14 @@ public class ContainerWirelessTransmitter extends ContainerBase {
|
||||
|
||||
if (index < 4) {
|
||||
if (!mergeItemStack(stack, 4, inventorySlots.size(), false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if (!mergeItemStack(stack, 0, 4, false)) {
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (stack.getCount() == 0) {
|
||||
slot.putStack(null);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
@@ -4,13 +4,15 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotDisabled extends Slot {
|
||||
public SlotDisabled(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
public boolean isItemValid(@Nonnull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -11,21 +11,22 @@ import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class SlotSpecimen extends SlotItemHandler {
|
||||
public class SlotFilter extends SlotItemHandler {
|
||||
public static final int SPECIMEN_SIZE = 1;
|
||||
public static final int SPECIMEN_BLOCK = 2;
|
||||
|
||||
private int flags = 0;
|
||||
|
||||
public SlotSpecimen(IItemHandler handler, int id, int x, int y, int flags) {
|
||||
public SlotFilter(IItemHandler handler, int id, int x, int y, int flags) {
|
||||
super(handler, id, x, y);
|
||||
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
public SlotSpecimen(IItemHandler handler, int id, int x, int y) {
|
||||
public SlotFilter(IItemHandler handler, int id, int x, int y) {
|
||||
this(handler, id, x, y, 0);
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ public class SlotSpecimen extends SlotItemHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
public boolean isItemValid(@Nonnull ItemStack stack) {
|
||||
if (super.isItemValid(stack)) {
|
||||
if (isBlockOnly()) {
|
||||
return stack.getItem() instanceof ItemBlock || stack.getItem() instanceof ItemBlockSpecial || stack.getItem() instanceof IPlantable || stack.getItem() instanceof ItemSkull;
|
||||
@@ -48,8 +49,8 @@ public class SlotSpecimen extends SlotItemHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
if (stack != null && !isWithSize()) {
|
||||
public void putStack(@Nonnull ItemStack stack) {
|
||||
if (!stack.isEmpty() && !isWithSize()) {
|
||||
stack.setCount(1);
|
||||
}
|
||||
|
@@ -3,18 +3,21 @@ package com.raoulvdberge.refinedstorage.container.slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class SlotSpecimenFluid extends SlotSpecimen {
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotFilterFluid extends SlotFilter {
|
||||
private boolean server;
|
||||
|
||||
public SlotSpecimenFluid(boolean server, IItemHandler handler, int id, int x, int y) {
|
||||
public SlotFilterFluid(boolean server, IItemHandler handler, int id, int x, int y) {
|
||||
super(handler, id, x, y);
|
||||
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getStack() {
|
||||
return server ? super.getStack() : null;
|
||||
return server ? super.getStack() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public ItemStack getRealStack() {
|
@@ -6,8 +6,10 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotSpecimenLegacy extends Slot {
|
||||
public SlotSpecimenLegacy(IInventory inventory, int id, int x, int y) {
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotFilterLegacy extends Slot {
|
||||
public SlotFilterLegacy(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@@ -22,8 +24,8 @@ public class SlotSpecimenLegacy extends Slot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
public void putStack(@Nonnull ItemStack stack) {
|
||||
if (!stack.isEmpty()) {
|
||||
stack.setCount(1);
|
||||
}
|
||||
|
@@ -5,16 +5,18 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class SlotSpecimenType extends SlotSpecimen {
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotFilterType extends SlotFilter {
|
||||
private IType type;
|
||||
|
||||
public SlotSpecimenType(IType type, int id, int x, int y, int flags) {
|
||||
public SlotFilterType(IType type, int id, int x, int y, int flags) {
|
||||
super(null, id, x, y, flags);
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public SlotSpecimenType(IType type, int id, int x, int y) {
|
||||
public SlotFilterType(IType type, int id, int x, int y) {
|
||||
this(type, id, x, y, 0);
|
||||
}
|
||||
|
||||
@@ -34,8 +36,9 @@ public class SlotSpecimenType extends SlotSpecimen {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getStack() {
|
||||
return (type.getType() == IType.ITEMS || !((TileEntity) type).getWorld().isRemote) ? super.getStack() : null;
|
||||
return (type.getType() == IType.ITEMS || !((TileEntity) type).getWorld().isRemote) ? super.getStack() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public ItemStack getRealStack() {
|
@@ -7,6 +7,8 @@ import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotGridCraftingResult extends SlotCrafting {
|
||||
private ContainerGrid container;
|
||||
private TileGrid grid;
|
||||
@@ -19,7 +21,8 @@ public class SlotGridCraftingResult extends SlotCrafting {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onTake(EntityPlayer player, ItemStack stack) {
|
||||
@Nonnull
|
||||
public ItemStack onTake(EntityPlayer player, @Nonnull ItemStack stack) {
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent(player, stack, grid.getMatrix());
|
||||
|
||||
onCrafting(stack);
|
||||
@@ -30,6 +33,6 @@ public class SlotGridCraftingResult extends SlotCrafting {
|
||||
container.sendCraftingSlots();
|
||||
}
|
||||
|
||||
return null;
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
@@ -4,13 +4,15 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SlotOutput extends SlotItemHandler {
|
||||
public SlotOutput(IItemHandler inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
public boolean isItemValid(@Nonnull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public class GuiNetworkTransmitter extends GuiBase {
|
||||
|
||||
String distance;
|
||||
|
||||
if (networkTransmitter.getNetworkCard().getStackInSlot(0) == null) {
|
||||
if (networkTransmitter.getNetworkCard().getStackInSlot(0).isEmpty()) {
|
||||
distance = t("gui.refinedstorage:network_transmitter.missing_card");
|
||||
} else if (!TileNetworkTransmitter.RECEIVER_DIMENSION_SUPPORTED.getValue()) {
|
||||
distance = t("gui.refinedstorage:network_transmitter.missing_upgrade");
|
||||
|
@@ -14,7 +14,7 @@ public class GuiPriority extends GuiCraftingStart {
|
||||
public GuiPriority(GuiBase parent, TileDataParameter<Integer> priority) {
|
||||
super(parent, null, new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
}, 164, 92);
|
||||
|
@@ -28,13 +28,13 @@ public class ItemHandlerGridFilterInGrid extends ItemHandlerBasic {
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
ItemStack filter = getStackInSlot(i);
|
||||
|
||||
if (filter != null) {
|
||||
if (!filter.isEmpty()) {
|
||||
int compare = ItemGridFilter.getCompare(filter);
|
||||
|
||||
ItemHandlerGridFilter items = new ItemHandlerGridFilter(filter);
|
||||
|
||||
for (ItemStack item : items.getFilteredItems()) {
|
||||
if (item != null) {
|
||||
if (!item.isEmpty()) {
|
||||
filteredItems.add(new GridFilteredItem(item, compare));
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
||||
|
||||
public int getSpeed(int speed, int speedIncrease) {
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
if (getStackInSlot(i) != null && getStackInSlot(i).getItemDamage() == ItemUpgrade.TYPE_SPEED) {
|
||||
if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == ItemUpgrade.TYPE_SPEED) {
|
||||
speed -= speedIncrease;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
||||
int upgrades = 0;
|
||||
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
if (getStackInSlot(i) != null && getStackInSlot(i).getItemDamage() == type) {
|
||||
if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == type) {
|
||||
upgrades++;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
||||
int usage = 0;
|
||||
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
if (getStackInSlot(i) != null) {
|
||||
if (!getStackInSlot(i).isEmpty()) {
|
||||
usage += ItemUpgrade.getEnergyUsage(getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
||||
|
||||
public int getFortuneLevel() {
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
if (getStackInSlot(i) != null && getStackInSlot(i).getItemDamage() == ItemUpgrade.TYPE_FORTUNE) {
|
||||
if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == ItemUpgrade.TYPE_FORTUNE) {
|
||||
return ItemUpgrade.getFortuneLevel(getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotSpecimen;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBasic;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
||||
@@ -72,7 +72,7 @@ public class TileConstructor extends TileNode implements IComparable, IType {
|
||||
super.onContentsChanged(slot);
|
||||
|
||||
item = getStackInSlot(slot) == null ? null : getStackInSlot(slot).copy();
|
||||
block = SlotSpecimen.getBlockState(getWorld(), pos.offset(getDirection()), getStackInSlot(slot));
|
||||
block = SlotFilter.getBlockState(getWorld(), pos.offset(getDirection()), getStackInSlot(slot));
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user