diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 579bb611b..1d6d5fe34 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -10,33 +10,37 @@ package de.ellpeck.actuallyadditions.mod.blocks; +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; +import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockLaserRelay extends BlockContainerBase{ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); - private boolean isItem; + private Type type; - public BlockLaserRelay(String name, boolean isItem){ + public BlockLaserRelay(String name, Type type){ super(Material.ROCK, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); this.setSoundType(SoundType.STONE); - this.isItem = isItem; + this.type = type; } @Override @@ -64,8 +68,35 @@ public class BlockLaserRelay extends BlockContainerBase{ return META; } + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ + if(player.isSneaking()){ + TileEntityLaserRelay relay = (TileEntityLaserRelay)world.getTileEntity(pos); + if(relay instanceof TileEntityLaserRelay.TileEntityLaserRelayItemWhitelist){ + if(!world.isRemote){ + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.LASER_RELAY_ITEM_WHITELIST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); + } + return true; + } + } + return false; + } + @Override public TileEntity createNewTileEntity(World world, int i){ - return this.isItem ? new TileEntityLaserRelay.TileEntityLaserRelayItem() : new TileEntityLaserRelay.TileEntityLaserRelayEnergy(); + switch(this.type){ + case ITEM: + return new TileEntityLaserRelay.TileEntityLaserRelayItem(); + case ITEM_WHITELIST: + return new TileEntityLaserRelay.TileEntityLaserRelayItemWhitelist(); + default: + return new TileEntityLaserRelay.TileEntityLaserRelayEnergy(); + } + } + + public enum Type{ + ENERGY, + ITEM, + ITEM_WHITELIST } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java index 60fd1d39e..25e616800 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java @@ -93,6 +93,7 @@ public class InitBlocks{ public static Block blockLaserRelay; public static Block blockLaserRelayItem; + public static Block blockLaserRelayItemWhitelist; public static Block blockItemViewer; public static Block blockBlackLotus; @@ -122,8 +123,9 @@ public class InitBlocks{ blockAtomicReconstructor = new BlockAtomicReconstructor("blockAtomicReconstructor"); blockCrystal = new BlockCrystal("blockCrystal"); blockBlackLotus = new BlockBlackLotus("blockBlackLotus"); - blockLaserRelay = new BlockLaserRelay("blockLaserRelay", false); - blockLaserRelayItem = new BlockLaserRelay("blockLaserRelayItem", true); + blockLaserRelay = new BlockLaserRelay("blockLaserRelay", BlockLaserRelay.Type.ENERGY); + blockLaserRelayItem = new BlockLaserRelay("blockLaserRelayItem", BlockLaserRelay.Type.ITEM); + blockLaserRelayItemWhitelist = new BlockLaserRelay("blockLaserRelayItemWhitelist", BlockLaserRelay.Type.ITEM_WHITELIST); blockRangedCollector = new BlockRangedCollector("blockRangedCollector"); blockDirectionalBreaker = new BlockDirectionalBreaker("blockDirectionalBreaker"); blockLeafGenerator = new BlockLeafGenerator("blockLeafGenerator"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index 32578b166..8ab5aebd3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -56,6 +56,7 @@ public class CreativeTab extends CreativeTabs{ this.add(InitBlocks.blockFireworkBox); this.add(InitBlocks.blockLaserRelay); this.add(InitBlocks.blockLaserRelayItem); + this.add(InitBlocks.blockLaserRelayItemWhitelist); this.add(InitBlocks.blockItemViewer); this.add(InitBlocks.blockAtomicReconstructor); this.add(InitBlocks.blockPhantomface); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index 2f6e4a002..c223d84b8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -29,7 +29,7 @@ import net.minecraft.util.text.TextComponentString; @InventoryContainer public class ContainerDrill extends Container{ - private static final int SLOT_AMOUNT = 5; + public static final int SLOT_AMOUNT = 5; private InventoryDrill drillInventory = new InventoryDrill(); private InventoryPlayer inventory; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java new file mode 100644 index 000000000..6d5545319 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java @@ -0,0 +1,110 @@ +/* + * This file ("ContainerInputter.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.inventory; + +import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay.TileEntityLaserRelayItemWhitelist; +import invtweaks.api.container.InventoryContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +@InventoryContainer +public class ContainerLaserRelayItemWhitelist extends Container{ + + private TileEntityLaserRelayItemWhitelist tile; + + public ContainerLaserRelayItemWhitelist(InventoryPlayer inventory, TileEntityBase tile){ + this.tile = (TileEntityLaserRelayItemWhitelist)tile; + + for(int i = 0; i < 2; i++){ + for(int x = 0; x < 3; x++){ + for(int y = 0; y < 4; y++){ + this.addSlotToContainer(new SlotFilter(this.tile.filterInventory, y+x*4+i*12, 20+i*84+x*18, 6+y*18)); + } + } + } + + for(int i = 0; i < 3; i++){ + for(int j = 0; j < 9; j++){ + this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 97+i*18)); + } + } + for(int i = 0; i < 9; i++){ + this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot){ + final int inventoryStart = 0; + final int inventoryEnd = inventoryStart+26; + final int hotbarStart = inventoryEnd+1; + final int hotbarEnd = hotbarStart+8; + + Slot theSlot = this.inventorySlots.get(slot); + + if(theSlot != null && theSlot.getHasStack()){ + ItemStack newStack = theSlot.getStack(); + ItemStack currentStack = newStack.copy(); + + //Other Slots in Inventory excluded + if(slot >= inventoryStart){ + if(slot >= inventoryStart && slot <= inventoryEnd){ + if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){ + return null; + } + } + else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ + return null; + } + } + else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){ + return null; + } + + if(newStack.stackSize == 0){ + theSlot.putStack(null); + } + else{ + theSlot.onSlotChanged(); + } + + if(newStack.stackSize == currentStack.stackSize){ + return null; + } + theSlot.onPickupFromSlot(player, newStack); + + return currentStack; + } + return null; + } + + @Override + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){ + if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){ + //Calls the Filter's SlotClick function + return ((SlotFilter)this.getSlot(slotId)).slotClick(player); + } + else{ + return super.slotClick(slotId, dragType, clickTypeIn, player); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player){ + return this.tile.canPlayerUse(player); + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index 4df893416..0fd136b54 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -87,6 +87,8 @@ public class GuiHandler implements IGuiHandler{ return new ContainerRangedCollector(entityPlayer.inventory, tile); case MINER: return new ContainerMiner(entityPlayer.inventory, tile); + case LASER_RELAY_ITEM_WHITELIST: + return new ContainerLaserRelayItemWhitelist(entityPlayer.inventory, tile); default: return null; } @@ -153,6 +155,8 @@ public class GuiHandler implements IGuiHandler{ return new GuiRangedCollector(entityPlayer.inventory, tile, x, y, z, world); case MINER: return new GuiMiner(entityPlayer.inventory, tile); + case LASER_RELAY_ITEM_WHITELIST: + return new GuiLaserRelayItemWhitelist(entityPlayer.inventory, tile); default: return null; } @@ -185,7 +189,8 @@ public class GuiHandler implements IGuiHandler{ BOOK(false), DIRECTIONAL_BREAKER, RANGED_COLLECTOR, - MINER; + MINER, + LASER_RELAY_ITEM_WHITELIST; public boolean checkTileEntity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java new file mode 100644 index 000000000..b393643fb --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -0,0 +1,108 @@ +/* + * This file ("GuiOilGenerator.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.inventory.gui; + +import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton; +import de.ellpeck.actuallyadditions.mod.network.PacketHandler; +import de.ellpeck.actuallyadditions.mod.network.gui.PacketGuiButton; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay.TileEntityLaserRelayItemWhitelist; +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.List; + +@SideOnly(Side.CLIENT) +public class GuiLaserRelayItemWhitelist extends GuiContainer{ + + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiLaserRelayItemWhitelist"); + private TileEntityLaserRelayItemWhitelist tile; + + private SmallerButton whitelistLeft; + private SmallerButton whitelistRight; + + public GuiLaserRelayItemWhitelist(InventoryPlayer inventory, TileEntityBase tile){ + super(new ContainerLaserRelayItemWhitelist(inventory, tile)); + this.tile = (TileEntityLaserRelayItemWhitelist)tile; + this.xSize = 176; + this.ySize = 93+86; + } + + @Override + public void initGui(){ + super.initGui(); + + this.whitelistLeft = new SmallerButton(0, this.guiLeft+3, this.guiTop+16, ""); + this.whitelistRight = new SmallerButton(1, this.guiLeft+157, this.guiTop+16, ""); + this.buttonList.add(this.whitelistLeft); + this.buttonList.add(this.whitelistRight); + } + + @Override + public void actionPerformed(GuiButton button){ + BlockPos pos = this.tile.getPos(); + PacketHandler.theNetwork.sendToServer(new PacketGuiButton(pos.getX(), pos.getY(), pos.getZ(), this.tile.getWorld(), button.id, Minecraft.getMinecraft().thePlayer)); + } + + @Override + public void drawScreen(int x, int y, float f){ + super.drawScreen(x, y, f); + + this.whitelistLeft.displayString = this.tile.isLeftWhitelist ? "O" : "X"; + this.whitelistRight.displayString = this.tile.isRightWhitelist ? "O" : "X"; + + List infoList = this.fontRendererObj.listFormattedStringToWidth(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".inputter.whitelistInfo"), 200); + String text1 = this.tile.isLeftWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist"); + if(x >= this.guiLeft+3 && y >= this.guiTop+16 && x <= this.guiLeft+18 && y <= this.guiTop+31){ + ArrayList list = new ArrayList(); + list.add(TextFormatting.BOLD+text1); + list.addAll(infoList); + this.drawHoveringText(list, x, y); + } + String text2 = this.tile.isRightWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.blacklist"); + if(x >= this.guiLeft+157 && y >= this.guiTop+16 && x <= this.guiLeft+172 && y <= this.guiTop+31){ + ArrayList list = new ArrayList(); + list.add(TextFormatting.BOLD+text2); + list.addAll(infoList); + this.drawHoveringText(list, x, y); + } + } + + @Override + public void drawGuiContainerForegroundLayer(int x, int y){ + AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tile.name); + } + + @Override + public void drawGuiContainerBackgroundLayer(float f, int x, int y){ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); + this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); + + this.mc.getTextureManager().bindTexture(resLoc); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); + + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 91149e37e..bab2c6c8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -15,8 +15,10 @@ import com.google.common.collect.Multimap; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; +import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil; @@ -150,19 +152,9 @@ public class ItemDrill extends ItemEnergy{ return null; } - int slotAmount = compound.getInteger("SlotAmount"); - ItemStack[] slots = new ItemStack[slotAmount]; + ItemStack[] slots = new ItemStack[ContainerDrill.SLOT_AMOUNT]; + TileEntityInventoryBase.loadSlots(slots, compound); - if(slots.length > 0){ - NBTTagList tagList = compound.getTagList("Items", 10); - for(int i = 0; i < tagList.tagCount(); i++){ - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if(slotIndex >= 0 && slotIndex < slots.length){ - slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } return slots; } @@ -407,20 +399,7 @@ public class ItemDrill extends ItemEnergy{ if(compound == null){ compound = new NBTTagCompound(); } - - if(slots != null && slots.length > 0){ - compound.setInteger("SlotAmount", slots.length); - NBTTagList tagList = new NBTTagList(); - for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){ - if(slots[currentIndex] != null){ - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte)currentIndex); - slots[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - compound.setTag("Items", tagList); - } + TileEntityInventoryBase.saveSlots(slots, compound); stack.setTagCompound(compound); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 7273cf793..8c062e476 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -84,6 +84,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ GameRegistry.registerTileEntity(TileEntityPhantomRedstoneface.class, ModUtil.MOD_ID+":tileEntityPhantomRedstoneface"); GameRegistry.registerTileEntity(TileEntityLaserRelay.TileEntityLaserRelayItem.class, ModUtil.MOD_ID+":tileEntityLaserRelayItem"); GameRegistry.registerTileEntity(TileEntityLaserRelay.TileEntityLaserRelayEnergy.class, ModUtil.MOD_ID+":tileEntityLaserRelay"); + GameRegistry.registerTileEntity(TileEntityLaserRelay.TileEntityLaserRelayItemWhitelist.class, ModUtil.MOD_ID+":tileEntityLaserRelayItemWhitelist"); GameRegistry.registerTileEntity(TileEntityItemViewer.class, ModUtil.MOD_ID+":tileItemViewer"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 73a6056a2..f4b43edb5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -48,17 +49,34 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ super.writeSyncableNBT(compound, isForSync); if(!isForSync || this.shouldSyncSlots()){ - if(this.slots.length > 0){ - NBTTagList tagList = new NBTTagList(); - for(int currentIndex = 0; currentIndex < this.slots.length; currentIndex++){ - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte)currentIndex); - if(this.slots[currentIndex] != null){ - this.slots[currentIndex].writeToNBT(tagCompound); - } - tagList.appendTag(tagCompound); + saveSlots(this.slots, compound); + } + } + + public static void saveSlots(ItemStack[] slots, NBTTagCompound compound){ + if(slots != null && slots.length > 0){ + NBTTagList tagList = new NBTTagList(); + for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){ + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte)currentIndex); + if(slots[currentIndex] != null){ + slots[currentIndex].writeToNBT(tagCompound); + } + tagList.appendTag(tagCompound); + } + compound.setTag("Items", tagList); + } + } + + public static void loadSlots(ItemStack[] slots, NBTTagCompound compound){ + if(slots != null && slots.length > 0){ + NBTTagList tagList = compound.getTagList("Items", 10); + for(int i = 0; i < tagList.tagCount(); i++){ + NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); + byte slotIndex = tagCompound.getByte("Slot"); + if(slotIndex >= 0 && slotIndex < slots.length){ + slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); } - compound.setTag("Items", tagList); } } } @@ -71,16 +89,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ super.readSyncableNBT(compound, isForSync); if(!isForSync || this.shouldSyncSlots()){ - if(this.slots.length > 0){ - NBTTagList tagList = compound.getTagList("Items", 10); - for(int i = 0; i < tagList.tagCount(); i++){ - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if(slotIndex >= 0 && slotIndex < this.slots.length){ - this.slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } + loadSlots(this.slots, compound); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java index 6d238157c..d40350b69 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java @@ -78,9 +78,11 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{ public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){ SpecificItemHandlerInfo handler = this.getSwitchedIndexHandler(index); if(handler != null){ - if(ItemStack.areItemsEqual(handler.handler.getStackInSlot(handler.switchedIndex), stack)){ - ItemStack gaveBack = handler.handler.extractItem(handler.switchedIndex, stack.stackSize, true); - return gaveBack != null; + if(handler.relayInQuestion.isWhitelisted(stack)){ + if(ItemStack.areItemsEqual(handler.handler.getStackInSlot(handler.switchedIndex), stack)){ + ItemStack gaveBack = handler.handler.extractItem(handler.switchedIndex, stack.stackSize, true); + return gaveBack != null; + } } } return false; @@ -90,8 +92,10 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{ public boolean isItemValidForSlot(int index, ItemStack stack){ SpecificItemHandlerInfo handler = this.getSwitchedIndexHandler(index); if(handler != null){ - ItemStack gaveBack = handler.handler.insertItem(handler.switchedIndex, stack, true); - return !ItemStack.areItemStacksEqual(gaveBack, stack); + if(handler.relayInQuestion.isWhitelisted(stack)){ + ItemStack gaveBack = handler.handler.insertItem(handler.switchedIndex, stack, true); + return !ItemStack.areItemStacksEqual(gaveBack, stack); + } } return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index 1718393af..9befa2805 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -15,16 +15,24 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler; import de.ellpeck.actuallyadditions.mod.network.PacketParticle; +import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer.GenericItemHandlerInfo; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import io.netty.util.internal.ConcurrentSet; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.items.CapabilityItemHandler; @@ -61,11 +69,13 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{ else{ LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos); } + + super.receiveSyncCompound(compound); } @Override public NBTTagCompound getSyncCompound(){ - NBTTagCompound compound = new NBTTagCompound(); + NBTTagCompound compound = super.getSyncCompound(); BlockPos thisPos = this.pos; ConcurrentSet connections = LaserRelayConnectionHandler.getInstance().getConnectionsFor(thisPos); @@ -76,9 +86,8 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{ list.appendTag(pair.writeToNBT()); } compound.setTag("Connections", list); - return compound; } - return null; + return compound; } @Override @@ -112,8 +121,16 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{ public static class TileEntityLaserRelayItem extends TileEntityLaserRelay{ + public TileEntityLaserRelayItem(String name){ + super(name, true); + } + public TileEntityLaserRelayItem(){ - super("laserRelayItem", true); + this("laserRelayItem"); + } + + public boolean isWhitelisted(ItemStack stack){ + return true; } public List getItemHandlersInNetwork(LaserRelayConnectionHandler.Network network){ @@ -148,6 +165,204 @@ public abstract class TileEntityLaserRelay extends TileEntityBase{ } } + public static class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor{ + + private ItemStack[] slots = new ItemStack[24]; + + public IInventory filterInventory; + + public boolean isLeftWhitelist; + public boolean isRightWhitelist; + + private boolean lastLeftWhitelist; + private boolean lastRightWhitelist; + + public TileEntityLaserRelayItemWhitelist(){ + super("laserRelayItemWhitelist"); + + this.filterInventory = new IInventory(){ + + private TileEntityLaserRelayItemWhitelist tile; + + private IInventory setTile(TileEntityLaserRelayItemWhitelist tile){ + this.tile = tile; + return this; + } + + @Override + public String getName(){ + return this.tile.name; + } + + @Override + public int getInventoryStackLimit(){ + return 64; + } + + @Override + public void markDirty(){ + + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player){ + return this.tile.canPlayerUse(player); + } + + @Override + public void openInventory(EntityPlayer player){ + + } + + @Override + public void closeInventory(EntityPlayer player){ + + } + + @Override + public int getField(int id){ + return 0; + } + + @Override + public void setField(int id, int value){ + + } + + @Override + public int getFieldCount(){ + return 0; + } + + @Override + public void clear(){ + int length = this.tile.slots.length; + this.tile.slots = new ItemStack[length]; + } + + @Override + public void setInventorySlotContents(int i, ItemStack stack){ + this.tile.slots[i] = stack; + this.markDirty(); + } + + @Override + public int getSizeInventory(){ + return this.tile.slots.length; + } + + @Override + public ItemStack getStackInSlot(int i){ + if(i < this.getSizeInventory()){ + return this.tile.slots[i]; + } + return null; + } + + @Override + public ItemStack decrStackSize(int i, int j){ + if(this.tile.slots[i] != null){ + ItemStack stackAt; + if(this.tile.slots[i].stackSize <= j){ + stackAt = this.tile.slots[i]; + this.tile.slots[i] = null; + this.markDirty(); + return stackAt; + } + else{ + stackAt = this.tile.slots[i].splitStack(j); + if(this.tile.slots[i].stackSize <= 0){ + this.tile.slots[i] = null; + } + this.markDirty(); + return stackAt; + } + } + return null; + } + + @Override + public ItemStack removeStackFromSlot(int index){ + ItemStack stack = this.tile.slots[index]; + this.tile.slots[index] = null; + return stack; + } + + @Override + public boolean hasCustomName(){ + return false; + } + + @Override + public ITextComponent getDisplayName(){ + return new TextComponentString(StringUtil.localize(this.getName())); + } + + @Override + public boolean isItemValidForSlot(int index, ItemStack stack){ + return false; + } + }.setTile(this); + } + + @Override + public boolean isWhitelisted(ItemStack stack){ + return this.checkFilter(stack, true, this.isLeftWhitelist) || this.checkFilter(stack, false, this.isRightWhitelist); + } + + private boolean checkFilter(ItemStack stack, boolean left, boolean isWhitelist){ + int slotStart = left ? 0 : 12; + int slotStop = slotStart+12; + + for(int i = slotStart; i < slotStop; i++){ + if(this.slots[i] != null && this.slots[i].isItemEqual(stack)){ + return isWhitelist; + } + } + return !isWhitelist; + } + + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.writeSyncableNBT(compound, isForSync); + if(!isForSync){ + TileEntityInventoryBase.saveSlots(this.slots, compound); + } + compound.setBoolean("LeftWhitelist", this.isLeftWhitelist); + compound.setBoolean("RightWhitelist", this.isRightWhitelist); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.readSyncableNBT(compound, isForSync); + if(!isForSync){ + TileEntityInventoryBase.loadSlots(this.slots, compound); + } + this.isLeftWhitelist = compound.getBoolean("LeftWhitelist"); + this.isRightWhitelist = compound.getBoolean("RightWhitelist"); + } + + @Override + public void onButtonPressed(int buttonID, EntityPlayer player){ + if(buttonID == 0){ + this.isLeftWhitelist = !this.isLeftWhitelist; + } + else if(buttonID == 1){ + this.isRightWhitelist = !this.isRightWhitelist; + } + } + + @Override + public void updateEntity(){ + super.updateEntity(); + + if((this.isLeftWhitelist != this.lastLeftWhitelist || this.isRightWhitelist != this.lastRightWhitelist) && this.sendUpdateWithInterval()){ + this.lastLeftWhitelist = this.isLeftWhitelist; + this.lastRightWhitelist = this.isRightWhitelist; + } + } + } + public static class TileEntityLaserRelayEnergy extends TileEntityLaserRelay implements IEnergyReceiver{ public TileEntityLaserRelayEnergy(){ diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockLaserRelayItemWhitelist.json b/src/main/resources/assets/actuallyadditions/blockstates/blockLaserRelayItemWhitelist.json new file mode 100644 index 000000000..9993a6f0f --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockLaserRelayItemWhitelist.json @@ -0,0 +1,19 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "actuallyadditions:blockLaserRelayItemWhitelist", + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}], + "meta": { + "0": { "x": 180 }, + "1": {}, + "2": { "x": 90 }, + "3": { "x": 270 }, + "4": { "x": 90, "y": 270 }, + "5": { "x": 270, "y": 270 } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index cd42519c5..6d6e4675e 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -135,6 +135,7 @@ tile.actuallyadditions.blockPillarQuartzWall.name=Black Quartz Pillar Wall tile.actuallyadditions.blockPillarQuartzStair.name=Black Quartz Pillar Stairs tile.actuallyadditions.blockPillarQuartzSlab.name=Black Quartz Pillar Slab tile.actuallyadditions.blockLaserRelayItem.name=Item Laser Relay +tile.actuallyadditions.blockLaserRelayItemWhitelist.name=Advanced Item Laser Relay tile.actuallyadditions.blockItemViewer.name=Item Interface #ESD @@ -506,6 +507,7 @@ container.actuallyadditions.cloud.name=Smiley Cloud container.actuallyadditions.directionalBreaker.name=Long-Range Breaker container.actuallyadditions.rangedCollector.name=Ranged Collector container.actuallyadditions.miner.name=Vertical Digger +container.actuallyadditions.laserRelayItemWhitelist.name=Laser Relay #Update Information info.actuallyadditions.update.generic=[{"text":"There is an Update for "},{"text":"Actually Additions ","color":"dark_green"},{"text":"available!","color":"none"}] diff --git a/src/main/resources/assets/actuallyadditions/models/block/blockLaserRelayItemWhitelist.json b/src/main/resources/assets/actuallyadditions/models/block/blockLaserRelayItemWhitelist.json new file mode 100644 index 000000000..a2934f48b --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/block/blockLaserRelayItemWhitelist.json @@ -0,0 +1,880 @@ +{ + "__createdBy": "canitzp", + "ambientocclusion": false, + "textures": { + "particle": "actuallyadditions:blocks/models/modelLaserRelayItemWhitelist", + "laserRelay": "actuallyadditions:blocks/models/modelLaserRelayItemWhitelist" + }, + "elements": [ + { + "from": [4,0,4], + "to": [12,1,12], + "faces": { + "up": { + "uv": [0,0,8,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,1,3], + "to": [12,4,4], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,1,12], + "to": [12,4,13], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,11,12], + "to": [12,14,13], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,11,3], + "to": [12,14,4], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,4,2], + "to": [12,5,3], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,10,2], + "to": [12,11,3], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,10,13], + "to": [12,11,14], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,4,13], + "to": [12,5,14], + "faces": { + "up": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [5.5,1,5.5], + "to": [10.5,3,10.5], + "faces": { + "up": { + "uv": [13.5,13.5,16,16], + "texture": "#laserRelay" + }, + "down": { + "uv": [0.0,0.0,5.0,5.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,5,2], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,5,2], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,5,2], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,5,2], + "texture": "#laserRelay" + } + } + }, + { + "from": [7,3,7], + "to": [9,14,9], + "faces": { + "up": { + "uv": [0.0,0.0,2.0,2.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,2.0,2.0], + "texture": "missingtexture" + }, + "west": { + "uv": [14,2,16,7.5], + "texture": "#laserRelay" + }, + "east": { + "uv": [14,2,16,7.5], + "texture": "#laserRelay" + }, + "north": { + "uv": [14,2,16,7.5], + "texture": "#laserRelay" + }, + "south": { + "uv": [14,2,16,7.5], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,14,4], + "to": [12,15,12], + "faces": { + "up": { + "uv": [1,12,5,15], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,8,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [6.5,6.5,6.5], + "to": [9.5,9.5,9.5], + "faces": { + "up": { + "uv": [14,0,16,2], + "texture": "#laserRelay" + }, + "down": { + "uv": [14,0,16,2], + "texture": "#laserRelay" + }, + "west": { + "uv": [14,0,16,2], + "texture": "#laserRelay" + }, + "east": { + "uv": [14,0,16,2], + "texture": "#laserRelay" + }, + "north": { + "uv": [14,0,16,2], + "texture": "#laserRelay" + }, + "south": { + "uv": [14,0,16,2], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,5,2], + "to": [5,10,3], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [11,5,2], + "to": [12,10,3], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [11,5,13], + "to": [12,10,14], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [4,5,13], + "to": [5,10,14], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [3,1,4], + "to": [4,4,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [12,1,4], + "to": [13,4,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [12,11,4], + "to": [13,14,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [3,11,4], + "to": [4,14,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,3], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,3], + "texture": "#laserRelay" + } + } + }, + { + "from": [2,4,4], + "to": [3,5,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [2,10,4], + "to": [3,11,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [13,10,4], + "to": [14,11,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [13,4,4], + "to": [14,5,12], + "faces": { + "up": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "down": { + "uv": [0,0,1,8], + "texture": "#laserRelay" + }, + "west": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,8,1], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,1], + "texture": "#laserRelay" + } + } + }, + { + "from": [2,5,4], + "to": [3,10,5], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [2,5,11], + "to": [3,10,12], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [13,5,11], + "to": [14,10,12], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + }, + { + "from": [13,5,4], + "to": [14,10,5], + "faces": { + "up": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "down": { + "uv": [0.0,0.0,1.0,1.0], + "texture": "missingtexture" + }, + "west": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "east": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "north": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + }, + "south": { + "uv": [0,0,1,5], + "texture": "#laserRelay" + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelLaserRelayItemWhitelist.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelLaserRelayItemWhitelist.png new file mode 100644 index 000000000..e9b6b2f5d Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/blocks/models/modelLaserRelayItemWhitelist.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiLaserRelayItemWhitelist.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiLaserRelayItemWhitelist.png new file mode 100644 index 000000000..bed3eee85 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/guiLaserRelayItemWhitelist.png differ