diff --git a/src/main/java/com/raoulvdberge/refinedstorage/ClientSetup.java b/src/main/java/com/raoulvdberge/refinedstorage/ClientSetup.java index 8ffea3a69..883991703 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/ClientSetup.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/ClientSetup.java @@ -122,6 +122,7 @@ public class ClientSetup { ScreenManager.registerFactory(RSContainers.FLUID_STORAGE_BLOCK, FluidStorageBlockScreen::new); ScreenManager.registerFactory(RSContainers.EXTERNAL_STORAGE, ExternalStorageScreen::new); ScreenManager.registerFactory(RSContainers.IMPORTER, ImporterScreen::new); + ScreenManager.registerFactory(RSContainers.EXPORTER, ExporterScreen::new); ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR); ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/RS.java b/src/main/java/com/raoulvdberge/refinedstorage/RS.java index 6756f59a2..4e35620f7 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/RS.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/RS.java @@ -114,6 +114,7 @@ public final class RS { API.instance().getNetworkNodeRegistry().add(ExternalStorageNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ExternalStorageNetworkNode(world, pos))); API.instance().getNetworkNodeRegistry().add(ImporterNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ImporterNetworkNode(world, pos))); + API.instance().getNetworkNodeRegistry().add(ExporterNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ExporterNetworkNode(world, pos))); API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory()); @@ -157,6 +158,7 @@ public final class RS { e.getRegistry().register(new ExternalStorageBlock()); e.getRegistry().register(new ImporterBlock()); + e.getRegistry().register(new ExporterBlock()); } @SubscribeEvent @@ -184,6 +186,7 @@ public final class RS { e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExternalStorageTile::new, RSBlocks.EXTERNAL_STORAGE).build(null).setRegistryName(RS.ID, "external_storage"))); e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ImporterTile::new, RSBlocks.IMPORTER).build(null).setRegistryName(RS.ID, "importer"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExporterTile::new, RSBlocks.EXPORTER).build(null).setRegistryName(RS.ID, "exporter"))); } private TileEntityType registerTileDataParameters(TileEntityType t) { @@ -204,6 +207,7 @@ public final class RS { e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory((windowId, inv, tile) -> new FluidStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_storage_block")); e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory((windowId, inv, tile) -> new ExternalStorageContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "external_storage")); e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory((windowId, inv, tile) -> new ImporterContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "importer")); + e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory((windowId, inv, tile) -> new ExporterContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "exporter")); } @SubscribeEvent @@ -273,6 +277,7 @@ public final class RS { e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.EXTERNAL_STORAGE)); e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.IMPORTER)); + e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.EXPORTER)); } /* TODO diff --git a/src/main/java/com/raoulvdberge/refinedstorage/RSBlocks.java b/src/main/java/com/raoulvdberge/refinedstorage/RSBlocks.java index e9e205519..f37256fce 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/RSBlocks.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/RSBlocks.java @@ -7,7 +7,9 @@ public final class RSBlocks { @ObjectHolder(RS.ID + ":importer") public static final ImporterBlock IMPORTER = null; - public static final BlockExporter EXPORTER = new BlockExporter(); + @ObjectHolder(RS.ID + ":exporter") + public static final ExporterBlock EXPORTER = null; + public static final BlockDetector DETECTOR = new BlockDetector(); public static final BlockDestructor DESTRUCTOR = new BlockDestructor(); public static final BlockConstructor CONSTRUCTOR = new BlockConstructor(); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/RSContainers.java b/src/main/java/com/raoulvdberge/refinedstorage/RSContainers.java index 3e56e05bb..6df25c10c 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/RSContainers.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/RSContainers.java @@ -27,7 +27,8 @@ public final class RSContainers { //@ObjectHolder(RS.ID + ":disk_manipulator") public static final ContainerType DISK_MANIPULATOR = null; - //@ObjectHolder(RS.ID + ":exporter") + + @ObjectHolder(RS.ID + ":exporter") public static final ContainerType EXPORTER = null; @ObjectHolder(RS.ID + ":external_storage") diff --git a/src/main/java/com/raoulvdberge/refinedstorage/RSOldConfig.java b/src/main/java/com/raoulvdberge/refinedstorage/RSOldConfig.java index aa8941be0..d7b263373 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/RSOldConfig.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/RSOldConfig.java @@ -9,8 +9,6 @@ public class RSOldConfig { public int crafterManagerUsage; public int destructorUsage; public int detectorUsage; - public int exporterUsage; - public int importerUsage; public int interfaceUsage; public int fluidInterfaceUsage; public int relayUsage; @@ -89,8 +87,6 @@ public class RSOldConfig { crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers"); destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors"); detectorUsage = config.getInt("detector", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Detectors"); - exporterUsage = config.getInt("exporter", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Exporters"); - importerUsage = config.getInt("importer", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Importers"); interfaceUsage = config.getInt("interface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Interfaces"); fluidInterfaceUsage = config.getInt("fluidInterface", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Fluid Interfaces"); relayUsage = config.getInt("relay", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Relays"); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/RSTiles.java b/src/main/java/com/raoulvdberge/refinedstorage/RSTiles.java index 1e4a31233..2a3a1ffcf 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/RSTiles.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/RSTiles.java @@ -33,8 +33,9 @@ public class RSTiles { //@ObjectHolder(RS.ID + ":disk_manipulator") public static final TileEntityType DISK_MANIPULATOR = null; - //@ObjectHolder(RS.ID + ":exporter") - public static final TileEntityType EXPORTER = null; + + @ObjectHolder(RS.ID + ":exporter") + public static final TileEntityType EXPORTER = null; @ObjectHolder(RS.ID + ":external_storage") public static final TileEntityType EXTERNAL_STORAGE = null; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeExporter.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ExporterNetworkNode.java old mode 100755 new mode 100644 similarity index 94% rename from src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeExporter.java rename to src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ExporterNetworkNode.java index b98763bc0..d3b0b836e --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/NetworkNodeExporter.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ExporterNetworkNode.java @@ -9,7 +9,7 @@ import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler; import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeFluidInventoryListener; import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeInventoryListener; import com.raoulvdberge.refinedstorage.item.UpgradeItem; -import com.raoulvdberge.refinedstorage.tile.TileExporter; +import com.raoulvdberge.refinedstorage.tile.ExporterTile; import com.raoulvdberge.refinedstorage.tile.config.IComparable; import com.raoulvdberge.refinedstorage.tile.config.IType; import com.raoulvdberge.refinedstorage.util.StackUtils; @@ -26,7 +26,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; -public class NetworkNodeExporter extends NetworkNode implements IComparable, IType { +public class ExporterNetworkNode extends NetworkNode implements IComparable, IType { public static final ResourceLocation ID = new ResourceLocation(RS.ID, "exporter"); private static final String NBT_COMPARE = "Compare"; @@ -36,20 +36,21 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy private BaseItemHandler itemFilters = new BaseItemHandler(9).addListener(new NetworkNodeInventoryListener(this)); private FluidInventory fluidFilters = new FluidInventory(9).addListener(new NetworkNodeFluidInventoryListener(this)); - private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4 /* TODO, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_CRAFTING, ItemUpgrade.TYPE_STACK*/).addListener(new NetworkNodeInventoryListener(this)); + private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4, UpgradeItem.Type.SPEED, UpgradeItem.Type.CRAFTING, UpgradeItem.Type.STACK) + .addListener(new NetworkNodeInventoryListener(this)); private int compare = IComparer.COMPARE_NBT; private int type = IType.ITEMS; private int filterSlot; - public NetworkNodeExporter(World world, BlockPos pos) { + public ExporterNetworkNode(World world, BlockPos pos) { super(world, pos); } @Override public int getEnergyUsage() { - return RS.INSTANCE.config.exporterUsage + upgrades.getEnergyUsage(); + return RS.SERVER_CONFIG.getExporter().getUsage() + upgrades.getEnergyUsage(); } @Override @@ -219,7 +220,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy @Override public int getType() { - return world.isRemote ? TileExporter.TYPE.getValue() : type; + return world.isRemote ? ExporterTile.TYPE.getValue() : type; } @Override diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ImporterNetworkNode.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ImporterNetworkNode.java index e4b6e6f20..1e10317f4 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ImporterNetworkNode.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/network/node/ImporterNetworkNode.java @@ -53,7 +53,7 @@ public class ImporterNetworkNode extends NetworkNode implements IComparable, IWh @Override public int getEnergyUsage() { - return RS.INSTANCE.config.importerUsage + upgrades.getEnergyUsage(); + return RS.SERVER_CONFIG.getImporter().getUsage() + upgrades.getEnergyUsage(); } @Override diff --git a/src/main/java/com/raoulvdberge/refinedstorage/block/BlockExporter.java b/src/main/java/com/raoulvdberge/refinedstorage/block/BlockExporter.java deleted file mode 100755 index 166579b31..000000000 --- a/src/main/java/com/raoulvdberge/refinedstorage/block/BlockExporter.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.raoulvdberge.refinedstorage.block; - -public class BlockExporter extends CableBlock { - /* TODO - public BlockExporter() { - super(createBuilder("exporter").tileEntity(TileExporter::new).create()); - } - - @Override - @OnlyIn(Dist.CLIENT) - public void registerModels(IModelRegistration modelRegistration) { - modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); - - registerCover(modelRegistration); - } - - @Override - @Nullable - public BlockDirection getDirection() { - return BlockDirection.ANY; - } - - @Override - public List getCollisions(TileEntity tile, BlockState state) { - List groups = super.getCollisions(tile, state); - - switch (state.getValue(getDirection().getProperty())) { - case NORTH: - groups.add(ConstantsExporter.LINE_NORTH); - break; - case EAST: - groups.add(ConstantsExporter.LINE_EAST); - break; - case SOUTH: - groups.add(ConstantsExporter.LINE_SOUTH); - break; - case WEST: - groups.add(ConstantsExporter.LINE_WEST); - break; - case UP: - groups.add(ConstantsExporter.LINE_UP); - break; - case DOWN: - groups.add(ConstantsExporter.LINE_DOWN); - break; - } - - return groups; - } - - @Override - public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { - if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { - return false; - } - - return openNetworkGui(RSGui.EXPORTER, player, world, pos, side); - }*/ -} diff --git a/src/main/java/com/raoulvdberge/refinedstorage/block/ExporterBlock.java b/src/main/java/com/raoulvdberge/refinedstorage/block/ExporterBlock.java new file mode 100644 index 000000000..ae700435f --- /dev/null +++ b/src/main/java/com/raoulvdberge/refinedstorage/block/ExporterBlock.java @@ -0,0 +1,126 @@ +package com.raoulvdberge.refinedstorage.block; + +import com.raoulvdberge.refinedstorage.RS; +import com.raoulvdberge.refinedstorage.block.info.BlockDirection; +import com.raoulvdberge.refinedstorage.container.ExporterContainer; +import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider; +import com.raoulvdberge.refinedstorage.tile.ExporterTile; +import com.raoulvdberge.refinedstorage.util.BlockUtils; +import com.raoulvdberge.refinedstorage.util.NetworkUtils; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +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.TranslationTextComponent; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import net.minecraftforge.fml.network.NetworkHooks; + +import javax.annotation.Nullable; + +public class ExporterBlock extends CableBlock { + private static final VoxelShape LINE_NORTH_1 = makeCuboidShape(6, 6, 0, 10, 10, 2); + private static final VoxelShape LINE_NORTH_2 = makeCuboidShape(5, 5, 2, 11, 11, 4); + private static final VoxelShape LINE_NORTH_3 = makeCuboidShape(3, 3, 4, 13, 13, 6); + private static final VoxelShape LINE_NORTH = VoxelShapes.or(LINE_NORTH_1, LINE_NORTH_2, LINE_NORTH_3); + + private static final VoxelShape LINE_EAST_1 = makeCuboidShape(14, 6, 6, 16, 10, 10); + private static final VoxelShape LINE_EAST_2 = makeCuboidShape(12, 5, 5, 14, 11, 11); + private static final VoxelShape LINE_EAST_3 = makeCuboidShape(10, 3, 3, 12, 13, 13); + private static final VoxelShape LINE_EAST = VoxelShapes.or(LINE_EAST_1, LINE_EAST_2, LINE_EAST_3); + + private static final VoxelShape LINE_SOUTH_1 = makeCuboidShape(6, 6, 14, 10, 10, 16); + private static final VoxelShape LINE_SOUTH_2 = makeCuboidShape(5, 5, 12, 11, 11, 14); + private static final VoxelShape LINE_SOUTH_3 = makeCuboidShape(3, 3, 10, 13, 13, 12); + private static final VoxelShape LINE_SOUTH = VoxelShapes.or(LINE_SOUTH_1, LINE_SOUTH_2, LINE_SOUTH_3); + + private static final VoxelShape LINE_WEST_1 = makeCuboidShape(0, 6, 6, 2, 10, 10); + private static final VoxelShape LINE_WEST_2 = makeCuboidShape(2, 5, 5, 4, 11, 11); + private static final VoxelShape LINE_WEST_3 = makeCuboidShape(4, 3, 3, 6, 13, 13); + private static final VoxelShape LINE_WEST = VoxelShapes.or(LINE_WEST_1, LINE_WEST_2, LINE_WEST_3); + + private static final VoxelShape LINE_UP_1 = makeCuboidShape(6, 14, 6, 10, 16, 10); + private static final VoxelShape LINE_UP_2 = makeCuboidShape(5, 12, 5, 11, 14, 11); + private static final VoxelShape LINE_UP_3 = makeCuboidShape(3, 10, 3, 13, 12, 13); + private static final VoxelShape LINE_UP = VoxelShapes.or(LINE_UP_1, LINE_UP_2, LINE_UP_3); + + private static final VoxelShape LINE_DOWN_1 = makeCuboidShape(6, 0, 6, 10, 2, 10); + private static final VoxelShape LINE_DOWN_2 = makeCuboidShape(5, 2, 5, 11, 4, 11); + private static final VoxelShape LINE_DOWN_3 = makeCuboidShape(3, 4, 3, 13, 6, 13); + private static final VoxelShape LINE_DOWN = VoxelShapes.or(LINE_DOWN_1, LINE_DOWN_2, LINE_DOWN_3); + + public ExporterBlock() { + super(BlockUtils.DEFAULT_GLASS_PROPERTIES); + + this.setRegistryName(RS.ID, "exporter"); + } + + @Override + public BlockDirection getDirection() { + return BlockDirection.ANY; + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { + VoxelShape shape = super.getShape(state, world, pos, ctx); + + Direction direction = state.get(getDirection().getProperty()); + + if (direction == Direction.NORTH) { + shape = VoxelShapes.or(shape, LINE_NORTH); + } + + if (direction == Direction.EAST) { + shape = VoxelShapes.or(shape, LINE_EAST); + } + + if (direction == Direction.SOUTH) { + shape = VoxelShapes.or(shape, LINE_SOUTH); + } + + if (direction == Direction.WEST) { + shape = VoxelShapes.or(shape, LINE_WEST); + } + + if (direction == Direction.UP) { + shape = VoxelShapes.or(shape, LINE_UP); + } + + if (direction == Direction.DOWN) { + shape = VoxelShapes.or(shape, LINE_DOWN); + } + + return shape; + } + + @Nullable + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new ExporterTile(); + } + + @Override + @SuppressWarnings("deprecation") + public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + if (!world.isRemote) { + return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( + (ServerPlayerEntity) player, + new PositionalTileContainerProvider( + new TranslationTextComponent("gui.refinedstorage.exporter"), + (tile, windowId, inventory, p) -> new ExporterContainer(tile, player, windowId), + pos + ), + pos + )); + } + + return true; + } +} diff --git a/src/main/java/com/raoulvdberge/refinedstorage/block/ImporterBlock.java b/src/main/java/com/raoulvdberge/refinedstorage/block/ImporterBlock.java index 9d3b7f076..4d881c3a1 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/block/ImporterBlock.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/block/ImporterBlock.java @@ -67,7 +67,6 @@ public class ImporterBlock extends CableBlock { return BlockDirection.ANY; } - @Override public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) { VoxelShape shape = super.getShape(state, world, pos, ctx); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/config/ServerConfig.java b/src/main/java/com/raoulvdberge/refinedstorage/config/ServerConfig.java index 061494a46..ed78ab0e3 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/config/ServerConfig.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/config/ServerConfig.java @@ -13,6 +13,8 @@ public class ServerConfig { private StorageBlock storageBlock; private FluidStorageBlock fluidStorageBlock; private ExternalStorage externalStorage; + private Importer importer; + private Exporter exporter; private Upgrades upgrades; public ServerConfig() { @@ -23,6 +25,8 @@ public class ServerConfig { storageBlock = new StorageBlock(); fluidStorageBlock = new FluidStorageBlock(); externalStorage = new ExternalStorage(); + importer = new Importer(); + exporter = new Exporter(); upgrades = new Upgrades(); spec = builder.build(); @@ -60,6 +64,14 @@ public class ServerConfig { return externalStorage; } + public Importer getImporter() { + return importer; + } + + public Exporter getExporter() { + return exporter; + } + public ForgeConfigSpec getSpec() { return spec; } @@ -323,4 +335,36 @@ public class ServerConfig { return usage.get(); } } + + public class Importer { + private final ForgeConfigSpec.IntValue usage; + + public Importer() { + builder.push("importer"); + + usage = builder.comment("The energy used by the Importer").defineInRange("usage", 1, 0, Integer.MAX_VALUE); + + builder.pop(); + } + + public int getUsage() { + return usage.get(); + } + } + + public class Exporter { + private final ForgeConfigSpec.IntValue usage; + + public Exporter() { + builder.push("exporter"); + + usage = builder.comment("The energy used by the Exporter").defineInRange("usage", 1, 0, Integer.MAX_VALUE); + + builder.pop(); + } + + public int getUsage() { + return usage.get(); + } + } } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/container/ExporterContainer.java b/src/main/java/com/raoulvdberge/refinedstorage/container/ExporterContainer.java index f473866a2..321f1d57c 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/container/ExporterContainer.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/container/ExporterContainer.java @@ -3,13 +3,13 @@ package com.raoulvdberge.refinedstorage.container; import com.raoulvdberge.refinedstorage.RSContainers; import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot; import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot; -import com.raoulvdberge.refinedstorage.tile.TileExporter; +import com.raoulvdberge.refinedstorage.tile.ExporterTile; import com.raoulvdberge.refinedstorage.tile.config.IType; import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.items.SlotItemHandler; public class ExporterContainer extends BaseContainer { - public ExporterContainer(TileExporter exporter, PlayerEntity player, int windowId) { + public ExporterContainer(ExporterTile exporter, PlayerEntity player, int windowId) { super(RSContainers.EXPORTER, exporter, player, windowId); for (int i = 0; i < 4; ++i) { diff --git a/src/main/java/com/raoulvdberge/refinedstorage/render/constants/ConstantsExporter.java b/src/main/java/com/raoulvdberge/refinedstorage/render/constants/ConstantsExporter.java deleted file mode 100644 index 4cee8ae63..000000000 --- a/src/main/java/com/raoulvdberge/refinedstorage/render/constants/ConstantsExporter.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.raoulvdberge.refinedstorage.render.constants; - -import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; -import com.raoulvdberge.refinedstorage.util.CollisionUtils; -import net.minecraft.util.math.AxisAlignedBB; - -public final class ConstantsExporter { - public static final AxisAlignedBB LINE_NORTH_1_AABB = CollisionUtils.getBounds(6, 6, 0, 10, 10, 2); - public static final AxisAlignedBB LINE_NORTH_2_AABB = CollisionUtils.getBounds(5, 5, 2, 11, 11, 4); - public static final AxisAlignedBB LINE_NORTH_3_AABB = CollisionUtils.getBounds(3, 3, 4, 13, 13, 6); - public static final CollisionGroup LINE_NORTH = new CollisionGroup().addItem(LINE_NORTH_1_AABB).addItem(LINE_NORTH_2_AABB).addItem(LINE_NORTH_3_AABB).setCanAccessGui(true); - - public static final AxisAlignedBB LINE_EAST_1_AABB = CollisionUtils.getBounds(14, 6, 6, 16, 10, 10); - public static final AxisAlignedBB LINE_EAST_2_AABB = CollisionUtils.getBounds(12, 5, 5, 14, 11, 11); - public static final AxisAlignedBB LINE_EAST_3_AABB = CollisionUtils.getBounds(10, 3, 3, 12, 13, 13); - public static final CollisionGroup LINE_EAST = new CollisionGroup().addItem(LINE_EAST_1_AABB).addItem(LINE_EAST_2_AABB).addItem(LINE_EAST_3_AABB).setCanAccessGui(true); - - public static final AxisAlignedBB LINE_SOUTH_1_AABB = CollisionUtils.getBounds(6, 6, 14, 10, 10, 16); - public static final AxisAlignedBB LINE_SOUTH_2_AABB = CollisionUtils.getBounds(5, 5, 12, 11, 11, 14); - public static final AxisAlignedBB LINE_SOUTH_3_AABB = CollisionUtils.getBounds(3, 3, 10, 13, 13, 12); - public static final CollisionGroup LINE_SOUTH = new CollisionGroup().addItem(LINE_SOUTH_1_AABB).addItem(LINE_SOUTH_2_AABB).addItem(LINE_SOUTH_3_AABB).setCanAccessGui(true); - - public static final AxisAlignedBB LINE_WEST_1_AABB = CollisionUtils.getBounds(0, 6, 6, 2, 10, 10); - public static final AxisAlignedBB LINE_WEST_2_AABB = CollisionUtils.getBounds(2, 5, 5, 4, 11, 11); - public static final AxisAlignedBB LINE_WEST_3_AABB = CollisionUtils.getBounds(4, 3, 3, 6, 13, 13); - public static final CollisionGroup LINE_WEST = new CollisionGroup().addItem(LINE_WEST_1_AABB).addItem(LINE_WEST_2_AABB).addItem(LINE_WEST_3_AABB).setCanAccessGui(true); - - public static final AxisAlignedBB LINE_UP_1_AABB = CollisionUtils.getBounds(6, 14, 6, 10, 16, 10); - public static final AxisAlignedBB LINE_UP_2_AABB = CollisionUtils.getBounds(5, 12, 5, 11, 14, 11); - public static final AxisAlignedBB LINE_UP_3_AABB = CollisionUtils.getBounds(3, 10, 3, 13, 12, 13); - public static final CollisionGroup LINE_UP = new CollisionGroup().addItem(LINE_UP_1_AABB).addItem(LINE_UP_2_AABB).addItem(LINE_UP_3_AABB).setCanAccessGui(true); - - public static final AxisAlignedBB LINE_DOWN_1_AABB = CollisionUtils.getBounds(6, 0, 6, 10, 2, 10); - public static final AxisAlignedBB LINE_DOWN_2_AABB = CollisionUtils.getBounds(5, 2, 5, 11, 4, 11); - public static final AxisAlignedBB LINE_DOWN_3_AABB = CollisionUtils.getBounds(3, 4, 3, 13, 6, 13); - public static final CollisionGroup LINE_DOWN = new CollisionGroup().addItem(LINE_DOWN_1_AABB).addItem(LINE_DOWN_2_AABB).addItem(LINE_DOWN_3_AABB).setCanAccessGui(true); -} diff --git a/src/main/java/com/raoulvdberge/refinedstorage/screen/GuiExporter.java b/src/main/java/com/raoulvdberge/refinedstorage/screen/ExporterScreen.java similarity index 61% rename from src/main/java/com/raoulvdberge/refinedstorage/screen/GuiExporter.java rename to src/main/java/com/raoulvdberge/refinedstorage/screen/ExporterScreen.java index 5a99b0a40..2316a4ebc 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/screen/GuiExporter.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/screen/ExporterScreen.java @@ -5,22 +5,23 @@ import com.raoulvdberge.refinedstorage.container.ExporterContainer; import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.ExactModeSideButton; import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton; import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.TypeSideButton; -import com.raoulvdberge.refinedstorage.tile.TileExporter; +import com.raoulvdberge.refinedstorage.tile.ExporterTile; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.text.ITextComponent; -public class GuiExporter extends BaseScreen { - public GuiExporter(ExporterContainer container, PlayerInventory playerInventory) { - super(container, 211, 137, playerInventory, null); +public class ExporterScreen extends BaseScreen { + public ExporterScreen(ExporterContainer container, PlayerInventory playerInventory, ITextComponent title) { + super(container, 211, 137, playerInventory, title); } @Override public void onPostInit(int x, int y) { - addSideButton(new RedstoneModeSideButton(this, TileExporter.REDSTONE_MODE)); + addSideButton(new RedstoneModeSideButton(this, ExporterTile.REDSTONE_MODE)); - addSideButton(new TypeSideButton(this, TileExporter.TYPE)); + addSideButton(new TypeSideButton(this, ExporterTile.TYPE)); - addSideButton(new ExactModeSideButton(this, TileExporter.COMPARE)); + addSideButton(new ExactModeSideButton(this, ExporterTile.COMPARE)); } @Override @@ -36,7 +37,7 @@ public class GuiExporter extends BaseScreen { @Override public void renderForeground(int mouseX, int mouseY) { - renderString(7, 7, I18n.format("gui.refinedstorage:exporter")); + renderString(7, 7, title.getFormattedText()); renderString(7, 43, I18n.format("container.inventory")); } } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/screen/ImporterScreen.java b/src/main/java/com/raoulvdberge/refinedstorage/screen/ImporterScreen.java index ecf811144..6579c831d 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/screen/ImporterScreen.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/screen/ImporterScreen.java @@ -40,7 +40,7 @@ public class ImporterScreen extends BaseScreen { @Override public void renderForeground(int mouseX, int mouseY) { - renderString(7, 7, I18n.format("gui.refinedstorage.importer")); + renderString(7, 7, title.getFormattedText()); renderString(7, 43, I18n.format("container.inventory")); } } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/tile/TileExporter.java b/src/main/java/com/raoulvdberge/refinedstorage/tile/ExporterTile.java old mode 100755 new mode 100644 similarity index 60% rename from src/main/java/com/raoulvdberge/refinedstorage/tile/TileExporter.java rename to src/main/java/com/raoulvdberge/refinedstorage/tile/ExporterTile.java index a0975375a..ebd88adb9 --- a/src/main/java/com/raoulvdberge/refinedstorage/tile/TileExporter.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/tile/ExporterTile.java @@ -1,7 +1,7 @@ package com.raoulvdberge.refinedstorage.tile; import com.raoulvdberge.refinedstorage.RSTiles; -import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeExporter; +import com.raoulvdberge.refinedstorage.apiimpl.network.node.ExporterNetworkNode; import com.raoulvdberge.refinedstorage.tile.config.IComparable; import com.raoulvdberge.refinedstorage.tile.config.IType; import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter; @@ -10,11 +10,11 @@ import net.minecraft.world.World; import javax.annotation.Nonnull; -public class TileExporter extends NetworkNodeTile { - public static final TileDataParameter COMPARE = IComparable.createParameter(); - public static final TileDataParameter TYPE = IType.createParameter(); +public class ExporterTile extends NetworkNodeTile { + public static final TileDataParameter COMPARE = IComparable.createParameter(); + public static final TileDataParameter TYPE = IType.createParameter(); - public TileExporter() { + public ExporterTile() { super(RSTiles.EXPORTER); dataManager.addWatchedParameter(COMPARE); @@ -23,7 +23,7 @@ public class TileExporter extends NetworkNodeTile { @Override @Nonnull - public NetworkNodeExporter createNode(World world, BlockPos pos) { - return new NetworkNodeExporter(world, pos); + public ExporterNetworkNode createNode(World world, BlockPos pos) { + return new ExporterNetworkNode(world, pos); } } diff --git a/src/main/resources/assets/refinedstorage/blockstates/exporter.json b/src/main/resources/assets/refinedstorage/blockstates/exporter.json index 7cbee5034..8458b5116 100755 --- a/src/main/resources/assets/refinedstorage/blockstates/exporter.json +++ b/src/main/resources/assets/refinedstorage/blockstates/exporter.json @@ -1,87 +1,115 @@ { - "forge_marker": 1, - "defaults": { - "textures": { - "cable": "refinedstorage:blocks/cable", - "particle": "refinedstorage:blocks/cable", - "border": "refinedstorage:blocks/cable_part_border" + "multipart": [ + { + "apply": { + "model": "refinedstorage:block/cable_core" + } }, - "model": "refinedstorage:cable_core", - "uvlock": false, - "transform": "forge:default-block" - }, - "variants": { - "direction": { - "north": { - "submodel": "refinedstorage:exporter" + { + "when": { + "north": true }, - "east": { - "submodel": "refinedstorage:exporter", + "apply": { + "model": "refinedstorage:block/cable_extension" + } + }, + { + "when": { + "east": true + }, + "apply": { + "model": "refinedstorage:block/cable_extension", "y": 90 + } + }, + { + "when": { + "south": true }, - "south": { - "submodel": "refinedstorage:exporter", + "apply": { + "model": "refinedstorage:block/cable_extension", "x": 180 + } + }, + { + "when": { + "west": true }, - "west": { - "submodel": "refinedstorage:exporter", + "apply": { + "model": "refinedstorage:block/cable_extension", "y": 270 + } + }, + { + "when": { + "up": true }, - "up": { - "submodel": "refinedstorage:exporter", + "apply": { + "model": "refinedstorage:block/cable_extension", "x": 270 + } + }, + { + "when": { + "down": true }, - "down": { - "submodel": "refinedstorage:exporter", + "apply": { + "model": "refinedstorage:block/cable_extension", "x": 90 } }, - "north": { - "true": { - "submodel": "refinedstorage:cable_extension" + { + "when": { + "direction": "north" }, - "false": { + "apply": { + "model": "refinedstorage:block/exporter" } }, - "east": { - "true": { - "submodel": "refinedstorage:cable_extension", + { + "when": { + "direction": "east" + }, + "apply": { + "model": "refinedstorage:block/exporter", "y": 90 - }, - "false": { } }, - "south": { - "true": { - "submodel": "refinedstorage:cable_extension", + { + "when": { + "direction": "south" + }, + "apply": { + "model": "refinedstorage:block/exporter", "x": 180 - }, - "false": { } }, - "west": { - "true": { - "submodel": "refinedstorage:cable_extension", + { + "when": { + "direction": "west" + }, + "apply": { + "model": "refinedstorage:block/exporter", "y": 270 - }, - "false": { } }, - "up": { - "true": { - "submodel": "refinedstorage:cable_extension", + { + "when": { + "direction": "up" + }, + "apply": { + "model": "refinedstorage:block/exporter", "x": 270 - }, - "false": { } }, - "down": { - "true": { - "submodel": "refinedstorage:cable_extension", - "x": 90 + { + "when": { + "direction": "down" }, - "false": { + "apply": { + "model": "refinedstorage:block/exporter", + "x": 90 } } - } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/refinedstorage/lang/en_us.json b/src/main/resources/assets/refinedstorage/lang/en_us.json index 3bd62b976..50e5d0724 100644 --- a/src/main/resources/assets/refinedstorage/lang/en_us.json +++ b/src/main/resources/assets/refinedstorage/lang/en_us.json @@ -22,7 +22,7 @@ "gui.refinedstorage.disk_drive.disks": "Disks", "gui.refinedstorage.external_storage": "External Storage", "gui.refinedstorage.importer": "Importer", - "gui.refinedstorage:exporter": "Exporter", + "gui.refinedstorage.exporter": "Exporter", "gui.refinedstorage:detector": "Detector", "gui.refinedstorage:destructor": "Destructor", "gui.refinedstorage:constructor": "Constructor", @@ -188,7 +188,7 @@ "block.refinedstorage:disk_manipulator": "Disk Manipulator", "block.refinedstorage.external_storage": "External Storage", "block.refinedstorage.importer": "Importer", - "block.refinedstorage:exporter": "Exporter", + "block.refinedstorage.exporter": "Exporter", "block.refinedstorage:detector": "Detector", "block.refinedstorage.machine_casing": "Machine Casing", "block.refinedstorage:destructor": "Destructor", diff --git a/src/main/resources/assets/refinedstorage/models/block/exporter.json b/src/main/resources/assets/refinedstorage/models/block/exporter.json index 64c141f92..e16fe0c12 100755 --- a/src/main/resources/assets/refinedstorage/models/block/exporter.json +++ b/src/main/resources/assets/refinedstorage/models/block/exporter.json @@ -1,4 +1,7 @@ { + "textures": { + "border": "refinedstorage:block/cable_part_border" + }, "elements": [ { "name": "Line1", diff --git a/src/main/resources/assets/refinedstorage/models/item/exporter.json b/src/main/resources/assets/refinedstorage/models/item/exporter.json new file mode 100644 index 000000000..de194284e --- /dev/null +++ b/src/main/resources/assets/refinedstorage/models/item/exporter.json @@ -0,0 +1,441 @@ +{ + "parent": "block/block", + "textures": { + "cable": "refinedstorage:block/cable", + "border": "refinedstorage:block/cable_part_border" + }, + "elements": [ + { + "name": "Core", + "from": [ + 6, + 6, + 6 + ], + "to": [ + 10, + 10, + 10 + ], + "faces": { + "north": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "east": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "south": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "west": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "up": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "down": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + } + } + }, + { + "name": "Part1", + "from": [ + 10, + 6, + 6 + ], + "to": [ + 16, + 10, + 10 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 16, + 8, + 9 + ] + }, + "faces": { + "north": { + "uv": [ + 0, + 6, + 6, + 10 + ], + "texture": "#cable" + }, + "east": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "south": { + "uv": [ + 10, + 6, + 16, + 10 + ], + "texture": "#cable" + }, + "west": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "up": { + "uv": [ + 10, + 6, + 16, + 10 + ], + "texture": "#cable" + }, + "down": { + "uv": [ + 10, + 6, + 16, + 10 + ], + "texture": "#cable" + } + } + }, + { + "name": "Part2", + "from": [ + 0, + 6, + 6 + ], + "to": [ + 6, + 10, + 10 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 6, + 8, + 9 + ] + }, + "faces": { + "north": { + "uv": [ + 10, + 6, + 16, + 10 + ], + "texture": "#cable" + }, + "east": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "south": { + "uv": [ + 0, + 6, + 6, + 10 + ], + "texture": "#cable" + }, + "west": { + "uv": [ + 6, + 6, + 10, + 10 + ], + "texture": "#cable" + }, + "up": { + "uv": [ + 0, + 6, + 6, + 10 + ], + "texture": "#cable" + }, + "down": { + "uv": [ + 0, + 6, + 6, + 10 + ], + "texture": "#cable" + } + } + }, + { + "name": "Line1", + "from": [ + 6, + 6, + 0 + ], + "to": [ + 10, + 10, + 2 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 4, + 4 + ], + "texture": "#border" + }, + "east": { + "uv": [ + 0, + 0, + 2, + 4 + ], + "texture": "#border" + }, + "south": { + "uv": [ + 0, + 0, + 4, + 4 + ], + "texture": "#border" + }, + "west": { + "uv": [ + 0, + 0, + 2, + 4 + ], + "texture": "#border" + }, + "up": { + "uv": [ + 0, + 0, + 4, + 2 + ], + "texture": "#border" + }, + "down": { + "uv": [ + 0, + 0, + 4, + 2 + ], + "texture": "#border" + } + } + }, + { + "name": "Line2", + "from": [ + 5, + 5, + 2 + ], + "to": [ + 11, + 11, + 4 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 6, + 6 + ], + "texture": "#border" + }, + "east": { + "uv": [ + 0, + 0, + 2, + 6 + ], + "texture": "#border" + }, + "south": { + "uv": [ + 0, + 0, + 6, + 6 + ], + "texture": "#border" + }, + "west": { + "uv": [ + 0, + 0, + 2, + 6 + ], + "texture": "#border" + }, + "up": { + "uv": [ + 0, + 0, + 6, + 2 + ], + "texture": "#border" + }, + "down": { + "uv": [ + 0, + 0, + 6, + 2 + ], + "texture": "#border" + } + } + }, + { + "name": "Line3", + "from": [ + 3, + 3, + 4 + ], + "to": [ + 13, + 13, + 6 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 10, + 10 + ], + "texture": "#border" + }, + "east": { + "uv": [ + 0, + 0, + 2, + 10 + ], + "texture": "#border" + }, + "south": { + "uv": [ + 0, + 0, + 10, + 10 + ], + "texture": "#border" + }, + "west": { + "uv": [ + 0, + 0, + 2, + 10 + ], + "texture": "#border" + }, + "up": { + "uv": [ + 0, + 0, + 10, + 2 + ], + "texture": "#border" + }, + "down": { + "uv": [ + 0, + 0, + 10, + 2 + ], + "texture": "#border" + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/refinedstorage/loot_tables/blocks/exporter.json b/src/main/resources/data/refinedstorage/loot_tables/blocks/exporter.json new file mode 100644 index 000000000..b27651dc7 --- /dev/null +++ b/src/main/resources/data/refinedstorage/loot_tables/blocks/exporter.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:exporter" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/refinedstorage/loot_tables/blocks/external_storage.json b/src/main/resources/data/refinedstorage/loot_tables/blocks/external_storage.json new file mode 100644 index 000000000..3b8bb9058 --- /dev/null +++ b/src/main/resources/data/refinedstorage/loot_tables/blocks/external_storage.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:external_storage" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/refinedstorage/loot_tables/blocks/importer.json b/src/main/resources/data/refinedstorage/loot_tables/blocks/importer.json new file mode 100644 index 000000000..0b7e38e4f --- /dev/null +++ b/src/main/resources/data/refinedstorage/loot_tables/blocks/importer.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:importer" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/refinedstorage/recipes/exporter.json b/src/main/resources/data/refinedstorage/recipes/exporter.json similarity index 66% rename from src/main/resources/assets/refinedstorage/recipes/exporter.json rename to src/main/resources/data/refinedstorage/recipes/exporter.json index ade5c2f44..240ae82db 100644 --- a/src/main/resources/assets/refinedstorage/recipes/exporter.json +++ b/src/main/resources/data/refinedstorage/recipes/exporter.json @@ -5,10 +5,10 @@ "item": "refinedstorage:cable" }, { - "item": "#construction_core" + "item": "refinedstorage:construction_core" }, { - "item": "#improved_processor" + "item": "refinedstorage:improved_processor" } ], "result": {