Added "Allow Default" option to transporter filters to allow prevention of default route

This commit is contained in:
aidancbrady committed 2017-04-28 16:43:00 -04:00
1 parent 2b37fdb69f
commit 8d66d4b973
22 files changed
+176 -173

No files matched your search

@@ -77,8 +77,8 @@ public class GuiTItemStackFilter extends GuiMekanism
int guiHeight = (height - ySize) / 2;
buttonList.clear();
buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
if(isNew)
{
@@ -178,6 +178,7 @@ public class GuiTItemStackFilter extends GuiMekanism
fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.min") + ":", 128, 20, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.max") + ":", 128, 32, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui." + (filter.sizeMode ? "on" : "off")), 141, 46, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040);
if(!filter.itemType.isEmpty())
{
@@ -202,6 +203,16 @@ public class GuiTItemStackFilter extends GuiMekanism
GL11.glDisable(GL11.GL_LIGHTING);
GlStateManager.popMatrix();
}
if(xAxis >= 128 && xAxis <= 139 && yAxis >= 44 && yAxis <= 55)
{
drawCreativeTabHoveringText(LangUtils.localize("gui.sizeMode"), xAxis, yAxis);
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis);
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60)
{
@@ -261,6 +272,14 @@ public class GuiTItemStackFilter extends GuiMekanism
else {
drawTexturedModalRect(guiWidth + 128, guiHeight + 44, 187, 11, 11, 11);
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 0, 11, 11);
}
else {
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 11, 11, 11);
}
minField.drawTextBox();
maxField.drawTextBox();
@@ -326,6 +345,12 @@ public class GuiTItemStackFilter extends GuiMekanism
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
filter.sizeMode = !filter.sizeMode;
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
filter.allowDefault = !filter.allowDefault;
}
}
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0)
@@ -76,8 +76,8 @@ public class GuiTMaterialFilter extends GuiMekanism
int guiHeight = (height - ySize) / 2;
buttonList.clear();
buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
if(isNew)
{
@@ -126,6 +126,7 @@ public class GuiTMaterialFilter extends GuiMekanism
fontRendererObj.drawString((isNew ? LangUtils.localize("gui.new") : LangUtils.localize("gui.edit")) + " " + LangUtils.localize("gui.materialFilter"), 43, 6, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
fontRendererObj.drawString(LangUtils.localize("gui.materialFilter.details") + ":", 35, 32, 0x00CD00);
fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040);
if(!filter.materialItem.isEmpty())
{
@@ -151,6 +152,11 @@ public class GuiTMaterialFilter extends GuiMekanism
GlStateManager.popMatrix();
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis);
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60)
{
if(filter.color != null)
@@ -198,6 +204,14 @@ public class GuiTMaterialFilter extends GuiMekanism
else {
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11);
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 0, 11, 11);
}
else {
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 11, 11, 11);
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
{
@@ -257,6 +271,12 @@ public class GuiTMaterialFilter extends GuiMekanism
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
filter.allowDefault = !filter.allowDefault;
}
}
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0)
@@ -89,8 +89,8 @@ public class GuiTModIDFilter extends GuiMekanism
int guiHeight = (height - ySize) / 2;
buttonList.clear();
buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
if(isNew)
{
@@ -167,8 +167,9 @@ public class GuiTModIDFilter extends GuiMekanism
fontRendererObj.drawString((isNew ? LangUtils.localize("gui.new") : LangUtils.localize("gui.edit")) + " " + LangUtils.localize("gui.modIDFilter"), 43, 6, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
renderScaledText(LangUtils.localize("gui.id") + ": " + filter.modID, 35, 32, 0x00CD00, 107);
fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040);
if(renderStack != null)
if(!renderStack.isEmpty())
{
try {
GlStateManager.pushMatrix();
@@ -192,6 +193,11 @@ public class GuiTModIDFilter extends GuiMekanism
GL11.glDisable(GL11.GL_LIGHTING);
GlStateManager.popMatrix();
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis);
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60)
{
@@ -234,6 +240,14 @@ public class GuiTModIDFilter extends GuiMekanism
else {
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12);
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 0, 11, 11);
}
else {
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 11, 11, 11);
}
modIDText.drawTextBox();
@@ -277,7 +291,7 @@ public class GuiTModIDFilter extends GuiMekanism
}
else if(iterStacks != null && iterStacks.size() == 0)
{
renderStack = null;
renderStack = ItemStack.EMPTY;
}
}
@@ -304,6 +318,12 @@ public class GuiTModIDFilter extends GuiMekanism
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
setModID();
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
filter.allowDefault = !filter.allowDefault;
}
}
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0)
@@ -89,8 +89,8 @@ public class GuiTOreDictFilter extends GuiMekanism
int guiHeight = (height - ySize) / 2;
buttonList.clear();
buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save")));
buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete")));
if(isNew)
{
@@ -167,8 +167,9 @@ public class GuiTOreDictFilter extends GuiMekanism
fontRendererObj.drawString((isNew ? LangUtils.localize("gui.new") : LangUtils.localize("gui.edit")) + " " + LangUtils.localize("gui.oredictFilter"), 43, 6, 0x404040);
fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00);
renderScaledText(LangUtils.localize("gui.key") + ": " + filter.oreDictName, 35, 32, 0x00CD00, 107);
fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040);
if(renderStack != null)
if(!renderStack.isEmpty())
{
try {
GlStateManager.pushMatrix();
@@ -192,6 +193,11 @@ public class GuiTOreDictFilter extends GuiMekanism
GL11.glDisable(GL11.GL_LIGHTING);
GlStateManager.popMatrix();
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis);
}
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60)
{
@@ -234,6 +240,14 @@ public class GuiTOreDictFilter extends GuiMekanism
else {
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12);
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 0, 11, 11);
}
else {
drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 11, 11, 11);
}
oreDictText.drawTextBox();
@@ -277,7 +291,7 @@ public class GuiTOreDictFilter extends GuiMekanism
}
else if(iterStacks != null && iterStacks.size() == 0)
{
renderStack = null;
renderStack = ItemStack.EMPTY;
}
}
@@ -304,6 +318,12 @@ public class GuiTOreDictFilter extends GuiMekanism
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
setOreDictKey();
}
if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75)
{
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
filter.allowDefault = !filter.allowDefault;
}
}
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0)
@@ -74,7 +74,6 @@ public abstract class GuiElement
{
try {
int left = (Integer)ReflectionUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
System.out.println(left + " " + guiLeft);
ReflectionUtils.setPrivateValue(guiObj, left + guiLeft, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
} catch(Exception e) {
e.printStackTrace();
@@ -256,7 +256,7 @@ public class PacketHandler
{
if(general.logPackets)
{
System.out.println("[Mekanism] " + log);
Mekanism.logger.info(log);
}
}
@@ -21,19 +21,22 @@ public class TItemStackFilter extends TransporterFilter
public ItemStack itemType = ItemStack.EMPTY;
@Override
public boolean canFilter(ItemStack itemStack)
public boolean canFilter(ItemStack itemStack, boolean strict)
{
if(itemStack.isEmpty())
{
return false;
}
if(sizeMode && max == 0)
if(strict && sizeMode)
{
return false;
if(max == 0 || itemStack.getCount() < min)
{
return false;
}
}
return (itemType.getHasSubtypes() ? itemType.isItemEqual(itemStack) : itemType.getItem() == itemStack.getItem()) && (!sizeMode || itemStack.getCount() >= min);
return (itemType.getHasSubtypes() ? itemType.isItemEqual(itemStack) : itemType.getItem() == itemStack.getItem());
}
@Override
@@ -130,6 +133,7 @@ public class TItemStackFilter extends TransporterFilter
public TItemStackFilter clone()
{
TItemStackFilter filter = new TItemStackFilter();
filter.allowDefault = allowDefault;
filter.color = color;
filter.itemType = itemType.copy();
filter.sizeMode = sizeMode;
@@ -24,7 +24,7 @@ public class TMaterialFilter extends TransporterFilter
}
@Override
public boolean canFilter(ItemStack itemStack)
public boolean canFilter(ItemStack itemStack, boolean strict)
{
if(itemStack.isEmpty() || !(itemStack.getItem() instanceof ItemBlock))
{
@@ -97,6 +97,8 @@ public class TMaterialFilter extends TransporterFilter
public TMaterialFilter clone()
{
TMaterialFilter filter = new TMaterialFilter();
filter.allowDefault = allowDefault;
filter.color = color;
filter.materialItem = materialItem;
return filter;
@@ -14,7 +14,7 @@ public class TModIDFilter extends TransporterFilter
public String modID;
@Override
public boolean canFilter(ItemStack itemStack)
public boolean canFilter(ItemStack itemStack, boolean strict)
{
if(itemStack.isEmpty())
{
@@ -84,6 +84,7 @@ public class TModIDFilter extends TransporterFilter
public TModIDFilter clone()
{
TModIDFilter filter = new TModIDFilter();
filter.allowDefault = allowDefault;
filter.color = color;
filter.modID = modID;
@@ -14,7 +14,7 @@ public class TOreDictFilter extends TransporterFilter
public String oreDictName;
@Override
public boolean canFilter(ItemStack itemStack)
public boolean canFilter(ItemStack itemStack, boolean strict)
{
if(itemStack.isEmpty())
{
@@ -84,6 +84,7 @@ public class TOreDictFilter extends TransporterFilter
public TOreDictFilter clone()
{
TOreDictFilter filter = new TOreDictFilter();
filter.allowDefault = allowDefault;
filter.color = color;
filter.oreDictName = oreDictName;
@@ -3,6 +3,7 @@ package mekanism.common.content.transporter;
import java.util.HashMap;
import java.util.Map;
import mekanism.common.content.transporter.Finder.FirstFinder;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.StackUtils;
import net.minecraft.inventory.IInventory;
@@ -57,6 +58,11 @@ public class TransitRequest
}
public static TransitRequest getTopStacks(TileEntity tile, EnumFacing side, int amount)
{
return getTopStacks(tile, side, amount, new FirstFinder());
}
public static TransitRequest getTopStacks(TileEntity tile, EnumFacing side, int amount, Finder finder)
{
TransitRequest ret = new TransitRequest();
@@ -68,7 +74,7 @@ public class TransitRequest
{
ItemStack stack = inventory.extractItem(i, amount, true);
if(!stack.isEmpty() && !ret.hasType(stack))
if(!stack.isEmpty() && !ret.hasType(stack) && finder.modifies(stack))
{
ret.setItem(stack, i);
}
@@ -90,7 +96,7 @@ public class TransitRequest
ItemStack toSend = sidedInventory.getStackInSlot(slotID).copy();
toSend.setCount(Math.min(amount, toSend.getCount()));
if(!ret.hasType(toSend) && sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()))
if(!ret.hasType(toSend) && sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()) && finder.modifies(toSend))
{
ret.setItem(toSend, slotID);
}
@@ -109,7 +115,7 @@ public class TransitRequest
ItemStack toSend = inventory.getStackInSlot(i).copy();
toSend.setCount(Math.min(amount, toSend.getCount()));
if(!ret.hasType(toSend))
if(!ret.hasType(toSend) && finder.modifies(toSend))
{
ret.setItem(toSend, i);
}
@@ -135,7 +141,7 @@ public class TransitRequest
public boolean isEmpty()
{
return slotID == -1 || stack.isEmpty();
return stack.isEmpty();
}
public ItemStack getRejected(ItemStack orig)
@@ -18,8 +18,10 @@ public abstract class TransporterFilter
public static final List<Character> SPECIAL_CHARS = Arrays.asList('*', '-', ' ', '|', '_', '\'');
public EnumColor color;
public boolean allowDefault;
public abstract boolean canFilter(ItemStack itemStack);
public abstract boolean canFilter(ItemStack itemStack, boolean strict);
public abstract Finder getFinder();
@@ -30,6 +32,8 @@ public abstract class TransporterFilter
public void write(NBTTagCompound nbtTags)
{
nbtTags.setBoolean("allowDefault", allowDefault);
if(color != null)
{
nbtTags.setInteger("color", TransporterUtils.colors.indexOf(color));
@@ -38,6 +42,8 @@ public abstract class TransporterFilter
protected void read(NBTTagCompound nbtTags)
{
allowDefault = nbtTags.getBoolean("allowDefault");
if(nbtTags.hasKey("color"))
{
color = TransporterUtils.colors.get(nbtTags.getInteger("color"));
@@ -46,6 +52,8 @@ public abstract class TransporterFilter
public void write(ArrayList<Object> data)
{
data.add(allowDefault);
if(color != null)
{
data.add(TransporterUtils.colors.indexOf(color));
@@ -57,6 +65,8 @@ public abstract class TransporterFilter
protected void read(ByteBuf dataStream)
{
allowDefault = dataStream.readBoolean();
int c = dataStream.readInt();
if(c != -1)
@@ -291,18 +291,18 @@ public final class TransporterPathfinder
public static Destination getPath(DestChecker checker, EnumSet<EnumFacing> sides, ILogisticalTransporter start, Coord4D dest, TransporterStack stack, TransitResponse response, int min)
{
List<Coord4D> test = PathfinderCache.getCache(start.coord(), dest, sides);
if(test != null && checkPath(start.world(), test, stack))
if(response.stack.getCount() >= min)
{
return new Destination(test, false, response, 0).calculateScore(start.world());
}
Pathfinder p = new Pathfinder(checker, start.world(), dest, start.coord(), stack);
if(p.getPath().size() >= 2)
{
if(response.stack.getCount() >= min)
List<Coord4D> test = PathfinderCache.getCache(start.coord(), dest, sides);
if(test != null && checkPath(start.world(), test, stack))
{
return new Destination(test, false, response, 0).calculateScore(start.world());
}
Pathfinder p = new Pathfinder(checker, start.world(), dest, start.coord(), stack);
if(p.getPath().size() >= 2)
{
PathfinderCache.cachedPaths.put(new PathData(start.coord(), dest, p.side), p.getPath());
@@ -20,7 +20,7 @@ import mekanism.common.base.ISustainedData;
import mekanism.common.block.states.BlockStateMachine;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.config.MekanismConfig.client;
import mekanism.common.content.transporter.Finder.FirstFinder;
import mekanism.common.content.transporter.Finder;
import mekanism.common.content.transporter.InvStack;
import mekanism.common.content.transporter.StackSearcher;
import mekanism.common.content.transporter.TItemStackFilter;
@@ -28,7 +28,6 @@ import mekanism.common.content.transporter.TOreDictFilter;
import mekanism.common.content.transporter.TransitRequest;
import mekanism.common.content.transporter.TransitRequest.TransitResponse;
import mekanism.common.content.transporter.TransporterFilter;
import mekanism.common.content.transporter.TransporterManager;
import mekanism.common.integration.IComputerIntegration;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.security.ISecurityTile;
@@ -122,7 +121,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
break inner;
}
if(filter.canFilter(invStack.getStack()))
if(filter.canFilter(invStack.getStack(), true))
{
if(filter instanceof TItemStackFilter)
{
@@ -133,10 +132,10 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
min = itemFilter.min;
}
}
TransitRequest request = TransitRequest.getFromStack(invStack.getStack());
TransitResponse response = emitItemToTransporter(front, request, filter.color, min);
if(!response.isEmpty())
{
invStack.use(response.stack.getCount());
@@ -152,19 +151,14 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
if(!sentItems && autoEject)
{
InvStack invStack = InventoryUtils.takeTopStack(back, facing.getOpposite(), new FirstFinder());
TransitRequest request = TransitRequest.getTopStacks(back, facing.getOpposite(), 64, new StrictFilterFinder());
TransitResponse response = emitItemToTransporter(front, request, color, 0);
if(invStack != null && !invStack.getStack().isEmpty())
if(!response.isEmpty())
{
TransitRequest request = TransitRequest.getTopStacks(back, facing.getOpposite(), 64);
TransitResponse response = emitItemToTransporter(front, request, color, 0);
if(!response.isEmpty())
{
response.getInvStack(back, facing).use(response.stack.getCount());
back.markDirty();
setActive(true);
}
response.getInvStack(back, facing).use(response.stack.getCount());
back.markDirty();
setActive(true);
}
}
@@ -859,4 +853,21 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
return super.getCapability(capability, side);
}
private class StrictFilterFinder extends Finder
{
@Override
public boolean modifies(ItemStack stack)
{
for(TransporterFilter filter : filters)
{
if(filter.canFilter(stack, false) && !filter.allowDefault)
{
return false;
}
}
return true;
}
}
}
@@ -81,14 +81,12 @@ public abstract class TileEntityMultiblock<T extends SynchronizedData<T>> extend
{
for(EntityPlayer player : playersUsing)
{
System.out.println(world.isRemote + " " + clientHasStructure + " " + structure);
//player.closeScreen();
player.closeScreen();
}
}
if(!world.isRemote)
{
//System.out.println(pos + " " + structure);
if(structure == null)
{
isRendering = false;
@@ -131,7 +129,6 @@ public abstract class TileEntityMultiblock<T extends SynchronizedData<T>> extend
if(structure != null)
{
//System.out.println("Whee " + structure + " " + isInvalid());
getSynchronizedData().didTick = false;
if(getSynchronizedData().inventoryID != null)
@@ -279,7 +279,7 @@ public class TransporterImpl extends TransmitterImpl<TileEntity, InventoryNetwor
}
TransitResponse response = stack.recalculatePath(request, this, min);
if(!response.isEmpty())
{
stack.itemStack = response.stack;
@@ -270,65 +270,6 @@ public final class InventoryUtils
return inSlot.isItemEqual(toInsert) && ItemStack.areItemStackTagsEqual(inSlot, toInsert);
}
public static InvStack takeTopItem(TileEntity tile, EnumFacing side, int amount)
{
if(isItemHandler(tile, side.getOpposite()))
{
IItemHandler inventory = getItemHandler(tile, side.getOpposite());
for(int i = inventory.getSlots() - 1; i >= 0; i--)
{
ItemStack stack = inventory.extractItem(i, amount, true);
if(!stack.isEmpty())
{
return new InvStack(tile, i, stack, side.getOpposite());
}
}
}
else if(tile instanceof ISidedInventory)
{
ISidedInventory sidedInventory = (ISidedInventory)tile;
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
if(slots != null)
{
for(int get = slots.length - 1; get >= 0; get--)
{
int slotID = slots[get];
if(!sidedInventory.getStackInSlot(slotID).isEmpty() && sidedInventory.getStackInSlot(slotID).getCount() > 0)
{
ItemStack toSend = sidedInventory.getStackInSlot(slotID).copy();
toSend.setCount(Math.min(amount, toSend.getCount()));
if(sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()))
{
return new InvStack(tile, slotID, toSend, side.getOpposite());
}
}
}
}
}
else if(tile instanceof IInventory)
{
IInventory inventory = checkChestInv((IInventory)tile);
for(int i = inventory.getSizeInventory() - 1; i >= 0; i--)
{
if(!inventory.getStackInSlot(i).isEmpty() && inventory.getStackInSlot(i).getCount() > 0)
{
ItemStack toSend = inventory.getStackInSlot(i).copy();
toSend.setCount(Math.min(amount, toSend.getCount()));
return new InvStack(tile, i, toSend, side.getOpposite());
}
}
}
return null;
}
public static InvStack takeDefinedItem(TileEntity tile, EnumFacing side, ItemStack type, int min, int max)
{
InvStack ret = new InvStack(tile, side.getOpposite());
@@ -442,62 +383,6 @@ public final class InventoryUtils
return null;
}
public static InvStack takeTopStack(TileEntity tile, EnumFacing side, Finder id)
{
if(isItemHandler(tile, side.getOpposite()))
{
IItemHandler inventory = getItemHandler(tile, side.getOpposite());
for(int i = inventory.getSlots() - 1; i >= 0; i--)
{
ItemStack stack = inventory.extractItem(i, 64, true);
if(!stack.isEmpty() && id.modifies(stack))
{
return new InvStack(tile, i, stack, side.getOpposite());
}
}
}
else if(tile instanceof ISidedInventory)
{
ISidedInventory sidedInventory = (ISidedInventory)tile;
int[] slots = sidedInventory.getSlotsForFace(side.getOpposite());
if(slots != null && slots.length != 0)
{
for(int get = slots.length - 1; get >= 0; get--)
{
int slotID = slots[get];
if(!sidedInventory.getStackInSlot(slotID).isEmpty() && id.modifies(sidedInventory.getStackInSlot(slotID)))
{
ItemStack toSend = sidedInventory.getStackInSlot(slotID);
if(sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()))
{
return new InvStack(tile, slotID, toSend, side.getOpposite());
}
}
}
}
}
else if(tile instanceof IInventory)
{
IInventory inventory = checkChestInv((IInventory)tile);
for(int i = inventory.getSizeInventory() - 1; i >= 0; i--)
{
if(!inventory.getStackInSlot(i).isEmpty() && id.modifies(inventory.getStackInSlot(i)))
{
ItemStack toSend = inventory.getStackInSlot(i).copy();
return new InvStack(tile, i, toSend, side.getOpposite());
}
}
}
return null;
}
public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, EnumFacing side, boolean force)
{
if(force && tileEntity instanceof TileEntityLogisticalSorter)