diff --git a/build.gradle b/build.gradle index 836e791f..d788fabe 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.1.1' +version = '1.2.1' group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'toms_storage' @@ -25,7 +25,7 @@ minecraft { // stable_# Stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: 'snapshot', version: '20200423-1.15.1' + mappings channel: 'snapshot', version: '20200707-1.16.1' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') @@ -87,7 +87,7 @@ minecraft { repositories { maven { url "http://dvs1.progwml6.com/files/maven" } - maven { url "https://tehnut.info/maven" } + //maven { url "https://tehnut.info/maven" } maven { // TOP name 'tterrag maven' url "http://maven.tterrag.com/" @@ -100,9 +100,9 @@ repositories { url = "http://maven.covers1624.net" } jcenter() - maven { + /*maven { url "http://maven.shadowfacts.net/" - } + }*/ maven { url "http://chickenbones.net/maven/" } @@ -113,7 +113,7 @@ dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:1.15.2-31.1.1' + minecraft 'net.minecraftforge:forge:1.16.1-32.0.70' // You may put jars on which you depend on in ./libs or you may define them like so.. // compile "some.group:artifact:version:classifier" @@ -134,14 +134,14 @@ dependencies { // http://www.gradle.org/docs/current/userguide/dependency_management.html // compile against the JEI API but do not include it at runtime - compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api") + compileOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.6:api") // at runtime, use the full JEI jar - runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2") + runtimeOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.6") // compile against the TOP API but do not include it at runtime - compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.15:1.15-2.0.0-3:api") + compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:1.16-3.0.1-beta-4:api") // at runtime, use the full TOP jar - runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.15:1.15-2.0.0-3") + runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:1.16-3.0.1-beta-4") } // Example for how to get properties into the manifest for reading by the runtime.. diff --git a/src/main/java/com/tom/storagemod/ItemBlockConnector.java b/src/main/java/com/tom/storagemod/ItemBlockConnector.java deleted file mode 100644 index 969793fc..00000000 --- a/src/main/java/com/tom/storagemod/ItemBlockConnector.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.tom.storagemod; - -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; - -public class ItemBlockConnector extends BlockItem { - - public ItemBlockConnector() { - super(StorageMod.invCableConnector, new Properties().group(StorageMod.STORAGE_MOD_TAB)); - setRegistryName(StorageMod.invCableConnector.getRegistryName()); - } - - @Override - public ITextComponent getDisplayName(ItemStack is) { - ITextComponent tc = super.getDisplayName(is); - tc.appendText(" ("); - if(is.hasTag() && is.getTag().getCompound("BlockStateTag").contains("color")) { - String color = is.getTag().getCompound("BlockStateTag").getString("color"); - tc.appendSibling(new TranslationTextComponent("color.minecraft." + color)); - } else { - tc.appendSibling(new TranslationTextComponent("color.minecraft.white")); - } - tc.appendText(")"); - return tc; - } -} diff --git a/src/main/java/com/tom/storagemod/StorageMod.java b/src/main/java/com/tom/storagemod/StorageMod.java index af177340..efc24fde 100644 --- a/src/main/java/com/tom/storagemod/StorageMod.java +++ b/src/main/java/com/tom/storagemod/StorageMod.java @@ -27,6 +27,7 @@ import com.tom.storagemod.block.BlockInventoryCable; import com.tom.storagemod.block.BlockInventoryCableConnector; import com.tom.storagemod.block.BlockInventoryCableFramed; +import com.tom.storagemod.block.BlockInventoryHopperBasic; import com.tom.storagemod.block.BlockInventoryProxy; import com.tom.storagemod.block.BlockOpenCrate; import com.tom.storagemod.block.BlockPaintedTrim; @@ -46,6 +47,7 @@ import com.tom.storagemod.tile.TileEntityCraftingTerminal; import com.tom.storagemod.tile.TileEntityInventoryCableConnector; import com.tom.storagemod.tile.TileEntityInventoryConnector; +import com.tom.storagemod.tile.TileEntityInventoryHopperBasic; import com.tom.storagemod.tile.TileEntityInventoryProxy; import com.tom.storagemod.tile.TileEntityOpenCrate; import com.tom.storagemod.tile.TileEntityPainted; @@ -55,7 +57,7 @@ @Mod(StorageMod.modid) public class StorageMod { public static final String modid = "toms_storage"; - public static IProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new); + public static IProxy proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> ServerProxy::new); public static InventoryConnector connector; public static StorageTerminal terminal; public static BlockTrim inventoryTrim; @@ -66,6 +68,7 @@ public class StorageMod { public static BlockInventoryCableConnector invCableConnector; public static BlockInventoryProxy invProxy; public static CraftingTerminal craftingTerminal; + public static BlockInventoryHopperBasic invHopperBasic; public static ItemPaintKit paintingKit; public static ItemWirelessTerminal wirelessTerminal; @@ -77,6 +80,7 @@ public class StorageMod { public static TileEntityType invCableConnectorTile; public static TileEntityType invProxyTile; public static TileEntityType craftingTerminalTile; + public static TileEntityType invHopperBasicTile; public static ContainerType storageTerminal; public static ContainerType craftingTerminalCont; @@ -136,6 +140,7 @@ public static void onBlocksRegistry(final RegistryEvent.Register blockReg invCableConnector = new BlockInventoryCableConnector(); invProxy = new BlockInventoryProxy(); craftingTerminal = new CraftingTerminal(); + invHopperBasic = new BlockInventoryHopperBasic(); blockRegistryEvent.getRegistry().register(connector); blockRegistryEvent.getRegistry().register(terminal); blockRegistryEvent.getRegistry().register(openCrate); @@ -146,6 +151,7 @@ public static void onBlocksRegistry(final RegistryEvent.Register blockReg blockRegistryEvent.getRegistry().register(invCableConnector); blockRegistryEvent.getRegistry().register(invProxy); blockRegistryEvent.getRegistry().register(craftingTerminal); + blockRegistryEvent.getRegistry().register(invHopperBasic); } @SubscribeEvent @@ -160,9 +166,10 @@ public static void onItemsRegistry(final RegistryEvent.Register itemRegist itemRegistryEvent.getRegistry().register(new ItemBlockPainted(paintedTrim)); registerItemForBlock(itemRegistryEvent, invCable); itemRegistryEvent.getRegistry().register(new ItemBlockPainted(invCableFramed, new Item.Properties().group(STORAGE_MOD_TAB))); - itemRegistryEvent.getRegistry().register(new ItemBlockConnector()); + registerItemForBlock(itemRegistryEvent, invCableConnector); itemRegistryEvent.getRegistry().register(new ItemBlockPainted(invProxy, new Item.Properties().group(STORAGE_MOD_TAB))); registerItemForBlock(itemRegistryEvent, craftingTerminal); + registerItemForBlock(itemRegistryEvent, invHopperBasic); itemRegistryEvent.getRegistry().register(paintingKit); itemRegistryEvent.getRegistry().register(wirelessTerminal); @@ -188,6 +195,8 @@ public static void onTileRegistry(final RegistryEvent.Register invProxyTile.setRegistryName("ts.inventory_proxy.tile"); craftingTerminalTile = TileEntityType.Builder.create(TileEntityCraftingTerminal::new, craftingTerminal).build(null); craftingTerminalTile.setRegistryName("ts.crafting_terminal.tile"); + invHopperBasicTile = TileEntityType.Builder.create(TileEntityInventoryHopperBasic::new, invHopperBasic).build(null); + invHopperBasicTile.setRegistryName("ts.inventoty_hopper_basic.tile"); tileRegistryEvent.getRegistry().register(connectorTile); tileRegistryEvent.getRegistry().register(terminalTile); tileRegistryEvent.getRegistry().register(openCrateTile); @@ -195,6 +204,7 @@ public static void onTileRegistry(final RegistryEvent.Register tileRegistryEvent.getRegistry().register(invCableConnectorTile); tileRegistryEvent.getRegistry().register(invProxyTile); tileRegistryEvent.getRegistry().register(craftingTerminalTile); + tileRegistryEvent.getRegistry().register(invHopperBasicTile); } @SubscribeEvent diff --git a/src/main/java/com/tom/storagemod/StorageTags.java b/src/main/java/com/tom/storagemod/StorageTags.java index 3be53f83..da00419a 100644 --- a/src/main/java/com/tom/storagemod/StorageTags.java +++ b/src/main/java/com/tom/storagemod/StorageTags.java @@ -2,9 +2,8 @@ import net.minecraft.block.Block; import net.minecraft.tags.BlockTags; -import net.minecraft.tags.Tag; -import net.minecraft.util.ResourceLocation; +import net.minecraft.tags.ITag; public class StorageTags { - public static final Tag REMOTE_ACTIVATE = new BlockTags.Wrapper(new ResourceLocation("toms_storage", "remote_activate")); + public static final ITag.INamedTag REMOTE_ACTIVATE = BlockTags.makeWrapperTag("toms_storage:remote_activate"); } diff --git a/src/main/java/com/tom/storagemod/block/BlockInventoryCable.java b/src/main/java/com/tom/storagemod/block/BlockInventoryCable.java index 163bdc7a..c5859758 100644 --- a/src/main/java/com/tom/storagemod/block/BlockInventoryCable.java +++ b/src/main/java/com/tom/storagemod/block/BlockInventoryCable.java @@ -9,8 +9,8 @@ import net.minecraft.block.SixWayBlock; import net.minecraft.block.material.Material; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; @@ -44,6 +44,14 @@ public class BlockInventoryCable extends SixWayBlock implements IWaterLoggable, public BlockInventoryCable() { super(0.125f, Block.Properties.create(Material.WOOD).hardnessAndResistance(2).harvestTool(ToolType.AXE)); setRegistryName("ts.inventory_cable"); + setDefaultState(getDefaultState() + .with(DOWN, false) + .with(UP, false) + .with(NORTH, false) + .with(EAST, false) + .with(SOUTH, false) + .with(WEST, false) + .with(WATERLOGGED, false)); } @Override @@ -59,7 +67,7 @@ protected void fillStateContainer(Builder builder) { } @Override - public IFluidState getFluidState(BlockState state) { + public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); } @@ -74,7 +82,7 @@ public BlockState updatePostPlacement(BlockState stateIn, Direction facing, Bloc @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); + FluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); return withConnectionProperties(context.getWorld(), context.getPos()). with(WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); } diff --git a/src/main/java/com/tom/storagemod/block/BlockInventoryCableConnector.java b/src/main/java/com/tom/storagemod/block/BlockInventoryCableConnector.java index bc6949f0..67380870 100644 --- a/src/main/java/com/tom/storagemod/block/BlockInventoryCableConnector.java +++ b/src/main/java/com/tom/storagemod/block/BlockInventoryCableConnector.java @@ -10,23 +10,17 @@ import net.minecraft.block.SixWayBlock; import net.minecraft.block.material.Material; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.DyeColor; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; -import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; -import net.minecraft.util.Hand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; @@ -50,7 +44,7 @@ public class BlockInventoryCableConnector extends ContainerBlock implements IInv public static final BooleanProperty EAST = BlockStateProperties.EAST; public static final BooleanProperty WEST = BlockStateProperties.WEST; public static final DirectionProperty FACING = BlockStateProperties.FACING; - public static final EnumProperty COLOR = EnumProperty.create("color", DyeColor.class); + //public static final EnumProperty COLOR = EnumProperty.create("color", DyeColor.class); private static final Direction[] FACING_VALUES = Direction.values(); protected VoxelShape[][] shapes; @@ -58,6 +52,14 @@ public BlockInventoryCableConnector() { super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).notSolid().harvestTool(ToolType.AXE)); setRegistryName("ts.inventory_cable_connector"); this.shapes = this.makeShapes(0.125f); + setDefaultState(getDefaultState() + .with(DOWN, false) + .with(UP, false) + .with(NORTH, false) + .with(EAST, false) + .with(SOUTH, false) + .with(WEST, false) + .with(FACING, Direction.DOWN)); } @Override @@ -79,7 +81,7 @@ public BlockRenderType getRenderType(BlockState p_149645_1_) { @Override protected void fillStateContainer(Builder builder) { - builder.add(UP, DOWN, NORTH, SOUTH, EAST, WEST, FACING, COLOR); + builder.add(UP, DOWN, NORTH, SOUTH, EAST, WEST, FACING);//COLOR } @Override @@ -136,7 +138,7 @@ private boolean canConnect(BlockState state, BlockState block, Direction dir) { return (dir != f && IInventoryCable.canConnect(block, dir)) || (dir == f && !block.isAir()); } - @Override + /*@Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { //this.shapes = this.makeShapes(0.125f); @@ -148,7 +150,7 @@ public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockP return ActionResultType.SUCCESS; } return ActionResultType.PASS; - } + }*/ @Override public BlockState rotate(BlockState blockState_1, Rotation blockRotation_1) { diff --git a/src/main/java/com/tom/storagemod/block/BlockInventoryCableFramed.java b/src/main/java/com/tom/storagemod/block/BlockInventoryCableFramed.java index d8678cc1..7be1b64d 100644 --- a/src/main/java/com/tom/storagemod/block/BlockInventoryCableFramed.java +++ b/src/main/java/com/tom/storagemod/block/BlockInventoryCableFramed.java @@ -44,6 +44,13 @@ public class BlockInventoryCableFramed extends ContainerBlock implements IInvent public BlockInventoryCableFramed() { super(Block.Properties.create(Material.WOOD).hardnessAndResistance(2).notSolid().harvestTool(ToolType.AXE)); setRegistryName("ts.inventory_cable_framed"); + setDefaultState(getDefaultState() + .with(DOWN, false) + .with(UP, false) + .with(NORTH, false) + .with(EAST, false) + .with(SOUTH, false) + .with(WEST, false)); } @Override diff --git a/src/main/java/com/tom/storagemod/block/BlockInventoryHopperBasic.java b/src/main/java/com/tom/storagemod/block/BlockInventoryHopperBasic.java new file mode 100644 index 00000000..1ffb4db4 --- /dev/null +++ b/src/main/java/com/tom/storagemod/block/BlockInventoryHopperBasic.java @@ -0,0 +1,146 @@ +package com.tom.storagemod.block; + +import java.util.Collections; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.block.ContainerBlock; +import net.minecraft.block.material.Material; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemStack; +import net.minecraft.state.DirectionProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.ToolType; + +import com.tom.storagemod.proxy.ClientProxy; +import com.tom.storagemod.tile.TileEntityInventoryHopperBasic; + +public class BlockInventoryHopperBasic extends ContainerBlock implements IInventoryCable { + public static final DirectionProperty FACING = BlockStateProperties.FACING; + + public BlockInventoryHopperBasic() { + super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).notSolid().harvestTool(ToolType.AXE)); + setRegistryName("ts.inventory_hopper_basic"); + setDefaultState(getDefaultState() + .with(FACING, Direction.DOWN)); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, + ITooltipFlag flagIn) { + ClientProxy.tooltip("inventory_hopper", tooltip); + } + + @Override + public TileEntity createNewTileEntity(IBlockReader worldIn) { + return new TileEntityInventoryHopperBasic(); + } + @Override + public BlockState rotate(BlockState state, Rotation rot) { + return state.with(FACING, rot.rotate(state.get(FACING))); + } + + @Override + public BlockState mirror(BlockState state, Mirror mirrorIn) { + return state.rotate(mirrorIn.toRotation(state.get(FACING))); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + return getDefaultState().with(FACING, context.getFace().getOpposite()); + } + + @Override + protected void fillStateContainer(Builder builder) { + builder.add(FACING); + } + + @Override + public BlockRenderType getRenderType(BlockState p_149645_1_) { + return BlockRenderType.MODEL; + } + + @Override + public List next(World world, BlockState state, BlockPos pos) { + return Collections.emptyList(); + } + + @Override + public boolean canConnectFrom(BlockState state, Direction dir) { + return state.get(FACING).getAxis() == dir.getAxis(); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + switch (state.get(FACING)) { + case DOWN: + return VoxelShapes.or(makeCuboidShape(5, 0, 5, 11, 6, 11), makeCuboidShape(3, 6, 3, 13, 16, 13)); + case EAST: + return VoxelShapes.or(makeCuboidShape(10, 5, 5, 16, 11, 11), makeCuboidShape(0, 3, 3, 10, 13, 13)); + case NORTH: + return VoxelShapes.or(makeCuboidShape(5, 5, 0, 11, 11, 6), makeCuboidShape(3, 3, 6, 13, 13, 16)); + case SOUTH: + return VoxelShapes.or(makeCuboidShape(5, 5, 10, 11, 11, 16), makeCuboidShape(3, 3, 0, 13, 13, 10)); + case UP: + return VoxelShapes.or(makeCuboidShape(5, 10, 5, 11, 16, 11), makeCuboidShape(3, 0, 3, 13, 10, 13)); + case WEST: + return VoxelShapes.or(makeCuboidShape(0, 5, 5, 6, 11, 11), makeCuboidShape(6, 3, 3, 16, 13, 13)); + default: + break; + } + return VoxelShapes.fullCube(); + } + + @Override + public ActionResultType onBlockActivated(BlockState st, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockRayTraceResult trace) { + if(!world.isRemote) { + ItemStack is = player.getHeldItem(hand); + if(!is.isEmpty()) { + TileEntity te = world.getTileEntity(pos); + if(te instanceof TileEntityInventoryHopperBasic) { + ((TileEntityInventoryHopperBasic)te).setFilter(is.copy()); + ITextComponent txt = ((TileEntityInventoryHopperBasic)te).getFilter().getDisplayName(); + player.sendStatusMessage(new TranslationTextComponent("tooltip.toms_storage.filter_item", txt), true); + } + } else { + TileEntity te = world.getTileEntity(pos); + if(te instanceof TileEntityInventoryHopperBasic) { + if(player.isSneaking()) { + ((TileEntityInventoryHopperBasic)te).setFilter(ItemStack.EMPTY); + player.sendStatusMessage(new TranslationTextComponent("tooltip.toms_storage.filter_item", new TranslationTextComponent("tooltip.toms_storage.empty")), true); + } else { + ItemStack s = ((TileEntityInventoryHopperBasic)te).getFilter(); + ITextComponent txt = s.isEmpty() ? new TranslationTextComponent("tooltip.toms_storage.empty") : s.getDisplayName(); + player.sendStatusMessage(new TranslationTextComponent("tooltip.toms_storage.filter_item", txt), true); + } + } + } + } + return ActionResultType.SUCCESS; + } +} diff --git a/src/main/java/com/tom/storagemod/block/BlockInventoryProxy.java b/src/main/java/com/tom/storagemod/block/BlockInventoryProxy.java index ffce13d2..85f80c82 100644 --- a/src/main/java/com/tom/storagemod/block/BlockInventoryProxy.java +++ b/src/main/java/com/tom/storagemod/block/BlockInventoryProxy.java @@ -1,6 +1,8 @@ package com.tom.storagemod.block; +import java.util.HashMap; import java.util.List; +import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; @@ -8,15 +10,24 @@ import net.minecraft.block.ContainerBlock; import net.minecraft.block.material.Material; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.container.Container; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.state.DirectionProperty; +import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.IStringSerializable; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockReader; @@ -32,10 +43,12 @@ public class BlockInventoryProxy extends ContainerBlock implements IPaintable { public static final DirectionProperty FACING = BlockStateProperties.FACING; + public static final EnumProperty FILTER_FACING = EnumProperty.create("filter_facing", DirectionWithNull.class); public BlockInventoryProxy() { super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).harvestTool(ToolType.AXE)); setRegistryName("ts.inventory_proxy"); + setDefaultState(getDefaultState().with(FACING, Direction.DOWN).with(FILTER_FACING, DirectionWithNull.NULL)); } @Override @@ -67,7 +80,7 @@ public BlockState getStateForPlacement(BlockItemUseContext context) { @Override protected void fillStateContainer(Builder builder) { - builder.add(FACING); + builder.add(FACING, FILTER_FACING); } @Override @@ -82,4 +95,87 @@ public boolean paint(World world, BlockPos pos, BlockState to) { return ((TileEntityPainted)te).setPaintedBlockState(to); return false; } + + @Override + public List getDrops(BlockState state, net.minecraft.loot.LootContext.Builder builder) { + List stacks = super.getDrops(state, builder); + if(state.get(FILTER_FACING) != DirectionWithNull.NULL) + stacks.add(new ItemStack(Items.DIAMOND)); + return stacks; + } + + @Override + public boolean hasComparatorInputOverride(BlockState state) { + return true; + } + + @Override + public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) { + TileEntity te = world.getTileEntity(pos); + if(state.get(FILTER_FACING) != DirectionWithNull.NULL) { + if(te instanceof TileEntityInventoryProxy) { + return ((TileEntityInventoryProxy) te).getComparatorOutput(); + } + } + return Container.calcRedstone(te); + } + + @Override + public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockRayTraceResult hit) { + ItemStack stack = player.getHeldItem(hand); + if(stack.getItem() == Items.DIAMOND && state.get(FACING) != hit.getFace()) { + if(state.get(FILTER_FACING) == DirectionWithNull.NULL && !player.abilities.isCreativeMode) { + stack.shrink(1); + } + world.setBlockState(pos, state.with(FILTER_FACING, DirectionWithNull.of(hit.getFace()))); + return ActionResultType.SUCCESS; + } + return ActionResultType.PASS; + } + + public static enum DirectionWithNull implements IStringSerializable { + NULL("notset"), + DOWN(Direction.DOWN), + UP(Direction.UP), + NORTH(Direction.NORTH), + SOUTH(Direction.SOUTH), + WEST(Direction.WEST), + EAST(Direction.EAST) + ; + private final String name; + private final Direction dir; + + private static final Map dir2dirwn = new HashMap<>(); + + static { + for (DirectionWithNull dwn : values()) { + if(dwn.dir != null) + dir2dirwn.put(dwn.dir, dwn); + } + } + + private DirectionWithNull(Direction dir) { + this.name = dir.getString(); + this.dir = dir; + } + + public static DirectionWithNull of(Direction side) { + return dir2dirwn.get(side); + } + + private DirectionWithNull(String name) { + this.name = name; + dir = null; + } + + @Override + public String getString() { + return name; + } + + public Direction getDir() { + return dir; + } + } } diff --git a/src/main/java/com/tom/storagemod/block/BlockOpenCrate.java b/src/main/java/com/tom/storagemod/block/BlockOpenCrate.java index 847b9a61..c4339701 100644 --- a/src/main/java/com/tom/storagemod/block/BlockOpenCrate.java +++ b/src/main/java/com/tom/storagemod/block/BlockOpenCrate.java @@ -13,6 +13,7 @@ import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.text.ITextComponent; @@ -30,6 +31,7 @@ public class BlockOpenCrate extends ContainerBlock { public BlockOpenCrate() { super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).harvestTool(ToolType.AXE)); setRegistryName("ts.open_crate"); + setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN)); } @Override diff --git a/src/main/java/com/tom/storagemod/block/CableConnectorModelGenerator.java b/src/main/java/com/tom/storagemod/block/CableConnectorModelGenerator.java index d0f94880..4ea03218 100644 --- a/src/main/java/com/tom/storagemod/block/CableConnectorModelGenerator.java +++ b/src/main/java/com/tom/storagemod/block/CableConnectorModelGenerator.java @@ -9,7 +9,6 @@ import java.util.List; import java.util.Map; -import net.minecraft.item.DyeColor; import net.minecraft.util.Direction; import com.google.gson.Gson; @@ -76,7 +75,7 @@ public static void main(String[] args) { if(!ROT[facing.ordinal()].isEmpty())model.put(ROT[facing.ordinal()].substring(0, 1), Integer.parseInt(ROT[facing.ordinal()].substring(1))); } } - for (DyeColor color : DyeColor.values()) { + /*for (DyeColor color : DyeColor.values()) { for (Direction facing : Direction.values()) { { Map part = new HashMap<>(); @@ -84,7 +83,7 @@ public static void main(String[] args) { Map when = new HashMap<>(); part.put("when", when); when.put("facing", facing.getName2()); - when.put("color", color.getName()); + //when.put("color", color.getName()); Map model = new HashMap<>(); part.put("apply", model); model.put("model", "toms_storage:block/cable_connector/color_" + color.getName()); @@ -100,7 +99,7 @@ public static void main(String[] args) { } catch (FileNotFoundException e) { e.printStackTrace(); } - } + }*/ File out = new File(blockstates, "ts.inventory_cable_connector.json"); try (PrintWriter wr = new PrintWriter(out)){ gson.toJson(Collections.singletonMap("multipart", multipart), wr); diff --git a/src/main/java/com/tom/storagemod/block/InventoryConnector.java b/src/main/java/com/tom/storagemod/block/InventoryConnector.java index 37a24102..cf8aafcb 100644 --- a/src/main/java/com/tom/storagemod/block/InventoryConnector.java +++ b/src/main/java/com/tom/storagemod/block/InventoryConnector.java @@ -1,5 +1,6 @@ package com.tom.storagemod.block; +import java.util.Collections; import java.util.List; import net.minecraft.block.Block; @@ -10,8 +11,10 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -20,7 +23,7 @@ import com.tom.storagemod.proxy.ClientProxy; import com.tom.storagemod.tile.TileEntityInventoryConnector; -public class InventoryConnector extends ContainerBlock { +public class InventoryConnector extends ContainerBlock implements IInventoryCable { public InventoryConnector() { super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).harvestTool(ToolType.AXE)); @@ -43,4 +46,9 @@ public void addInformation(ItemStack stack, IBlockReader worldIn, List next(World world, BlockState state, BlockPos pos) { + return Collections.emptyList(); + } } diff --git a/src/main/java/com/tom/storagemod/block/StorageTerminalBase.java b/src/main/java/com/tom/storagemod/block/StorageTerminalBase.java index b0d442a5..b629f899 100644 --- a/src/main/java/com/tom/storagemod/block/StorageTerminalBase.java +++ b/src/main/java/com/tom/storagemod/block/StorageTerminalBase.java @@ -7,8 +7,8 @@ import net.minecraft.block.IWaterLoggable; import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.BooleanProperty; import net.minecraft.state.DirectionProperty; @@ -45,8 +45,8 @@ public abstract class StorageTerminalBase extends ContainerBlock implements IWat private static final VoxelShape SHAPE_U = Block.makeCuboidShape(0.0D, 10.0D, 0.0D, 16.0D, 16.0D, 16.0D); private static final VoxelShape SHAPE_D = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D); public StorageTerminalBase() { - super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).harvestTool(ToolType.AXE).lightValue(6)); - setDefaultState(getDefaultState().with(TERMINAL_POS, TerminalPos.CENTER)); + super(Block.Properties.create(Material.WOOD).hardnessAndResistance(3).harvestTool(ToolType.AXE).setLightLevel(s -> 6)); + setDefaultState(getDefaultState().with(TERMINAL_POS, TerminalPos.CENTER).with(WATERLOGGED, false).with(FACING, Direction.NORTH)); } @Override @@ -86,7 +86,7 @@ public BlockState mirror(BlockState state, Mirror mirrorIn) { @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Direction direction = context.getFace().getOpposite(); - IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); + FluidState ifluidstate = context.getWorld().getFluidState(context.getPos()); TerminalPos pos = TerminalPos.CENTER; if(direction.getAxis() == Direction.Axis.Y) { if(direction == Direction.UP)pos = TerminalPos.UP; @@ -99,7 +99,7 @@ public BlockState getStateForPlacement(BlockItemUseContext context) { } @Override - public IFluidState getFluidState(BlockState state) { + public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state); } @@ -154,7 +154,7 @@ private TerminalPos(String name) { } @Override - public String getName() { + public String getString() { return name; } } diff --git a/src/main/java/com/tom/storagemod/gui/ContainerCraftingTerminal.java b/src/main/java/com/tom/storagemod/gui/ContainerCraftingTerminal.java index 16ef4d9a..56447aa4 100644 --- a/src/main/java/com/tom/storagemod/gui/ContainerCraftingTerminal.java +++ b/src/main/java/com/tom/storagemod/gui/ContainerCraftingTerminal.java @@ -215,7 +215,7 @@ public int getSize() { @Override public java.util.List getRecipeBookCategories() { - return Lists.newArrayList(RecipeBookCategories.SEARCH, RecipeBookCategories.EQUIPMENT, RecipeBookCategories.BUILDING_BLOCKS, RecipeBookCategories.MISC, RecipeBookCategories.REDSTONE); + return Lists.newArrayList(RecipeBookCategories.SEARCH, RecipeBookCategories.CRAFTING_EQUIPMENT, RecipeBookCategories.CRAFTING_BUILDING_BLOCKS, RecipeBookCategories.CRAFTING_MISC, RecipeBookCategories.CRAFTING_REDSTONE); } public class TerminalRecipeItemHelper extends RecipeItemHelper { diff --git a/src/main/java/com/tom/storagemod/gui/ContainerStorageTerminal.java b/src/main/java/com/tom/storagemod/gui/ContainerStorageTerminal.java index 4a1d9453..bce4b94a 100644 --- a/src/main/java/com/tom/storagemod/gui/ContainerStorageTerminal.java +++ b/src/main/java/com/tom/storagemod/gui/ContainerStorageTerminal.java @@ -29,6 +29,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.google.common.collect.Lists; @@ -192,38 +193,38 @@ public int getSlotIndex() { } @OnlyIn(Dist.CLIENT) - public void drawSlot(GuiStorageTerminalBase gui, int mouseX, int mouseY) { + public void drawSlot(MatrixStack st, GuiStorageTerminalBase gui, int mouseX, int mouseY) { if (mouseX >= gui.getGuiLeft() + xDisplayPosition - 1 && mouseY >= gui.getGuiTop() + yDisplayPosition - 1 && mouseX < gui.getGuiLeft() + xDisplayPosition + 17 && mouseY < gui.getGuiTop() + yDisplayPosition + 17) { //RenderUtil.setColourWithAlphaPercent(0xFFFFFF, 60); int l = gui.getGuiLeft() + xDisplayPosition; int t = gui.getGuiTop() + yDisplayPosition; - GuiStorageTerminal.fill(l, t, l+16, t+16, 0x80FFFFFF); + GuiStorageTerminal.fill(st, l, t, l+16, t+16, 0x80FFFFFF); } if (stack != null) { - RenderSystem.pushMatrix(); - gui.renderItemInGui(stack.getStack().copy().split(1), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition, 0, 0, false, 0xFFFFFF, false); + st.push(); + gui.renderItemInGui(st, stack.getStack().copy().split(1), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition, 0, 0, false, 0xFFFFFF, false); FontRenderer r = stack.getStack().getItem().getFontRenderer(stack.getStack()); if(r == null)r = gui.getFont(); - this.drawStackSize(r, stack.getQuantity(), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition); - RenderSystem.popMatrix(); + this.drawStackSize(st, r, stack.getQuantity(), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition); + st.pop(); } } @OnlyIn(Dist.CLIENT) - public boolean drawTooltip(GuiStorageTerminalBase gui, int mouseX, int mouseY) { + public boolean drawTooltip(MatrixStack st, GuiStorageTerminalBase gui, int mouseX, int mouseY) { if (stack != null) { if (stack.getQuantity() > 9999) { - gui.renderItemInGui(stack.getStack(), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition, mouseX, mouseY, false, 0, true, I18n.format("tooltip.toms_storage.amount", stack.getQuantity())); + gui.renderItemInGui(st, stack.getStack(), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition, mouseX, mouseY, false, 0, true, I18n.format("tooltip.toms_storage.amount", stack.getQuantity())); } else { - gui.renderItemInGui(stack.getStack(), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition, mouseX, mouseY, false, 0, true); + gui.renderItemInGui(st, stack.getStack(), gui.getGuiLeft() + xDisplayPosition, gui.getGuiTop() + yDisplayPosition, mouseX, mouseY, false, 0, true); } } return mouseX >= (gui.getGuiLeft() + xDisplayPosition) - 1 && mouseY >= (gui.getGuiTop() + yDisplayPosition) - 1 && mouseX < (gui.getGuiLeft() + xDisplayPosition) + 17 && mouseY < (gui.getGuiTop() + yDisplayPosition) + 17; } @OnlyIn(Dist.CLIENT) - private void drawStackSize(FontRenderer fr, long size, int x, int y) { + private void drawStackSize(MatrixStack st, FontRenderer fr, long size, int x, int y) { float scaleFactor = 0.6f; //boolean unicodeFlag = fr.getUnicodeFlag(); //fr.setUnicodeFlag(false); @@ -231,14 +232,14 @@ private void drawStackSize(FontRenderer fr, long size, int x, int y) { RenderSystem.disableDepthTest(); RenderSystem.disableBlend(); String stackSize = formatNumber(size); - RenderSystem.pushMatrix(); - RenderSystem.scaled(scaleFactor, scaleFactor, scaleFactor); - RenderSystem.translated(0, 0, 450); + st.push(); + st.scale(scaleFactor, scaleFactor, scaleFactor); + st.translate(0, 0, 450); float inverseScaleFactor = 1.0f / scaleFactor; int X = (int) (((float) x + 0 + 16.0f - fr.getStringWidth(stackSize) * scaleFactor) * inverseScaleFactor); int Y = (int) (((float) y + 0 + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor); - fr.drawStringWithShadow(stackSize, X, Y, 16777215); - RenderSystem.popMatrix(); + fr.drawStringWithShadow(st, stackSize, X, Y, 16777215); + st.pop(); RenderSystem.enableLighting(); RenderSystem.enableDepthTest(); //fr.setUnicodeFlag(unicodeFlag); @@ -306,19 +307,19 @@ public final void setSlotContents(int id, StoredItemStack stack) { } @OnlyIn(Dist.CLIENT) - public int drawSlots(GuiStorageTerminalBase gui, int mouseX, int mouseY) { + public int drawSlots(MatrixStack st, GuiStorageTerminalBase gui, int mouseX, int mouseY) { for (int i = 0;i < storageSlotList.size();i++) { - storageSlotList.get(i).drawSlot(gui, mouseX, mouseY); + storageSlotList.get(i).drawSlot(st, gui, mouseX, mouseY); } RenderSystem.disableLighting(); RenderSystem.disableDepthTest(); RenderSystem.disableBlend(); - RenderSystem.pushMatrix(); - RenderSystem.translated(0, 0, 100); + st.push(); + st.translate(0, 0, 100); for (int i = 0;i < storageSlotList.size();i++) { - if (storageSlotList.get(i).drawTooltip(gui, mouseX, mouseY)) { RenderSystem.popMatrix(); return i; } + if (storageSlotList.get(i).drawTooltip(st, gui, mouseX, mouseY)) { st.pop(); return i; } } - RenderSystem.popMatrix(); + st.pop(); return -1; } diff --git a/src/main/java/com/tom/storagemod/gui/GuiCraftingTerminal.java b/src/main/java/com/tom/storagemod/gui/GuiCraftingTerminal.java index 9f5a028e..4178fc56 100644 --- a/src/main/java/com/tom/storagemod/gui/GuiCraftingTerminal.java +++ b/src/main/java/com/tom/storagemod/gui/GuiCraftingTerminal.java @@ -16,6 +16,7 @@ import net.minecraftforge.fml.ModList; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; @@ -130,21 +131,21 @@ public void tick() { } @Override - public void render(int p_render_1_, int p_render_2_, float p_render_3_) { - this.renderBackground(); + public void render(MatrixStack st, int p_render_1_, int p_render_2_, float p_render_3_) { + this.renderBackground(st); if (this.recipeBookGui.isVisible() && this.widthTooNarrow) { - this.drawGuiContainerBackgroundLayer(p_render_3_, p_render_1_, p_render_2_); + this.func_230450_a_(st, p_render_3_, p_render_1_, p_render_2_); RenderSystem.disableLighting(); - this.recipeBookGui.render(p_render_1_, p_render_2_, p_render_3_); + this.recipeBookGui.render(st, p_render_1_, p_render_2_, p_render_3_); } else { RenderSystem.disableLighting(); - this.recipeBookGui.render(p_render_1_, p_render_2_, p_render_3_); - super.render(p_render_1_, p_render_2_, p_render_3_); - this.recipeBookGui.renderGhostRecipe(this.guiLeft, this.guiTop, true, p_render_3_); + this.recipeBookGui.render(st, p_render_1_, p_render_2_, p_render_3_); + super.render(st, p_render_1_, p_render_2_, p_render_3_); + this.recipeBookGui.func_230477_a_(st, this.guiLeft, this.guiTop, true, p_render_3_); } - this.renderHoveredToolTip(p_render_1_, p_render_2_); - this.recipeBookGui.renderTooltip(this.guiLeft, this.guiTop, p_render_1_, p_render_2_); + this.func_230459_a_(st, p_render_1_, p_render_2_); + this.recipeBookGui.func_238924_c_(st, this.guiLeft, this.guiTop, p_render_1_, p_render_2_); this.func_212932_b(this.recipeBookGui); } @@ -200,7 +201,7 @@ private void clearGrid() { public class GuiButtonClear extends Button { public GuiButtonClear(int x, int y, IPressable pressable) { - super(x, y, 11, 11, "", pressable); + super(x, y, 11, 11, null, pressable); } public void setX(int i) { @@ -211,7 +212,7 @@ public void setX(int i) { * Draws this button to the screen. */ @Override - public void renderButton(int mouseX, int mouseY, float pt) { + public void renderButton(MatrixStack st, int mouseX, int mouseY, float pt) { if (this.visible) { mc.getTextureManager().bindTexture(gui); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -220,7 +221,7 @@ public void renderButton(int mouseX, int mouseY, float pt) { RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - this.blit(this.x, this.y, 194 + i * 11, 10, this.width, this.height); + this.blit(st, this.x, this.y, 194 + i * 11, 10, this.width, this.height); } } } diff --git a/src/main/java/com/tom/storagemod/gui/GuiStorageTerminal.java b/src/main/java/com/tom/storagemod/gui/GuiStorageTerminal.java index b0d25e62..49852847 100644 --- a/src/main/java/com/tom/storagemod/gui/GuiStorageTerminal.java +++ b/src/main/java/com/tom/storagemod/gui/GuiStorageTerminal.java @@ -4,6 +4,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; +import com.mojang.blaze3d.matrix.MatrixStack; + public class GuiStorageTerminal extends GuiStorageTerminalBase { private static final ResourceLocation gui = new ResourceLocation("toms_storage", "textures/gui/storage_terminal.png"); @@ -20,18 +22,19 @@ protected void init() { } @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + protected void func_230450_a_(MatrixStack st, float partialTicks, int mouseX, int mouseY) { mc.textureManager.bindTexture(gui); - this.blit(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.blit(st, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); } + @Override public ResourceLocation getGui() { return gui; } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - this.renderBackground(); - super.render(mouseX, mouseY, partialTicks); + public void render(MatrixStack st, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(st); + super.render(st, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/com/tom/storagemod/gui/GuiStorageTerminalBase.java b/src/main/java/com/tom/storagemod/gui/GuiStorageTerminalBase.java index 4280f01f..c8cc54e9 100644 --- a/src/main/java/com/tom/storagemod/gui/GuiStorageTerminalBase.java +++ b/src/main/java/com/tom/storagemod/gui/GuiStorageTerminalBase.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.List; import java.util.regex.Pattern; +import java.util.stream.Collectors; import org.lwjgl.glfw.GLFW; @@ -20,11 +21,15 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.fml.ModList; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; @@ -33,7 +38,6 @@ import com.tom.storagemod.StoredItemStack.IStoredItemStackComparator; import com.tom.storagemod.StoredItemStack.SortingTypes; import com.tom.storagemod.gui.ContainerStorageTerminal.SlotAction; -import com.tom.storagemod.jei.JEIHandler; public abstract class GuiStorageTerminalBase extends ContainerScreen { protected Minecraft mc = Minecraft.getInstance(); @@ -97,8 +101,9 @@ private void sendUpdate() { protected void init() { children.clear(); buttons.clear(); + field_238745_s_ = ySize - 92; super.init(); - this.searchField = new TextFieldWidget(font, this.guiLeft + 82, this.guiTop + 6, 89, this.font.FONT_HEIGHT, searchLast); + this.searchField = new TextFieldWidget(getFont(), this.guiLeft + 82, this.guiTop + 6, 89, this.getFont().FONT_HEIGHT, null); this.searchField.setMaxStringLength(100); this.searchField.setEnableBackgroundDrawing(false); this.searchField.setVisible(true); @@ -117,7 +122,7 @@ protected void init() { sendUpdate(); }) { @Override - public void renderButton(int mouseX, int mouseY, float pt) { + public void renderButton(MatrixStack st, int mouseX, int mouseY, float pt) { if (this.visible) { mc.getTextureManager().bindTexture(getGui()); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -126,10 +131,10 @@ public void renderButton(int mouseX, int mouseY, float pt) { RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - this.blit(this.x, this.y, texX, texY + tile * 16, this.width, this.height); - if((state & 1) > 0)this.blit(this.x+1, this.y+1, texX + 16, texY + tile * 16, this.width-2, this.height-2); - if((state & 2) > 0)this.blit(this.x+1, this.y+1, texX + 16+14, texY + tile * 16, this.width-2, this.height-2); - if((state & 4) > 0)this.blit(this.x+1, this.y+1, texX + 16+14*2, texY + tile * 16, this.width-2, this.height-2); + this.blit(st, this.x, this.y, texX, texY + tile * 16, this.width, this.height); + if((state & 1) > 0)this.blit(st, this.x+1, this.y+1, texX + 16, texY + tile * 16, this.width-2, this.height-2); + if((state & 2) > 0)this.blit(st, this.x+1, this.y+1, texX + 16+14, texY + tile * 16, this.width-2, this.height-2); + if((state & 4) > 0)this.blit(st, this.x+1, this.y+1, texX + 16+14*2, texY + tile * 16, this.width-2, this.height-2); } } }); @@ -184,8 +189,8 @@ protected void updateSearch() { getContainer().scrollTo(0); this.currentScroll = 0; if ((searchType & 4) > 0) { - if(ModList.get().isLoaded("jei")) - JEIHandler.setJeiSearchText(searchString); + //if(ModList.get().isLoaded("jei")) + //JEIHandler.setJeiSearchText(searchString); } if ((searchType & 2) > 0) { CompoundNBT nbt = new CompoundNBT(); @@ -214,7 +219,7 @@ public void tick() { } @Override - public void render(int mouseX, int mouseY, float partialTicks) { + public void render(MatrixStack st, int mouseX, int mouseY, float partialTicks) { boolean flag = GLFW.glfwGetMouseButton(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT) != GLFW.GLFW_RELEASE; int i = this.guiLeft; int j = this.guiTop; @@ -237,7 +242,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { this.currentScroll = MathHelper.clamp(this.currentScroll, 0.0F, 1.0F); getContainer().scrollTo(this.currentScroll); } - super.render(mouseX, mouseY, partialTicks); + super.render(st, mouseX, mouseY, partialTicks); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); @@ -245,24 +250,28 @@ public void render(int mouseX, int mouseY, float partialTicks) { i = k; j = l; k = j1; - this.blit(i, j + (int) ((k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); - RenderSystem.pushMatrix(); + this.blit(st, i, j + (int) ((k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + st.push(); RenderHelper.enableStandardItemLighting(); - slotIDUnderMouse = getContainer().drawSlots(this, mouseX, mouseY); - RenderSystem.popMatrix(); - this.renderHoveredToolTip(mouseX, mouseY); + slotIDUnderMouse = getContainer().drawSlots(st, this, mouseX, mouseY); + st.pop(); + this.func_230459_a_(st, mouseX, mouseY); if (buttonSortingType.isHovered()) { - renderTooltip(Arrays.asList(I18n.format("tooltip.toms_storage.sorting_" + buttonSortingType.state)), mouseX, mouseY); + renderTooltip(st, new TranslationTextComponent("tooltip.toms_storage.sorting_" + buttonSortingType.state), mouseX, mouseY); } if (buttonSearchType.isHovered()) { - renderTooltip(Arrays.asList(I18n.format("tooltip.toms_storage.search_" + buttonSearchType.state)), mouseX, mouseY); + renderTooltip(st, new TranslationTextComponent("tooltip.toms_storage.search_" + buttonSearchType.state), mouseX, mouseY); } if (buttonCtrlMode.isHovered()) { - renderTooltip(Arrays.asList(I18n.format("tooltip.toms_storage.ctrlMode_" + buttonCtrlMode.state).split("\\\\")), mouseX, mouseY); + renderTooltip(st, Arrays.stream(I18n.format("tooltip.toms_storage.ctrlMode_" + buttonCtrlMode.state).split("\\\\")).map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY); } } + /*private void renderTooltip(MatrixStack p0, List p1, int p2, int p3) { + func_238654_b_(p0, p1.stream().map(StringTextComponent::new).collect(Collectors.toList()), p2, p3); + }*/ + protected boolean needsScrollBars() { return this.getContainer().itemListClientSorted.size() > rowCount * 9; } @@ -389,41 +398,43 @@ private ControllMode ctrlm() { return ControllMode.VALUES[controllMode]; } - public final void renderItemInGui(ItemStack stack, int x, int y, int mouseX, int mouseY, boolean hasBg, int color, boolean tooltip, String... extraInfo) { + public final void renderItemInGui(MatrixStack st, ItemStack stack, int x, int y, int mouseX, int mouseY, boolean hasBg, int color, boolean tooltip, String... extraInfo) { if (stack != null) { if (!tooltip) { if (hasBg) { - fill(x, y, 16, 16, color | 0x80000000); + fill(st, x, y, 16, 16, color | 0x80000000); } - RenderSystem.translated(0.0F, 0.0F, 32.0F); - this.setBlitOffset(100); - this.itemRenderer.zLevel = 100.0F; + st.translate(0.0F, 0.0F, 32.0F); + //this.setBlitOffset(100); + //this.itemRenderer.zLevel = 100.0F; FontRenderer font = null; if (stack != null) font = stack.getItem().getFontRenderer(stack); if (font == null) - font = this.font; + font = this.getFont(); RenderSystem.enableDepthTest(); this.itemRenderer.renderItemAndEffectIntoGUI(stack, x, y); this.itemRenderer.renderItemOverlayIntoGUI(font, stack, x, y, null); - this.setBlitOffset(0); - this.itemRenderer.zLevel = 0.0F; + //this.setBlitOffset(0); + //this.itemRenderer.zLevel = 0.0F; } else if (mouseX >= x - 1 && mouseY >= y - 1 && mouseX < x + 17 && mouseY < y + 17) { - List list = getTooltipFromItem(stack); + List list = getTooltipFromItem(stack); // list.add(I18n.format("tomsmod.gui.amount", stack.stackSize)); if (extraInfo != null && extraInfo.length > 0) { for (int i = 0; i < extraInfo.length; i++) { - list.add(extraInfo[i]); + list.add(new StringTextComponent(extraInfo[i])); } } for (int i = 0;i < list.size();++i) { + ITextComponent t = list.get(i); + IFormattableTextComponent t2 = t instanceof IFormattableTextComponent ? (IFormattableTextComponent) t : t.deepCopy(); if (i == 0) { - list.set(i, stack.getRarity().color + list.get(i)); + list.set(i, t2.func_240699_a_(stack.getRarity().color)); } else { - list.set(i, TextFormatting.GRAY + list.get(i)); + list.set(i, t2.func_240699_a_(TextFormatting.GRAY)); } } - this.renderTooltip(list, mouseX, mouseY); + this.renderTooltip(st, list, mouseX, mouseY); } } } @@ -464,9 +475,9 @@ public boolean mouseScrolled(double p_mouseScrolled_1_, double p_mouseScrolled_3 public abstract ResourceLocation getGui(); @Override - protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + protected void func_230450_a_(MatrixStack st, float partialTicks, int mouseX, int mouseY) { mc.textureManager.bindTexture(getGui()); - this.blit(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.blit(st, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); } public class GuiButton extends Button { @@ -475,7 +486,7 @@ public class GuiButton extends Button { protected int texX = 194; protected int texY = 30; public GuiButton(int x, int y, int tile, IPressable pressable) { - super(x, y, 16, 16, "", pressable); + super(x, y, 16, 16, null, pressable); this.tile = tile; } @@ -487,7 +498,7 @@ public void setX(int i) { * Draws this button to the screen. */ @Override - public void renderButton(int mouseX, int mouseY, float pt) { + public void renderButton(MatrixStack st, int mouseX, int mouseY, float pt) { if (this.visible) { mc.getTextureManager().bindTexture(getGui()); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -496,10 +507,16 @@ public void renderButton(int mouseX, int mouseY, float pt) { RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - this.blit(this.x, this.y, texX + state * 16, texY + tile * 16, this.width, this.height); + this.blit(st, this.x, this.y, texX + state * 16, texY + tile * 16, this.width, this.height); } } } protected void onUpdateSearch(String text) {} + + /*@Override + protected void func_230451_b_(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) { + this.font.func_238422_b_(p_230451_1_, this.title, this.field_238742_p_, this.field_238743_q_, 4210752); + this.font.func_238422_b_(p_230451_1_, this.playerInventory.getDisplayName(), this.field_238744_r_, this.field_238745_s_, 4210752); + }*/ } diff --git a/src/main/java/com/tom/storagemod/item/ItemBlockPainted.java b/src/main/java/com/tom/storagemod/item/ItemBlockPainted.java index 3de23deb..9029db05 100644 --- a/src/main/java/com/tom/storagemod/item/ItemBlockPainted.java +++ b/src/main/java/com/tom/storagemod/item/ItemBlockPainted.java @@ -6,6 +6,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTUtil; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; @@ -21,12 +22,12 @@ public ItemBlockPainted(Block block) { @Override public ITextComponent getDisplayName(ItemStack is) { - ITextComponent tc = super.getDisplayName(is); + IFormattableTextComponent tc = (IFormattableTextComponent) super.getDisplayName(is); if(is.hasTag() && is.getTag().getCompound("BlockEntityTag").contains("block")) { BlockState st = NBTUtil.readBlockState(is.getTag().getCompound("BlockEntityTag").getCompound("block")); - tc.appendText(" ("); - tc.appendSibling(st.getBlock().getNameTextComponent().applyTextStyle(TextFormatting.GREEN)); - tc.appendText(")"); + tc.func_240702_b_(" ("); + tc.func_230529_a_(st.getBlock().getTranslatedName().func_240701_a_(TextFormatting.GREEN)); + tc.func_240702_b_(")"); } return tc; } diff --git a/src/main/java/com/tom/storagemod/item/ItemPaintKit.java b/src/main/java/com/tom/storagemod/item/ItemPaintKit.java index c267621c..af189249 100644 --- a/src/main/java/com/tom/storagemod/item/ItemPaintKit.java +++ b/src/main/java/com/tom/storagemod/item/ItemPaintKit.java @@ -15,6 +15,7 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -82,12 +83,12 @@ public ActionResultType onItemUse(ItemUseContext context) { @Override public ITextComponent getDisplayName(ItemStack is) { - ITextComponent tc = super.getDisplayName(is); + IFormattableTextComponent tc = (IFormattableTextComponent) super.getDisplayName(is); if(is.hasTag() && is.getTag().contains("block")) { BlockState st = NBTUtil.readBlockState(is.getTag().getCompound("block")); - tc.appendText(" ("); - tc.appendSibling(st.getBlock().getNameTextComponent().applyTextStyle(TextFormatting.GREEN)); - tc.appendText(")"); + tc.func_240702_b_(" ("); + tc.func_230529_a_(st.getBlock().getTranslatedName().func_240701_a_(TextFormatting.GREEN)); + tc.func_240702_b_(")"); } return tc; } diff --git a/src/main/java/com/tom/storagemod/jei/CraftingTerminalTransferHandler.java b/src/main/java/com/tom/storagemod/jei/CraftingTerminalTransferHandler.java index 6bf0cdd8..e028b549 100644 --- a/src/main/java/com/tom/storagemod/jei/CraftingTerminalTransferHandler.java +++ b/src/main/java/com/tom/storagemod/jei/CraftingTerminalTransferHandler.java @@ -9,6 +9,8 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; +import com.mojang.blaze3d.matrix.MatrixStack; + import com.google.common.base.Function; import com.tom.storagemod.gui.ContainerCraftingTerminal; @@ -44,7 +46,7 @@ public ItemStack[][] apply(IRecipeLayout t) { }; private static final IRecipeTransferError ERROR_INSTANCE = new IRecipeTransferError() { @Override public IRecipeTransferError.Type getType() { return IRecipeTransferError.Type.INTERNAL; } - @Override public void showError(int mouseX, int mouseY, IRecipeLayout recipeLayout, int recipeX, int recipeY) {} + @Override public void showError(MatrixStack matrixStack, int mouseX, int mouseY, IRecipeLayout recipeLayout, int recipeX, int recipeY) {} }; static { containerClasses.add(ContainerCraftingTerminal.class); diff --git a/src/main/java/com/tom/storagemod/model/BakedPaintedModel.java b/src/main/java/com/tom/storagemod/model/BakedPaintedModel.java index 1833fcca..efec26a0 100644 --- a/src/main/java/com/tom/storagemod/model/BakedPaintedModel.java +++ b/src/main/java/com/tom/storagemod/model/BakedPaintedModel.java @@ -17,7 +17,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ILightReader; +import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.data.IDynamicBakedModel; @@ -86,7 +86,7 @@ public List getQuads(BlockState state, Direction side, Random rand, I } @Override - public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) { + public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) { return tileData; } } diff --git a/src/main/java/com/tom/storagemod/proxy/ClientProxy.java b/src/main/java/com/tom/storagemod/proxy/ClientProxy.java index d6cf85b2..74500093 100644 --- a/src/main/java/com/tom/storagemod/proxy/ClientProxy.java +++ b/src/main/java/com/tom/storagemod/proxy/ClientProxy.java @@ -10,7 +10,6 @@ import net.minecraft.client.gui.ScreenManager; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.renderer.BlockModelShapes; -import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.color.BlockColors; @@ -21,8 +20,9 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; @@ -102,7 +102,7 @@ private static void renderWorldLastEvent(RenderWorldLastEvent evt) { BlockState state = mc.world.getBlockState(lookingAt.getPos()); if(StorageTags.REMOTE_ACTIVATE.contains(state.getBlock())) { BlockPos pos = lookingAt.getPos(); - Vec3d renderPos = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); + Vector3d renderPos = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); Tessellator.getInstance().getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR); MatrixStack ms = evt.getMatrixStack(); ms.translate(pos.getX() - renderPos.x, pos.getY() - renderPos.y, pos.getZ() - renderPos.z); @@ -129,7 +129,7 @@ public static void tooltip(String key, List tooltip) { tooltip.add(new StringTextComponent(sp[i])); } } else { - tooltip.add(new TranslationTextComponent("tooltip.toms_storage.hold_shift_for_info").applyTextStyles(TextFormatting.ITALIC, TextFormatting.GRAY)); + tooltip.add(new TranslationTextComponent("tooltip.toms_storage.hold_shift_for_info").func_240701_a_(TextFormatting.ITALIC, TextFormatting.GRAY)); } } } diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityCraftingTerminal.java b/src/main/java/com/tom/storagemod/tile/TileEntityCraftingTerminal.java index c9f72925..35942b19 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityCraftingTerminal.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityCraftingTerminal.java @@ -4,6 +4,7 @@ import java.util.HashSet; import java.util.List; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.CraftResultInventory; @@ -79,8 +80,8 @@ public CompoundNBT write(CompoundNBT compound) { } private boolean reading; @Override - public void read(CompoundNBT compound) { - super.read(compound); + public void read(BlockState st, CompoundNBT compound) { + super.read(st, compound); reading = true; ListNBT listnbt = compound.getList("CraftingTable", 10); diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryCableConnector.java b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryCableConnector.java index 1eb991db..6f2d1002 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryCableConnector.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryCableConnector.java @@ -6,7 +6,6 @@ import java.util.function.Function; import net.minecraft.block.BlockState; -import net.minecraft.item.DyeColor; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; @@ -23,12 +22,13 @@ import com.tom.storagemod.StorageMod; import com.tom.storagemod.block.BlockInventoryCableConnector; import com.tom.storagemod.block.IInventoryCable; +import com.tom.storagemod.tile.TileEntityInventoryConnector.LinkedInv; public class TileEntityInventoryCableConnector extends TileEntity implements ITickableTileEntity { - private long foundTime; - private TileEntityInventoryCableConnector otherSide; + private TileEntityInventoryConnector master; private LazyOptional invHandler; private LazyOptional pointedAt; + private LinkedInv linv; public TileEntityInventoryCableConnector() { super(StorageMod.invCableConnectorTile); } @@ -38,36 +38,34 @@ public void tick() { if(!world.isRemote && world.getGameTime() % 20 == 19) { BlockState state = world.getBlockState(pos); Direction facing = state.get(BlockInventoryCableConnector.FACING); - if(world.getGameTime() != foundTime) { - DyeColor color = state.get(BlockInventoryCableConnector.COLOR); - Stack toCheck = new Stack<>(); - Set checkedBlocks = new HashSet<>(); - checkedBlocks.add(pos); - toCheck.addAll(((IInventoryCable)state.getBlock()).next(world, state, pos)); - otherSide = null; - while(!toCheck.isEmpty()) { - BlockPos cp = toCheck.pop(); - if(!checkedBlocks.contains(cp)) { - checkedBlocks.add(cp); - if(world.isBlockLoaded(cp)) { - state = world.getBlockState(cp); - if(state.getBlock() == StorageMod.invCableConnector) { - if(state.get(BlockInventoryCableConnector.COLOR) == color) { - TileEntity te = world.getTileEntity(cp); - if(te instanceof TileEntityInventoryCableConnector) { - otherSide = (TileEntityInventoryCableConnector) te; - otherSide.foundTime = world.getGameTime(); - otherSide.otherSide = this; - } - break; - } - } - if(state.getBlock() instanceof IInventoryCable) { - toCheck.addAll(((IInventoryCable)state.getBlock()).next(world, state, cp)); + Stack toCheck = new Stack<>(); + Set checkedBlocks = new HashSet<>(); + checkedBlocks.add(pos); + toCheck.addAll(((IInventoryCable)state.getBlock()).next(world, state, pos)); + if(master != null)master.unLink(linv); + master = null; + linv = new LinkedInv(); + while(!toCheck.isEmpty()) { + BlockPos cp = toCheck.pop(); + if(!checkedBlocks.contains(cp)) { + checkedBlocks.add(cp); + if(world.isBlockLoaded(cp)) { + state = world.getBlockState(cp); + if(state.getBlock() == StorageMod.connector) { + TileEntity te = world.getTileEntity(cp); + if(te instanceof TileEntityInventoryConnector) { + master = (TileEntityInventoryConnector) te; + linv.time = world.getGameTime(); + linv.handler = () -> (pointedAt == null ? LazyOptional.empty() : pointedAt); + master.addLinked(linv); } + break; + } + if(state.getBlock() instanceof IInventoryCable) { + toCheck.addAll(((IInventoryCable)state.getBlock()).next(world, state, cp)); } - if(checkedBlocks.size() > Config.invConnectorMax)break; } + if(checkedBlocks.size() > Config.invConnectorMax)break; } } if(pointedAt == null || !pointedAt.isPresent()) { @@ -95,8 +93,8 @@ private class InvHandler implements IItemHandler, IProxy { public R call(Function func, R def) { if(calling)return def; calling = true; - if(otherSide != null && !otherSide.isRemoved() && otherSide.pointedAt != null) { - R r = func.apply(otherSide.pointedAt.orElse(EmptyHandler.INSTANCE)); + if(master != null && !master.isRemoved()) { + R r = func.apply(master.getInventory().orElse(EmptyHandler.INSTANCE)); calling = false; return r; } @@ -136,8 +134,8 @@ public boolean isItemValid(int slot, ItemStack stack) { @Override public IItemHandler get() { - if(otherSide != null && !otherSide.isRemoved() && otherSide.pointedAt != null) { - return otherSide.pointedAt.orElse(null); + if(master != null && !master.isRemoved()) { + return master.getInventory().orElse(null); } return null; } diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryConnector.java b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryConnector.java index ebb0be76..4216b067 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryConnector.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryConnector.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Set; import java.util.Stack; +import java.util.function.Supplier; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -29,6 +30,7 @@ public class TileEntityInventoryConnector extends TileEntity implements ITickableTileEntity { private List> handlers = new ArrayList<>(); + private List linkedInvs = new ArrayList<>(); private LazyOptional invHandler; private int[] invSizes = new int[0]; private int invSize; @@ -39,7 +41,8 @@ public TileEntityInventoryConnector() { @Override public void tick() { - if(!world.isRemote && world.getGameTime() % 20 == 0) { + long time = world.getGameTime(); + if(!world.isRemote && time % 20 == 0) { Stack toCheck = new Stack<>(); Set checkedBlocks = new HashSet<>(); //Set> equalCheck = new HashSet<>(); @@ -47,6 +50,15 @@ public void tick() { checkedBlocks.add(pos); handlers.clear(); //System.out.println("Start checking invs"); + Set toRM = new HashSet<>(); + for (LinkedInv inv : linkedInvs) { + if(inv.time + 40 < time) { + toRM.add(inv); + continue; + } + handlers.add(inv.handler.get()); + } + linkedInvs.removeAll(toRM); while(!toCheck.isEmpty()) { BlockPos cp = toCheck.pop(); for (Direction d : Direction.values()) { @@ -125,13 +137,17 @@ private boolean checkHandlers(InvHandler ih, int depth) { @Override public LazyOptional getCapability(Capability cap, Direction side) { if (!this.removed && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - if (this.invHandler == null) - this.invHandler = LazyOptional.of(InvHandler::new); - return this.invHandler.cast(); + return getInventory().cast(); } return super.getCapability(cap, side); } + public LazyOptional getInventory() { + if (this.invHandler == null) + this.invHandler = LazyOptional.of(InvHandler::new); + return this.invHandler; + } + private class InvHandler implements IItemHandler { private boolean calling; @@ -235,4 +251,17 @@ public void remove() { if (invHandler != null) invHandler.invalidate(); } + + public void addLinked(LinkedInv inv) { + linkedInvs.add(inv); + } + + public static class LinkedInv { + public Supplier> handler; + public long time; + } + + public void unLink(LinkedInv linv) { + linkedInvs.remove(linv); + } } diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryHopperBase.java b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryHopperBase.java new file mode 100644 index 00000000..164937b8 --- /dev/null +++ b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryHopperBase.java @@ -0,0 +1,116 @@ +package com.tom.storagemod.tile; + +import java.util.HashSet; +import java.util.Set; +import java.util.Stack; + +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.ITickableTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; + +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; + +import com.tom.storagemod.Config; +import com.tom.storagemod.StorageMod; +import com.tom.storagemod.block.BlockInventoryCableConnector; +import com.tom.storagemod.block.IInventoryCable; + +public abstract class TileEntityInventoryHopperBase extends TileEntity implements ITickableTileEntity { + protected boolean topNet, bottomNet; + protected LazyOptional top; + protected LazyOptional bottom; + public TileEntityInventoryHopperBase(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + } + + @Override + public void tick() { + if(!world.isRemote && world.getGameTime() % 20 == 1) { + BlockState state = world.getBlockState(pos); + Direction facing = state.get(BlockInventoryCableConnector.FACING); + Stack toCheck = new Stack<>(); + Set checkedBlocks = new HashSet<>(); + checkedBlocks.add(pos); + BlockPos up = pos.offset(facing.getOpposite()); + BlockPos down = pos.offset(facing); + state = world.getBlockState(up); + if(state.getBlock() instanceof IInventoryCable) { + top = null; + topNet = true; + toCheck.add(up); + while(!toCheck.isEmpty()) { + BlockPos cp = toCheck.pop(); + if(!checkedBlocks.contains(cp)) { + checkedBlocks.add(cp); + if(world.isBlockLoaded(cp)) { + state = world.getBlockState(cp); + if(state.getBlock() == StorageMod.connector) { + TileEntity te = world.getTileEntity(cp); + if(te instanceof TileEntityInventoryConnector) { + top = ((TileEntityInventoryConnector) te).getInventory(); + } + break; + } + if(state.getBlock() instanceof IInventoryCable) { + toCheck.addAll(((IInventoryCable)state.getBlock()).next(world, state, cp)); + } + } + if(checkedBlocks.size() > Config.invConnectorMax)break; + } + } + } else { + topNet = false; + if(top == null || !top.isPresent()) { + TileEntity te = world.getTileEntity(up); + if(te != null) { + top = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); + } + } + } + state = world.getBlockState(down); + if(state.getBlock() instanceof IInventoryCable) { + toCheck.add(down); + bottom = null; + bottomNet = true; + while(!toCheck.isEmpty()) { + BlockPos cp = toCheck.pop(); + if(!checkedBlocks.contains(cp)) { + checkedBlocks.add(cp); + if(world.isBlockLoaded(cp)) { + state = world.getBlockState(cp); + if(state.getBlock() == StorageMod.connector) { + TileEntity te = world.getTileEntity(cp); + if(te instanceof TileEntityInventoryConnector) { + bottom = ((TileEntityInventoryConnector) te).getInventory(); + } + break; + } + if(state.getBlock() instanceof IInventoryCable) { + toCheck.addAll(((IInventoryCable)state.getBlock()).next(world, state, cp)); + } + } + if(checkedBlocks.size() > Config.invConnectorMax)break; + } + } + } else { + bottomNet = false; + if(bottom == null || !bottom.isPresent()) { + TileEntity te = world.getTileEntity(down); + if(te != null) { + bottom = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); + } + } + } + } + if(!world.isRemote && (topNet || bottomNet) && top != null && top.isPresent() && bottom != null && bottom.isPresent()) { + update(); + } + } + + protected abstract void update(); +} diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryHopperBasic.java b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryHopperBasic.java new file mode 100644 index 00000000..aa4982ad --- /dev/null +++ b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryHopperBasic.java @@ -0,0 +1,71 @@ +package com.tom.storagemod.tile; + +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; + +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraftforge.items.wrapper.EmptyHandler; + +import com.tom.storagemod.StorageMod; + +public class TileEntityInventoryHopperBasic extends TileEntityInventoryHopperBase { + private ItemStack filter = ItemStack.EMPTY; + private int cooldown; + public TileEntityInventoryHopperBasic() { + super(StorageMod.invHopperBasicTile); + } + + @Override + protected void update() { + if(topNet && getFilter().isEmpty())return; + if(cooldown > 0) { + cooldown--; + return; + } + boolean hasFilter = !getFilter().isEmpty(); + IItemHandler top = this.top.orElse(EmptyHandler.INSTANCE); + IItemHandler bot = this.bottom.orElse(EmptyHandler.INSTANCE); + for (int i = 0; i < top.getSlots(); i++) { + if(hasFilter) { + ItemStack inSlot = top.getStackInSlot(i); + if(!ItemStack.areItemsEqual(inSlot, getFilter()) || !ItemStack.areItemStackTagsEqual(inSlot, getFilter())) { + continue; + } + } + ItemStack extractItem = top.extractItem(i, 1, true); + if (!extractItem.isEmpty()) { + ItemStack is = ItemHandlerHelper.insertItemStacked(bot, extractItem, true); + if(is.isEmpty()) { + is = ItemHandlerHelper.insertItemStacked(bot, top.extractItem(i, 1, false), false); + cooldown = 10; + if(!is.isEmpty()) { + //Never? + } + return; + } + } + } + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.put("Filter", getFilter().write(new CompoundNBT())); + return super.write(compound); + } + + @Override + public void read(BlockState stateIn, CompoundNBT nbtIn) { + super.read(stateIn, nbtIn); + setFilter(ItemStack.read(nbtIn.getCompound("Filter"))); + } + + public void setFilter(ItemStack filter) { + this.filter = filter; + } + + public ItemStack getFilter() { + return filter; + } +} diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryProxy.java b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryProxy.java index 8c56165c..d2271bfc 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityInventoryProxy.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityInventoryProxy.java @@ -3,23 +3,31 @@ import java.util.function.Function; import net.minecraft.block.BlockState; +import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.wrapper.EmptyHandler; import com.tom.storagemod.StorageMod; import com.tom.storagemod.block.BlockInventoryProxy; +import com.tom.storagemod.block.BlockInventoryProxy.DirectionWithNull; public class TileEntityInventoryProxy extends TileEntityPainted implements ITickableTileEntity { private LazyOptional invHandler; private LazyOptional pointedAt; + private LazyOptional filter; + private boolean ignoreCount; + private int globalCountLimit = 64; + public TileEntityInventoryProxy() { super(StorageMod.invProxyTile); } @@ -37,20 +45,20 @@ public LazyOptional getCapability(Capability cap, Direction side) { return super.getCapability(cap, side); } - private class InvHandler implements IItemHandler, IProxy { - - private boolean calling; - public R call(Function func, R def) { - if(calling)return def; - calling = true; - if(pointedAt != null) { - R r = func.apply(pointedAt.orElse(EmptyHandler.INSTANCE)); - calling = false; - return r; - } + private boolean calling; + public R call(Function func, R def) { + if(calling)return def; + calling = true; + if(pointedAt != null) { + R r = func.apply(pointedAt.orElse(EmptyHandler.INSTANCE)); calling = false; - return def; + return r; } + calling = false; + return def; + } + + private class InvHandler implements IItemHandler, IProxy { @Override public int getSlots() { @@ -102,12 +110,85 @@ public void tick() { if(!world.isRemote && world.getGameTime() % 20 == 18) { BlockState state = world.getBlockState(pos); Direction facing = state.get(BlockInventoryProxy.FACING); + DirectionWithNull filter = state.get(BlockInventoryProxy.FILTER_FACING); if(pointedAt == null || !pointedAt.isPresent()) { TileEntity te = world.getTileEntity(pos.offset(facing)); if(te != null && !(te instanceof TileEntityInventoryProxy)) { pointedAt = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); } } + ignoreCount = false; + globalCountLimit = 64; + if(filter != DirectionWithNull.NULL) { + if(this.filter == null || !this.filter.isPresent()) { + TileEntity te = world.getTileEntity(pos.offset(filter.getDir())); + if(te != null && !(te instanceof TileEntityInventoryProxy)) { + this.filter = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); + this.filter.orElse(EmptyHandler.INSTANCE); + if(te instanceof INamedContainerProvider) { + String[] sp = ((INamedContainerProvider)te).getDisplayName().getString().split(","); + for (String string : sp) { + String[] sp2 = string.split("="); + String key = sp2[0]; + String value = sp2.length > 1 ? sp2[1] : ""; + switch (key) { + case "ignoreSize": + ignoreCount = true; + break; + case "maxCount": + if(!value.isEmpty()) + globalCountLimit = parseInt(value, 64); + break; + default: + break; + } + } + } else { + ignoreCount = false; + globalCountLimit = 64; + } + } + } + } else { + this.filter = null; + } } } + + private int parseInt(String value, int def) { + try { + return Integer.parseInt(value); + } catch (Exception e) { + return def; + } + } + + public int getComparatorOutput() { + return call(inventory -> { + if(filter == null || !filter.isPresent()) { + return ItemHandlerHelper.calcRedstoneFromInventory(inventory); + } + int i = 0; + float f = 0.0F; + + IItemHandler filter = this.filter.orElse(EmptyHandler.INSTANCE); + + int fsize = filter.getSlots(); + + for (int j = 0; j < inventory.getSlots(); j++) { + ItemStack itemStack = inventory.getStackInSlot(j); + ItemStack fstack = fsize > j ? filter.getStackInSlot(j) : ItemStack.EMPTY; + + if (!itemStack.isEmpty()) { + if(fstack.isEmpty() || (ItemStack.areItemsEqual(itemStack, fstack) && ItemStack.areItemStackTagsEqual(itemStack, fstack))) { + f += itemStack.getCount() / Math.min((ignoreCount || fstack.isEmpty() ? globalCountLimit : fstack.getCount()), itemStack.getMaxStackSize()); + i++; + } + } + } + + f /= inventory.getSlots(); + return MathHelper.floor(f * 14.0F) + ((i > 0) ? 1 : 0); + }, 0); + } } diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityOpenCrate.java b/src/main/java/com/tom/storagemod/tile/TileEntityOpenCrate.java index 265939fa..dca68e56 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityOpenCrate.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityOpenCrate.java @@ -14,7 +14,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; @@ -95,7 +95,7 @@ public void setInventorySlotContents(int index, ItemStack stack) { BlockPos p = pos.offset(f); ItemEntity entityitem = new ItemEntity(world, p.getX() + 0.5, p.getY() + 0.5, p.getZ() + 0.5, stack); entityitem.setDefaultPickupDelay(); - entityitem.setMotion(Vec3d.ZERO); + entityitem.setMotion(Vector3d.ZERO); world.addEntity(entityitem); items.add(entityitem); } diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityPainted.java b/src/main/java/com/tom/storagemod/tile/TileEntityPainted.java index e8873c6b..aa5c702d 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityPainted.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityPainted.java @@ -45,8 +45,8 @@ public IModelData getModelData() { } @Override - public void read(@Nonnull CompoundNBT compound) { - super.read(compound); + public void read(BlockState st, @Nonnull CompoundNBT compound) { + super.read(st, compound); blockState = NBTUtil.readBlockState(compound.getCompound("block")); markDirtyClient(); } @@ -92,7 +92,7 @@ public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket packet) { BlockState old = getPaintedBlockState(); CompoundNBT tagCompound = packet.getNbtCompound(); super.onDataPacket(net, packet); - read(tagCompound); + read(world.getBlockState(pos), tagCompound); if (world != null && world.isRemote) { // If needed send a render update. diff --git a/src/main/java/com/tom/storagemod/tile/TileEntityStorageTerminal.java b/src/main/java/com/tom/storagemod/tile/TileEntityStorageTerminal.java index 3f5e848e..e67f92d9 100644 --- a/src/main/java/com/tom/storagemod/tile/TileEntityStorageTerminal.java +++ b/src/main/java/com/tom/storagemod/tile/TileEntityStorageTerminal.java @@ -146,9 +146,9 @@ public CompoundNBT write(CompoundNBT compound) { } @Override - public void read(CompoundNBT compound) { + public void read(BlockState st, CompoundNBT compound) { sort = compound.getInt("sort"); - super.read(compound); + super.read(st, compound); } public String getLastSearch() { diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 309324e7..78ad8994 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -47,6 +47,6 @@ description=''' [[dependencies.toms_storage]] modId="minecraft" mandatory=true - versionRange="[1.15.2]" + versionRange="[1.16.1]" ordering="NONE" side="BOTH" diff --git a/src/main/resources/assets/toms_storage/blockstates/ts.inventory_cable_connector.json b/src/main/resources/assets/toms_storage/blockstates/ts.inventory_cable_connector.json index f189de21..b73c405d 100644 --- a/src/main/resources/assets/toms_storage/blockstates/ts.inventory_cable_connector.json +++ b/src/main/resources/assets/toms_storage/blockstates/ts.inventory_cable_connector.json @@ -234,950 +234,6 @@ "east": "true", "facing": "east" } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_white" - }, - "when": { - "color": "white", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_white" - }, - "when": { - "color": "white", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_white" - }, - "when": { - "color": "white", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_white" - }, - "when": { - "color": "white", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_white" - }, - "when": { - "color": "white", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_white" - }, - "when": { - "color": "white", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_orange" - }, - "when": { - "color": "orange", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_orange" - }, - "when": { - "color": "orange", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_orange" - }, - "when": { - "color": "orange", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_orange" - }, - "when": { - "color": "orange", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_orange" - }, - "when": { - "color": "orange", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_orange" - }, - "when": { - "color": "orange", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_magenta" - }, - "when": { - "color": "magenta", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_magenta" - }, - "when": { - "color": "magenta", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_magenta" - }, - "when": { - "color": "magenta", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_magenta" - }, - "when": { - "color": "magenta", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_magenta" - }, - "when": { - "color": "magenta", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_magenta" - }, - "when": { - "color": "magenta", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_light_blue" - }, - "when": { - "color": "light_blue", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_light_blue" - }, - "when": { - "color": "light_blue", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_light_blue" - }, - "when": { - "color": "light_blue", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_light_blue" - }, - "when": { - "color": "light_blue", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_light_blue" - }, - "when": { - "color": "light_blue", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_light_blue" - }, - "when": { - "color": "light_blue", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_yellow" - }, - "when": { - "color": "yellow", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_yellow" - }, - "when": { - "color": "yellow", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_yellow" - }, - "when": { - "color": "yellow", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_yellow" - }, - "when": { - "color": "yellow", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_yellow" - }, - "when": { - "color": "yellow", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_yellow" - }, - "when": { - "color": "yellow", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_lime" - }, - "when": { - "color": "lime", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_lime" - }, - "when": { - "color": "lime", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_lime" - }, - "when": { - "color": "lime", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_lime" - }, - "when": { - "color": "lime", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_lime" - }, - "when": { - "color": "lime", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_lime" - }, - "when": { - "color": "lime", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_pink" - }, - "when": { - "color": "pink", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_pink" - }, - "when": { - "color": "pink", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_pink" - }, - "when": { - "color": "pink", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_pink" - }, - "when": { - "color": "pink", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_pink" - }, - "when": { - "color": "pink", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_pink" - }, - "when": { - "color": "pink", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_gray" - }, - "when": { - "color": "gray", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_gray" - }, - "when": { - "color": "gray", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_gray" - }, - "when": { - "color": "gray", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_gray" - }, - "when": { - "color": "gray", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_gray" - }, - "when": { - "color": "gray", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_gray" - }, - "when": { - "color": "gray", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_light_gray" - }, - "when": { - "color": "light_gray", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_light_gray" - }, - "when": { - "color": "light_gray", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_light_gray" - }, - "when": { - "color": "light_gray", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_light_gray" - }, - "when": { - "color": "light_gray", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_light_gray" - }, - "when": { - "color": "light_gray", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_light_gray" - }, - "when": { - "color": "light_gray", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_cyan" - }, - "when": { - "color": "cyan", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_cyan" - }, - "when": { - "color": "cyan", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_cyan" - }, - "when": { - "color": "cyan", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_cyan" - }, - "when": { - "color": "cyan", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_cyan" - }, - "when": { - "color": "cyan", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_cyan" - }, - "when": { - "color": "cyan", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_purple" - }, - "when": { - "color": "purple", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_purple" - }, - "when": { - "color": "purple", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_purple" - }, - "when": { - "color": "purple", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_purple" - }, - "when": { - "color": "purple", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_purple" - }, - "when": { - "color": "purple", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_purple" - }, - "when": { - "color": "purple", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_blue" - }, - "when": { - "color": "blue", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_blue" - }, - "when": { - "color": "blue", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_blue" - }, - "when": { - "color": "blue", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_blue" - }, - "when": { - "color": "blue", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_blue" - }, - "when": { - "color": "blue", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_blue" - }, - "when": { - "color": "blue", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_brown" - }, - "when": { - "color": "brown", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_brown" - }, - "when": { - "color": "brown", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_brown" - }, - "when": { - "color": "brown", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_brown" - }, - "when": { - "color": "brown", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_brown" - }, - "when": { - "color": "brown", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_brown" - }, - "when": { - "color": "brown", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_green" - }, - "when": { - "color": "green", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_green" - }, - "when": { - "color": "green", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_green" - }, - "when": { - "color": "green", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_green" - }, - "when": { - "color": "green", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_green" - }, - "when": { - "color": "green", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_green" - }, - "when": { - "color": "green", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_red" - }, - "when": { - "color": "red", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_red" - }, - "when": { - "color": "red", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_red" - }, - "when": { - "color": "red", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_red" - }, - "when": { - "color": "red", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_red" - }, - "when": { - "color": "red", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_red" - }, - "when": { - "color": "red", - "facing": "east" - } - }, - { - "apply": { - "x": 90, - "model": "toms_storage:block/cable_connector/color_black" - }, - "when": { - "color": "black", - "facing": "down" - } - }, - { - "apply": { - "x": -90, - "model": "toms_storage:block/cable_connector/color_black" - }, - "when": { - "color": "black", - "facing": "up" - } - }, - { - "apply": { - "model": "toms_storage:block/cable_connector/color_black" - }, - "when": { - "color": "black", - "facing": "north" - } - }, - { - "apply": { - "y": 180, - "model": "toms_storage:block/cable_connector/color_black" - }, - "when": { - "color": "black", - "facing": "south" - } - }, - { - "apply": { - "y": 270, - "model": "toms_storage:block/cable_connector/color_black" - }, - "when": { - "color": "black", - "facing": "west" - } - }, - { - "apply": { - "y": 90, - "model": "toms_storage:block/cable_connector/color_black" - }, - "when": { - "color": "black", - "facing": "east" - } } ] } \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/blockstates/ts.inventory_hopper_basic.json b/src/main/resources/assets/toms_storage/blockstates/ts.inventory_hopper_basic.json new file mode 100644 index 00000000..ff363831 --- /dev/null +++ b/src/main/resources/assets/toms_storage/blockstates/ts.inventory_hopper_basic.json @@ -0,0 +1,10 @@ +{ + "variants": { + "facing=down": {"model": "toms_storage:block/inventory_hopper_basic"}, + "facing=up": {"model": "toms_storage:block/inventory_hopper_basic", "x": 180}, + "facing=north": {"model": "toms_storage:block/inventory_hopper_basic", "x": 90, "y": 180}, + "facing=south": {"model": "toms_storage:block/inventory_hopper_basic", "x": 90}, + "facing=east": {"model": "toms_storage:block/inventory_hopper_basic", "y": 270, "x": 90}, + "facing=west": {"model": "toms_storage:block/inventory_hopper_basic", "y": 90, "x": 90} + } +} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/blockstates/ts.inventory_proxy.json b/src/main/resources/assets/toms_storage/blockstates/ts.inventory_proxy.json index 58e7338b..f0bc3079 100644 --- a/src/main/resources/assets/toms_storage/blockstates/ts.inventory_proxy.json +++ b/src/main/resources/assets/toms_storage/blockstates/ts.inventory_proxy.json @@ -1,10 +1,111 @@ { - "variants": { - "facing=down": {"model": "toms_storage:block/inventory_proxy"}, - "facing=up": {"model": "toms_storage:block/inventory_proxy", "x": 180}, - "facing=north": {"model": "toms_storage:block/inventory_proxy", "x": 90, "y": 180}, - "facing=south": {"model": "toms_storage:block/inventory_proxy", "x": 90}, - "facing=east": {"model": "toms_storage:block/inventory_proxy", "y": 270, "x": 90}, - "facing=west": {"model": "toms_storage:block/inventory_proxy", "y": 90, "x": 90} - } + "multipart": [ + { + "apply": { + "model": "toms_storage:block/inventory_proxy" + }, + "when": { + "facing": "down" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy", + "x": 180 + }, + "when": { + "facing": "up" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy", + "x": 90, "y": 180 + }, + "when": { + "facing": "north" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy", + "x": 90 + }, + "when": { + "facing": "south" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy", + "y": 270, "x": 90 + }, + "when": { + "facing": "east" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy", + "y": 90, "x": 90 + }, + "when": { + "facing": "west" + } + }, + + { + "apply": { + "model": "toms_storage:block/inventory_proxy_filter" + }, + "when": { + "filter_facing": "down" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy_filter", + "x": 180 + }, + "when": { + "filter_facing": "up" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy_filter", + "x": 90, "y": 180 + }, + "when": { + "filter_facing": "north" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy_filter", + "x": 90 + }, + "when": { + "filter_facing": "south" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy_filter", + "y": 270, "x": 90 + }, + "when": { + "filter_facing": "east" + } + }, + { + "apply": { + "model": "toms_storage:block/inventory_proxy_filter", + "y": 90, "x": 90 + }, + "when": { + "filter_facing": "west" + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/lang/en_us.json b/src/main/resources/assets/toms_storage/lang/en_us.json index 3f9ece19..ed101086 100644 --- a/src/main/resources/assets/toms_storage/lang/en_us.json +++ b/src/main/resources/assets/toms_storage/lang/en_us.json @@ -9,15 +9,19 @@ "block.toms_storage.ts.inventory_cable_connector": "Inventory Cable Connector", "block.toms_storage.ts.inventory_proxy": "Inventory Proxy", "block.toms_storage.ts.crafting_terminal": "Crafting Terminal", + "block.toms_storage.ts.inventory_hopper_basic": "Basic Inventory Hopper", "item.toms_storage.ts.paint_kit": "Paint Kit", "item.toms_storage.ts.wireless_terminal": "Wireless Terminal", "itemGroup.toms_storage": "Tom's Simple Storage", + "ts.storage_terminal": "S. Terminal", + "ts.crafting_terminal": "C. Terminal", + "tooltip.toms_storage.hold_shift_for_info": "Hold SHIFT for more info.", "tooltip.toms_storage.paintable": "Can be painted", - "tooltip.toms_storage.inventory_cable_connector": "Connects the inventory to the\\Inventory Cable System. Useful for longer\\range item access. Can be colored using\\dyes to select the channel.\\Two connectors with the same color\\will link together.", + "tooltip.toms_storage.inventory_cable_connector": "Connects the inventory to the\\Inventory Network. Or gives access to the network.\\Required to connect terminals.", "tooltip.toms_storage.trim": "Connects inventories with the Inventory Connector.", "tooltip.toms_storage.crafting_terminal": "Gives access to your items.\\Place it on an inventory.\\Has a builtin crafting table.", "tooltip.toms_storage.storage_terminal": "Gives access to your items.\\Place it on an inventory.", @@ -26,7 +30,8 @@ "tooltip.toms_storage.open_crate": "Converts the block in front of it\\into an inventory.\\Beware: Creates Item Entities", "tooltip.toms_storage.inventory_connector": "Connects all of the touching inventories into one.\\Use the Storage Terminal to access\\all of your items. Trims can connect the gaps.", "tooltip.toms_storage.inventory_proxy": "Extends the face of the block its pointing at.", - "tooltip.toms_storage.inventory_cable": "Connects inventories across\\long distances. Inventory Cable Connectors\\link the two ends.", + "tooltip.toms_storage.inventory_cable": "Connects inventories across\\long distances. Inventory Cable Connectors\\have to be used to attach inventories\\One Inventory Connector must be\\present in the network.", + "tooltip.toms_storage.inventory_hopper": "Import of export from your Inventory Network\\Right click an item to set the filter.\\Shift click with an empty hand to clear filter.", "tooltip.toms_storage.loop": "Loop detected in your storage system", "tooltip.toms_storage.amount": "Item Amount: %d", "tooltip.toms_storage.sorting_0": "Sort by Item Amount", @@ -41,6 +46,8 @@ "tooltip.toms_storage.search_7": "JEI Synced Auto Search Keep", "tooltip.toms_storage.ctrlMode_0": "AE Like Controls\\Pull one item: Shift+Right Click\\Transfer one item: Ctrl+Shift+Right Click", "tooltip.toms_storage.ctrlMode_1": "Refined Storage Like Controls\\Pull one item: Middle Click\\Transfer one item: Shift+Middle Click", + "tooltip.toms_storage.filter_item": "Filter: %s", + "tooltip.toms_storage.empty": "Empty", "tomsstorage.config.inventory_connector_range": "Inventory Connector Range", "tomsstorage.config.only_trims_connect": "Only Allow Trims to Connect Inventories", diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_base.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_base.json deleted file mode 100644 index add031a2..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_base.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", - "textures": { - "3": "#tex" - }, - "elements": [ - { - "name": "wool1", - "from": [ 7.0, 10.0, 3.0 ], - "to": [ 9.0, 12.0, 6.0 ], - "rotation": { "origin": [ 8.0, 11.5, 4.5 ], "axis": "x", "angle": 45.0 }, - "faces": { - "east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "up": { "texture": "#3", "uv": [ 0.0, 0.0, 2.0, 3.0 ] } - } - }, - { - "name": "wool2", - "from": [ 7.0, 6.0, -2.0 ], - "to": [ 9.0, 8.0, 1.0 ], - "rotation": { "origin": [ 8.0, 11.5, 4.5 ], "axis": "x", "angle": -45.0 }, - "faces": { - "east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "down": { "texture": "#3", "uv": [ 0.0, 0.0, 2.0, 3.0 ] } - } - }, - { - "name": "wool3", - "from": [ 4.2, 7.0, 3.5 ], - "to": [ 7.2, 9.0, 6.5 ], - "rotation": { "origin": [ 4.0, 8.0, 5.0 ], "axis": "y", "angle": 45.0 }, - "faces": { - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "up": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, - "down": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] } - } - }, - { - "name": "wool4", - "from": [ 6.45, 7.0, -2.25 ], - "to": [ 9.45, 9.0, 0.75 ], - "rotation": { "origin": [ 4.0, 8.0, 5.0 ], "axis": "y", "angle": -45.0 }, - "faces": { - "east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "up": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, - "down": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] } - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_black.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_black.json deleted file mode 100644 index 0668a199..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_black.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/black_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_blue.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_blue.json deleted file mode 100644 index 77118f27..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_blue.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/blue_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_brown.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_brown.json deleted file mode 100644 index d04ab71c..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_brown.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/brown_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_cyan.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_cyan.json deleted file mode 100644 index 719f3498..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_cyan.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/cyan_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_gray.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_gray.json deleted file mode 100644 index 71db0ce9..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_gray.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/gray_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_green.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_green.json deleted file mode 100644 index a20c9253..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_green.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/green_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_light_blue.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_light_blue.json deleted file mode 100644 index fd3797bb..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_light_blue.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/light_blue_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_light_gray.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_light_gray.json deleted file mode 100644 index f5e8814b..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_light_gray.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/light_gray_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_lime.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_lime.json deleted file mode 100644 index 84da2b83..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_lime.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/lime_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_magenta.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_magenta.json deleted file mode 100644 index 2757fa58..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_magenta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/magenta_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_orange.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_orange.json deleted file mode 100644 index 3ab0a8c7..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_orange.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/orange_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_pink.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_pink.json deleted file mode 100644 index 47a880ca..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_pink.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/pink_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_purple.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_purple.json deleted file mode 100644 index 7d3cf8d2..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_purple.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/purple_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_red.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_red.json deleted file mode 100644 index 1ab585ab..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_red.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/red_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_white.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_white.json deleted file mode 100644 index 6cd28f83..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_white.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/white_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_yellow.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/color_yellow.json deleted file mode 100644 index 97c1e9eb..00000000 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/color_yellow.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "toms_storage:block/cable_connector/color_base", - "textures": { - "tex": "block/yellow_wool" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/cable_connector/item.json b/src/main/resources/assets/toms_storage/models/block/cable_connector/item.json index 54cd1453..a7754e10 100644 --- a/src/main/resources/assets/toms_storage/models/block/cable_connector/item.json +++ b/src/main/resources/assets/toms_storage/models/block/cable_connector/item.json @@ -57,51 +57,6 @@ "up": { "texture": "#1", "uv": [ 0.0, 9.0, 2.0, 16.0 ] }, "down": { "texture": "#1", "uv": [ 0.0, 10.0, 2.0, 16.0 ] } } - }, - { - "name": "wool1", - "from": [ 7.0, 10.0, 3.0 ], - "to": [ 9.0, 12.0, 6.0 ], - "rotation": { "origin": [ 8.0, 11.5, 4.5 ], "axis": "x", "angle": 45.0 }, - "faces": { - "east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "up": { "texture": "#3", "uv": [ 0.0, 0.0, 2.0, 3.0 ] } - } - }, - { - "name": "wool2", - "from": [ 7.0, 6.0, -2.0 ], - "to": [ 9.0, 8.0, 1.0 ], - "rotation": { "origin": [ 8.0, 11.5, 4.5 ], "axis": "x", "angle": -45.0 }, - "faces": { - "east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "down": { "texture": "#3", "uv": [ 0.0, 0.0, 2.0, 3.0 ] } - } - }, - { - "name": "wool3", - "from": [ 4.2, 7.0, 3.5 ], - "to": [ 7.2, 9.0, 6.5 ], - "rotation": { "origin": [ 4.0, 8.0, 5.0 ], "axis": "y", "angle": 45.0 }, - "faces": { - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "up": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, - "down": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] } - } - }, - { - "name": "wool4", - "from": [ 6.45, 7.0, -2.25 ], - "to": [ 9.45, 9.0, 0.75 ], - "rotation": { "origin": [ 4.0, 8.0, 5.0 ], "axis": "y", "angle": -45.0 }, - "faces": { - "east": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "west": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 2.0 ] }, - "up": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, - "down": { "texture": "#3", "uv": [ 0.0, 0.0, 3.0, 3.0 ] } - } } ] } \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/inventory_hopper_basic.json b/src/main/resources/assets/toms_storage/models/block/inventory_hopper_basic.json new file mode 100644 index 00000000..d3e4e540 --- /dev/null +++ b/src/main/resources/assets/toms_storage/models/block/inventory_hopper_basic.json @@ -0,0 +1,35 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "textures": { + "0": "toms_storage:block/inventory_hopper_basic", + "particle": "toms_storage:block/inventory_hopper_basic" + }, + "parent": "block/block", + "elements": [ + { + "name": "bottom", + "from": [ 5.0, 0.0, 5.0 ], + "to": [ 11.0, 6.0, 11.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 6.0, 6.0 ] } + } + }, + { + "name": "top", + "from": [ 3.0, 6.0, 3.0 ], + "to": [ 13.0, 16.0, 13.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 10.0 ] }, + "east": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 10.0 ] }, + "south": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 10.0 ] }, + "west": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 10.0 ] }, + "up": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 10.0 ] }, + "down": { "texture": "#0", "uv": [ 6.0, 0.0, 16.0, 10.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/block/inventory_proxy_filter.json b/src/main/resources/assets/toms_storage/models/block/inventory_proxy_filter.json new file mode 100644 index 00000000..ee57f614 --- /dev/null +++ b/src/main/resources/assets/toms_storage/models/block/inventory_proxy_filter.json @@ -0,0 +1,15 @@ +{ + "textures": { + "down": "toms_storage:block/inventory_proxy_filter", + "particle": "toms_storage:block/inventory_proxy_side" + }, + "parent": "block/block", + "elements": [ + { "from": [ -0.01, -0.01, -0.01 ], + "to": [ 16.01, 16.01, 16.01 ], + "faces": { + "down": { "texture": "#down", "cullface": "down" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/models/item/ts.inventory_hopper_basic.json b/src/main/resources/assets/toms_storage/models/item/ts.inventory_hopper_basic.json new file mode 100644 index 00000000..2fd615ed --- /dev/null +++ b/src/main/resources/assets/toms_storage/models/item/ts.inventory_hopper_basic.json @@ -0,0 +1,3 @@ +{ + "parent": "toms_storage:block/inventory_hopper_basic" +} \ No newline at end of file diff --git a/src/main/resources/assets/toms_storage/textures/block/inventory_hopper_basic.png b/src/main/resources/assets/toms_storage/textures/block/inventory_hopper_basic.png new file mode 100644 index 00000000..d037f386 Binary files /dev/null and b/src/main/resources/assets/toms_storage/textures/block/inventory_hopper_basic.png differ diff --git a/src/main/resources/assets/toms_storage/textures/block/inventory_proxy_filter.png b/src/main/resources/assets/toms_storage/textures/block/inventory_proxy_filter.png new file mode 100644 index 00000000..1ba69ece Binary files /dev/null and b/src/main/resources/assets/toms_storage/textures/block/inventory_proxy_filter.png differ diff --git a/src/main/resources/data/toms_storage/advancements/unlock_chest.json b/src/main/resources/data/toms_storage/advancements/unlock_chest.json index f3d6f7fa..5364ff8b 100644 --- a/src/main/resources/data/toms_storage/advancements/unlock_chest.json +++ b/src/main/resources/data/toms_storage/advancements/unlock_chest.json @@ -24,6 +24,7 @@ "rewards":{ "recipes":[ "toms_storage:inventory_cable_framed", + "toms_storage:inventory_hopper_basic", "toms_storage:inventory_cable", "toms_storage:inventory_proxy", "toms_storage:open_crate", diff --git a/src/main/resources/data/toms_storage/loot_tables/blocks/ts.crafting_terminal.json b/src/main/resources/data/toms_storage/loot_tables/blocks/ts.crafting_terminal.json new file mode 100644 index 00000000..5bcdde55 --- /dev/null +++ b/src/main/resources/data/toms_storage/loot_tables/blocks/ts.crafting_terminal.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "toms_storage:ts.crafting_terminal" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_cable_connector.json b/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_cable_connector.json index 28da14b8..1554714a 100644 --- a/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_cable_connector.json +++ b/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_cable_connector.json @@ -6,15 +6,6 @@ "entries": [ { "type": "minecraft:item", - "functions": [ - { - "function": "minecraft:copy_state", - "block": "toms_storage:ts.inventory_cable_connector", - "properties": [ - "color" - ] - } - ], "name": "toms_storage:ts.inventory_cable_connector" } ], diff --git a/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_hopper_basic.json b/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_hopper_basic.json new file mode 100644 index 00000000..59e62f63 --- /dev/null +++ b/src/main/resources/data/toms_storage/loot_tables/blocks/ts.inventory_hopper_basic.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "toms_storage:ts.inventory_hopper_basic" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/toms_storage/recipes/inventory_hopper_basic.json b/src/main/resources/data/toms_storage/recipes/inventory_hopper_basic.json new file mode 100644 index 00000000..eff27d1f --- /dev/null +++ b/src/main/resources/data/toms_storage/recipes/inventory_hopper_basic.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "PcP", + " H " + ], + "key": { + "P": { + "tag": "minecraft:planks" + }, + "c": { + "item": "toms_storage:ts.inventory_cable" + }, + "H": { + "item": "minecraft:hopper" + } + }, + "result": { + "item": "toms_storage:ts.inventory_hopper_basic" + } +} \ No newline at end of file diff --git a/version-check.json b/version-check.json index df4c8f96..dd374adc 100644 --- a/version-check.json +++ b/version-check.json @@ -1,10 +1,15 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/toms-storage", "promos": { - "1.15.2-latest": "1.1.2", - "1.15.2-recommended": "1.1.2" + "1.15.2-latest": "1.1.3", + "1.15.2-recommended": "1.1.3", + "1.16.1-latest": "1.2.1", + "1.16.1-recommended": "1.2.1" }, "1.15.2": { + "1.2.1": "Fixed Crafting terminal not dropping when broken", + "1.2.0": "1.16 Port\nChanged inventory cable.\nAdded Inventory Hopper", + "1.1.3": "Fixed Crafting terminal not dropping when broken", "1.1.2": "Fixed items with tags merging\nAdded terminal sorting modes\nImproved terminal gui handler", "1.1.1": "Fixed Inventory Cable Connector not showing up in the creative inventory and JEI\nAdded JEI compatibility to crafting terminal\nFixed Storage Terminal recipe not using tags\nTerminals now emit light", "1.1.0": "Added Crafting Terminal\nAdded the ability to paint some of the blocks\nAdded Inevntory Cable & Connector\nAdded Inventory Proxy\nAdded Wireless Terminal\nAdded config to change Inventory Connector range.",