forgot about the fucking router compat

This commit is contained in:
70000hp 2024-08-27 15:34:07 -04:00
parent 8076c77448
commit c135700d7e
4 changed files with 67 additions and 3 deletions

View File

@ -79,7 +79,7 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable {
NBTTagCompound slotNBT = items.getCompoundTagAt(count);
byte slot = slotNBT.getByte("slot");
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
if (loadedStack != null) {
if (loadedStack != null && slot < getFilterSlots()[1]) {
inv.setInventorySlotContents(slot + getFilterSlots()[0], ItemStack.loadItemStackFromNBT(slotNBT));
nextMode(slot);
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
@ -90,4 +90,9 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable {
}
}
@Override
default String[] infoForDisplay(World world, int x, int y, int z) {
return new String[] { "copytool.filter" };
}
}

View File

@ -160,7 +160,7 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase implemen
NBTTagCompound slotNBT = items.getCompoundTagAt(count);
byte slot = slotNBT.getByte("slot");
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
if (loadedStack != null) {
if (loadedStack != null && slot < filter.getFilterSlots()[1]) {
inv.setInventorySlotContents(slot + filter.getFilterSlots()[0], ItemStack.loadItemStackFromNBT(slotNBT));
filter.nextMode(slot);
this.getWorldObj().markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
@ -175,6 +175,6 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase implemen
@Override
public String[] infoForDisplay(World world, int x, int y, int z) {
return new String[]{"Filter", "Orientation"};
return new String[]{"copytool.filter", "copytool.orientation"};
}
}

View File

@ -12,8 +12,11 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -136,4 +139,59 @@ public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUI
setFilterContents(data);
}
}
@Override
public NBTTagCompound getSettings(World world, int x, int y, int z) {
IInventory inv = (IInventory) this;
NBTTagCompound nbt = new NBTTagCompound();
NBTTagList tags = new NBTTagList();
int count = 0;
for (int i = getFilterSlots()[0]; i < getFilterSlots()[1]; i++) {
NBTTagCompound slotNBT = new NBTTagCompound();
if (inv.getStackInSlot(i) != null) {
slotNBT.setByte("slot", (byte) count);
inv.getStackInSlot(i).writeToNBT(slotNBT);
tags.appendTag(slotNBT);
}
count++;
}
nbt.setTag("items", tags);
nbt.setIntArray("modes", modes);
return nbt;
}
@Override
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
NBTTagList items = nbt.getTagList("items", 10);
int listSize = items.tagCount();
if(listSize > 0 && nbt.hasKey("modes")) {
for (int i = 0; i < listSize; i++) {
NBTTagCompound slotNBT = items.getCompoundTagAt(i);
byte slot = slotNBT.getByte("slot");
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
if (loadedStack != null && slot > index * 5 && slot < Math.min(index * 5 + 5, 30)) {
this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(slotNBT));
nextMode(slot);
this.getWorldObj().markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
}
}
} else {
IControlReceiverFilter.super.pasteSettings(nbt, index, world, player, x, y, z);
}
}
@Override
public String[] infoForDisplay(World world, int x, int y, int z) {
String[] options = new String[patterns.length];
for (int i = 0; i < options.length; i++) {
options[i] = "copytool.pattern" + i;
}
return options;
}
}

View File

@ -4273,6 +4273,7 @@ item.seg_20.name=Size 20 Connector
item.serum.name=Serum
item.servo_set.name=Servo Set
item.servo_set_desh.name=Desh Servo Set
item.settings_tool.name=Settings Tool
item.shackles.name=Shackles
item.shellntm.name=%s Shell
item.shimmer_axe.name=Shimmer Axe