diff --git a/build.gradle b/build.gradle index 5abd8979..e73f9e5e 100644 --- a/build.gradle +++ b/build.gradle @@ -106,6 +106,7 @@ repositories { } dependencies { + minecraft "bta-download-repo:bta:${project.bta_version}" mappings loom.layered() {} @@ -117,14 +118,12 @@ dependencies { modImplementation "bta-halplibe:halplibe:${project.halplibe_version}" modImplementation "ModMenu:ModMenu:2.0.0" - modImplementation "fluidapi:fluidapi:1.7.1" - modImplementation "sunsetutils:sunsetutils:1.8.2" + //modImplementation "fluidapi:fluidapi:1.7.1" + implementation project(path: ":fluidapi", configuration: "namedElements") + implementation project(path: ":sunsetutils", configuration: "namedElements") + implementation project(path: ":energyapi", configuration: "namedElements") modImplementation "guidebookpp:guidebookpp:1.5.6" modImplementation "BTWaila:btwaila:0.2.2" - modImplementation "energyapi:energyapi:1.1.5" - modImplementation "potato-logistics:PotatoLogistics:0.1.4" - - //modImplementation files("C:\\Users\\sunsetsatellite\\Projects\\BTA\\SignalIndustries\\PotatoLogistics-0.1.2.jar") //modImplementation "retrostorage:retrostorage:1.2.0" implementation "org.slf4j:slf4j-api:1.8.0-beta4" diff --git a/settings.gradle b/settings.gradle index 882a4c13..097a5092 100644 --- a/settings.gradle +++ b/settings.gradle @@ -18,4 +18,10 @@ pluginManagement { url = 'https://maven.quiltmc.org/repository/release' } } -} \ No newline at end of file +} +include(":sunsetutils") +include(":fluidapi") +include(":energyapi") +project(':sunsetutils').projectDir = new File("C:\\Users\\sunsetsatellite\\Projects\\BTA\\1.7.7.0\\sunsetutils") +project(':fluidapi').projectDir = new File("C:\\Users\\sunsetsatellite\\Projects\\BTA\\1.7.7.0\\fluidapi") +project(':energyapi').projectDir = new File("C:\\Users\\sunsetsatellite\\Projects\\BTA\\1.7.7.0\\energyapi") \ No newline at end of file diff --git a/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java b/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java index 4eee2235..5dbf88f6 100644 --- a/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java +++ b/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java @@ -51,10 +51,8 @@ import sunsetsatellite.signalindustries.render.RenderAutoMiner; import sunsetsatellite.signalindustries.render.RenderFluidInBlock; import sunsetsatellite.signalindustries.render.RenderFluidInConduit; -import sunsetsatellite.signalindustries.util.AttachmentPoint; -import sunsetsatellite.signalindustries.util.BlockTexture; -import sunsetsatellite.signalindustries.util.Mode; -import sunsetsatellite.signalindustries.util.Tier; +import sunsetsatellite.signalindustries.render.RenderSignalumReactor; +import sunsetsatellite.signalindustries.util.*; import sunsetsatellite.signalindustries.weather.WeatherBloodMoon; import sunsetsatellite.signalindustries.weather.WeatherEclipse; import sunsetsatellite.signalindustries.weather.WeatherSolarApocalypse; @@ -245,11 +243,44 @@ public class SignalIndustries implements ModInitializer { .setTextures("reinforced_energy_connector.png") .build(new BlockEnergyConnector("reinforced.energyConnector",config.getFromConfig("reinforcedEnergyConnector",availableBlockId++),Tier.REINFORCED,Material.metal)); + public static final Block reinforcedFluidInputHatch = new BlockBuilder(MOD_ID) + .setBlockSound(BlockSounds.METAL) + .setHardness(5) + .setResistance(20) + .setLuminance(0) + .setTextures("reinforced_fluid_input_hatch.png") + .build(new BlockFluidInputHatch("reinforced.fluidInputHatch",config.getFromConfig("reinforcedFluidInputHatch",availableBlockId++),Tier.REINFORCED,Material.metal)); + + public static final Block reinforcedFluidOutputHatch = new BlockBuilder(MOD_ID) + .setBlockSound(BlockSounds.METAL) + .setHardness(5) + .setResistance(20) + .setLuminance(0) + .setTextures("reinforced_fluid_output_hatch.png") + .build(new BlockFluidOutputHatch("reinforced.fluidOutputHatch",config.getFromConfig("reinforcedFluidOutputHatch",availableBlockId++),Tier.REINFORCED,Material.metal)); + + public static final Block reinforcedItemInputBus = new BlockBuilder(MOD_ID) + .setBlockSound(BlockSounds.METAL) + .setHardness(5) + .setResistance(20) + .setLuminance(0) + .setTextures("reinforced_input_bus.png") + .build(new BlockInputBus("reinforced.itemInputBus",config.getFromConfig("reinforcedItemInputBus",availableBlockId++),Tier.REINFORCED,Material.metal)); + + public static final Block reinforcedItemOutputBus = new BlockBuilder(MOD_ID) + .setBlockSound(BlockSounds.METAL) + .setHardness(5) + .setResistance(20) + .setLuminance(0) + .setTextures("reinforced_output_bus.png") + .build(new BlockOutputBus("reinforced.itemOutputBus",config.getFromConfig("reinforcedItemOutputBus",availableBlockId++),Tier.REINFORCED,Material.metal)); + + //this has to be after any other block - public static final int[] energyTex = TextureHelper.registerBlockTexture(MOD_ID,"signalum_energy.png"); + public static final int[] energyTex = TextureHelper.registerBlockTexture(MOD_ID,"signalum_energy_transparent.png"); public static final int[] burntSignalumTex = TextureHelper.registerBlockTexture(MOD_ID,"burnt_signalum.png");//registerFluidTexture(MOD_ID,"signalum_energy.png",0,4); - public static final Block energyFlowing = BlockHelper.createBlock(MOD_ID,new BlockFluidFlowing(key("signalumEnergy"),config.getFromConfig("signalumEnergy",availableBlockId++),Material.water),"signalum_energy.png",BlockSounds.DEFAULT,1.0f,1.0f,0).withTexCoords(energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1]).withTags(BlockTags.NOT_IN_CREATIVE_MENU,BlockTags.PLACE_OVERWRITES); - public static final Block energyStill = BlockHelper.createBlock(MOD_ID,new BlockFluidStill(key("signalumEnergy"),config.getFromConfig("signalumEnergy",availableBlockId++),Material.water),"signalum_energy.png",BlockSounds.DEFAULT,1.0f,1.0f,0).withTexCoords(energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1]).withTags(BlockTags.NOT_IN_CREATIVE_MENU,BlockTags.PLACE_OVERWRITES); + public static final Block energyFlowing = BlockHelper.createBlock(MOD_ID,new BlockFluidFlowing(key("signalumEnergy"),config.getFromConfig("signalumEnergy",availableBlockId++),Material.water),"signalum_energy_transparent.png",BlockSounds.DEFAULT,1.0f,1.0f,0).withTexCoords(energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1]).withTags(BlockTags.NOT_IN_CREATIVE_MENU,BlockTags.PLACE_OVERWRITES); + public static final Block energyStill = BlockHelper.createBlock(MOD_ID,new BlockFluidStill(key("signalumEnergy"),config.getFromConfig("signalumEnergy",availableBlockId++),Material.water),"signalum_energy_transparent.png",BlockSounds.DEFAULT,1.0f,1.0f,0).withTexCoords(energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1],energyTex[0],energyTex[1]).withTags(BlockTags.NOT_IN_CREATIVE_MENU,BlockTags.PLACE_OVERWRITES); public static final Block burntSignalumFlowing = new BlockBuilder(MOD_ID) .setTextures("burnt_signalum.png") @@ -380,6 +411,8 @@ public class SignalIndustries implements ModInitializer { public static final Dimension dimEternity = new Dimension(key("eternity"),Dimension.overworld,1,portalEternity.id).setDefaultWorldType(eternityWorld); public static final Multiblock dimAnchorMultiblock = new Multiblock(MOD_ID,new Class[]{SignalIndustries.class},"dimensionalAnchor","dimensionalAnchor",false); + public static final Multiblock testMultiblock = new Multiblock(MOD_ID,new Class[]{SignalIndustries.class},"test","test",false); + public static final Multiblock signalumReactor = new Multiblock(MOD_ID,new Class[]{SignalIndustries.class},"signalumReactor","signalumReactor",false); public static Map textures = new HashMap<>(); @@ -532,12 +565,18 @@ public SignalIndustries(){ EntityHelper.createTileEntity(TileEntityCentrifuge.class,"Separation Centrifuge"); addToNameGuiMap("Separation Centrifuge", GuiCentrifuge.class, TileEntityCentrifuge.class); - EntityHelper.createTileEntity(TileEntitySignalumReactor.class,"Signalum Reactor"); + EntityHelper.createSpecialTileEntity(TileEntitySignalumReactor.class,new RenderSignalumReactor(),"Signalum Reactor"); addToNameGuiMap("Signalum Reactor", GuiSignalumReactor.class, TileEntitySignalumReactor.class); EntityHelper.createTileEntity(TileEntityEnergyConnector.class,"Energy Connector"); addToNameGuiMap("Energy Connector", GuiEnergyConnector.class, TileEntityEnergyConnector.class); + EntityHelper.createTileEntity(TileEntityItemBus.class,"Item Bus"); + addToNameGuiMap("Item Bus", GuiItemBus.class, TileEntityItemBus.class); + + EntityHelper.createTileEntity(TileEntityFluidHatch.class,"Fluid Hatch"); + addToNameGuiMap("Fluid Hatch", GuiItemBus.class, TileEntityFluidHatch.class); + EntityHelper.createTileEntity(TileEntityIgnitor.class,"Signalum Ignitor"); addToNameGuiMap("The Pulsar", GuiPulsar.class, InventoryPulsar.class); @@ -548,12 +587,15 @@ public SignalIndustries(){ EntityHelper.createTileEntity(TileEntityBlockBreaker.class,"Block Breaker"); Multiblock.multiblocks.put("dimensionalAnchor",dimAnchorMultiblock); + Multiblock.multiblocks.put("test",testMultiblock); + Multiblock.multiblocks.put("signalumReactor",signalumReactor); SignalIndustries.LOGGER.info(String.format("Loaded %d multiblocks..",Multiblock.multiblocks.size())); SignalIndustries.LOGGER.info(String.format("Loaded %d internal structures.", Structure.internalStructures.size())); EntityHelper.createEntity(EntityInfernal.class,new MobRenderer(new ModelZombie(), 0.5F),config.getFromConfig("infernalId",50),"Infernal"); //crafting recipes in RecipeHandlerCraftingSI + BlockDataExporter.export(); } public static Map mapOf(K[] keys, V[] values){ diff --git a/src/main/java/sunsetsatellite/signalindustries/api/impl/itempipes.rar b/src/main/java/sunsetsatellite/signalindustries/api/impl/itempipes.rar new file mode 100644 index 00000000..a478fcb1 Binary files /dev/null and b/src/main/java/sunsetsatellite/signalindustries/api/impl/itempipes.rar differ diff --git a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDilithiumStabilizer.java b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDilithiumStabilizer.java index 5ff2160e..84453327 100644 --- a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDilithiumStabilizer.java +++ b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDilithiumStabilizer.java @@ -93,6 +93,21 @@ public void onBlockPlaced(World world, int x, int y, int z, Side side, EntityLiv world.setBlockMetadataWithNotify(x, y, z, entity.getPlacementDirection(side).getOpposite().getId()); } + @Override + public int getBlockTextureFromSideAndMetadata(Side side, int meta) { + + if(SignalIndustries.textures == null) return this.atlasIndices[side.getId()]; + int index; + int[] orientationLookUpVertical = new int[]{1, 0, 2, 3, 4, 5, /**/ 0, 1, 2, 3, 4, 5}; + if(meta == 0 || meta == 1){ + index = orientationLookUpVertical[6 * meta + side.getId()]; + return SignalIndustries.textures.get("dilithiumStabilizer.vertical").getTexture(Side.getSideById(index)); + } else { + index = Sides.orientationLookUpHorizontal[6 * meta + side.getId()]; + } + return this.atlasIndices[index]; + } + @Override public int getBlockTexture(WorldSource blockAccess, int x, int y, int z, Side side) { TileEntityStabilizer tile = (TileEntityStabilizer) blockAccess.getBlockTileEntity(x,y,z); @@ -102,7 +117,7 @@ public int getBlockTexture(WorldSource blockAccess, int x, int y, int z, Side si if(meta == 0 || meta == 1){ index = orientationLookUpVertical[6 * meta + side.getId()]; if(tile.isBurning()){ - return SignalIndustries.textures.get("dilithiumStabilizer.verticaL.active").getTexture(Side.getSideById(index)); + return SignalIndustries.textures.get("dilithiumStabilizer.vertical.active").getTexture(Side.getSideById(index)); } else { return SignalIndustries.textures.get("dilithiumStabilizer.vertical").getTexture(Side.getSideById(index)); } diff --git a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDimensionalAnchor.java b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDimensionalAnchor.java index 2784c3f5..b43b3553 100644 --- a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDimensionalAnchor.java +++ b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockDimensionalAnchor.java @@ -98,7 +98,6 @@ public void onBlockRemoval(World world, int i, int j, int k) { @Override public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { - world.setBlockMetadata(i,j,k,3); if(world.isClientSide) { return true; diff --git a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockInputBus.java b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockInputBus.java index ba38168f..be5e39ef 100644 --- a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockInputBus.java +++ b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockInputBus.java @@ -8,9 +8,9 @@ import net.minecraft.core.world.World; import sunsetsatellite.fluidapi.template.tiles.TileEntityFluidPipe; import sunsetsatellite.signalindustries.SignalIndustries; -import sunsetsatellite.signalindustries.containers.ContainerBus; -import sunsetsatellite.signalindustries.gui.GuiBus; -import sunsetsatellite.signalindustries.inventories.TileEntityBus; +import sunsetsatellite.signalindustries.containers.ContainerItemBus; +import sunsetsatellite.signalindustries.gui.GuiItemBus; +import sunsetsatellite.signalindustries.inventories.TileEntityItemBus; import sunsetsatellite.signalindustries.util.Tier; import sunsetsatellite.sunsetutils.util.Direction; @@ -24,12 +24,12 @@ public BlockInputBus(String key, int i, Tier tier, Material material) { @Override protected TileEntity getNewBlockEntity() { - return new TileEntityBus(); + return new TileEntityItemBus(); } @Override public void onBlockRemoval(World world, int i, int j, int k) { - TileEntityBus tile = (TileEntityBus) world.getBlockTileEntity(i, j, k); + TileEntityItemBus tile = (TileEntityItemBus) world.getBlockTileEntity(i, j, k); if (tile != null) { for (Direction dir : Direction.values()) { TileEntity tile2 = dir.getTileEntity(world, tile); @@ -74,9 +74,9 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer ent return true; } else { - TileEntityBus tile = (TileEntityBus) world.getBlockTileEntity(i, j, k); + TileEntityItemBus tile = (TileEntityItemBus) world.getBlockTileEntity(i, j, k); if(tile != null) { - SignalIndustries.displayGui(entityplayer,new GuiBus(entityplayer.inventory, tile),new ContainerBus(entityplayer.inventory,tile),tile,i,j,k); + SignalIndustries.displayGui(entityplayer,new GuiItemBus(entityplayer.inventory, tile),new ContainerItemBus(entityplayer.inventory,tile),tile,i,j,k); } return true; } diff --git a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockOutputBus.java b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockOutputBus.java index 5091588d..87a33bad 100644 --- a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockOutputBus.java +++ b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockOutputBus.java @@ -8,9 +8,9 @@ import net.minecraft.core.world.World; import sunsetsatellite.fluidapi.template.tiles.TileEntityFluidPipe; import sunsetsatellite.signalindustries.SignalIndustries; -import sunsetsatellite.signalindustries.containers.ContainerBus; -import sunsetsatellite.signalindustries.gui.GuiBus; -import sunsetsatellite.signalindustries.inventories.TileEntityBus; +import sunsetsatellite.signalindustries.containers.ContainerItemBus; +import sunsetsatellite.signalindustries.gui.GuiItemBus; +import sunsetsatellite.signalindustries.inventories.TileEntityItemBus; import sunsetsatellite.signalindustries.util.Tier; import sunsetsatellite.sunsetutils.util.Direction; @@ -24,12 +24,12 @@ public BlockOutputBus(String key, int i, Tier tier, Material material) { @Override protected TileEntity getNewBlockEntity() { - return new TileEntityBus(); + return new TileEntityItemBus(); } @Override public void onBlockRemoval(World world, int i, int j, int k) { - TileEntityBus tile = (TileEntityBus) world.getBlockTileEntity(i, j, k); + TileEntityItemBus tile = (TileEntityItemBus) world.getBlockTileEntity(i, j, k); if (tile != null) { for (Direction dir : Direction.values()) { TileEntity tile2 = dir.getTileEntity(world, tile); @@ -74,9 +74,9 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer ent return true; } else { - TileEntityBus tile = (TileEntityBus) world.getBlockTileEntity(i, j, k); + TileEntityItemBus tile = (TileEntityItemBus) world.getBlockTileEntity(i, j, k); if(tile != null) { - SignalIndustries.displayGui(entityplayer,new GuiBus(entityplayer.inventory, tile),new ContainerBus(entityplayer.inventory,tile),tile,i,j,k); + SignalIndustries.displayGui(entityplayer,new GuiItemBus(entityplayer.inventory, tile),new ContainerItemBus(entityplayer.inventory,tile),tile,i,j,k); } return true; } diff --git a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockSignalumReactorCore.java b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockSignalumReactorCore.java index b6318dd3..5cf88e9a 100644 --- a/src/main/java/sunsetsatellite/signalindustries/blocks/BlockSignalumReactorCore.java +++ b/src/main/java/sunsetsatellite/signalindustries/blocks/BlockSignalumReactorCore.java @@ -11,6 +11,9 @@ import sunsetsatellite.signalindustries.gui.GuiSignalumReactor; import sunsetsatellite.signalindustries.inventories.TileEntitySignalumReactor; import sunsetsatellite.signalindustries.util.Tier; +import sunsetsatellite.sunsetutils.util.BlockInstance; +import sunsetsatellite.sunsetutils.util.Direction; +import sunsetsatellite.sunsetutils.util.Vec3i; public class BlockSignalumReactorCore extends BlockContainerTiered{ public BlockSignalumReactorCore(String key, int i, Tier tier, Material material) { @@ -32,8 +35,10 @@ public boolean blockActivated(World world, int i, int j, int k, EntityPlayer ent } else { TileEntitySignalumReactor tile = (TileEntitySignalumReactor) world.getBlockTileEntity(i, j, k); - if(tile != null) { + if(tile.multiblock != null && tile.multiblock.isValidAt(world,new BlockInstance(this,new Vec3i(i,j,k),tile), Direction.Z_POS/*Direction.getDirectionFromSide(world.getBlockMetadata(i,j,k)))*/)){ SignalIndustries.displayGui(entityplayer, new GuiSignalumReactor(entityplayer.inventory, tile), tile, i, j, k); + } else { + entityplayer.addChatMessage("event.signalindustries.invalidMultiblock"); } return true; } diff --git a/src/main/java/sunsetsatellite/signalindustries/containers/ContainerBus.java b/src/main/java/sunsetsatellite/signalindustries/containers/ContainerItemBus.java similarity index 75% rename from src/main/java/sunsetsatellite/signalindustries/containers/ContainerBus.java rename to src/main/java/sunsetsatellite/signalindustries/containers/ContainerItemBus.java index 1dd8ffb9..9928463d 100644 --- a/src/main/java/sunsetsatellite/signalindustries/containers/ContainerBus.java +++ b/src/main/java/sunsetsatellite/signalindustries/containers/ContainerItemBus.java @@ -3,16 +3,13 @@ import net.minecraft.core.player.inventory.IInventory; import net.minecraft.core.player.inventory.slot.Slot; import sunsetsatellite.fluidapi.api.ContainerFluid; -import sunsetsatellite.fluidapi.api.SlotFluid; import sunsetsatellite.signalindustries.inventories.TileEntityTieredContainer; -public class ContainerBus extends ContainerFluid { +public class ContainerItemBus extends ContainerFluid { - public ContainerBus(IInventory iInventory, TileEntityTieredContainer tile) { + public ContainerItemBus(IInventory iInventory, TileEntityTieredContainer tile) { super(iInventory, tile); this.tile = tile; - this.addFluidSlot(new SlotFluid(tile, 0, 80, 35)); - this.addSlot(new Slot(tile, 0, 80, 60)); for (int i = 0; i < 3; ++i) { for (int l = 0; l < 3; ++l) { diff --git a/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidHatch.java b/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidHatch.java index fabb22ad..541990c5 100644 --- a/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidHatch.java +++ b/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidHatch.java @@ -10,20 +10,20 @@ import sunsetsatellite.signalindustries.SignalIndustries; import sunsetsatellite.signalindustries.blocks.BlockContainerTiered; import sunsetsatellite.signalindustries.containers.ContainerFluidHatch; -import sunsetsatellite.signalindustries.inventories.TileEntityEnergyConnector; +import sunsetsatellite.signalindustries.inventories.TileEntityFluidHatch; import sunsetsatellite.signalindustries.inventories.TileEntityTieredContainer; public class GuiFluidHatch extends GuiFluid { - public String name = "Fluid I/O Hatch"; + public String name = "Fluid Hatch"; public EntityPlayer entityplayer; - public TileEntityEnergyConnector tile; + public TileEntityFluidHatch tile; public GuiFluidHatch(InventoryPlayer inventoryPlayer, TileEntity tile) { super(new ContainerFluidHatch(inventoryPlayer, (TileEntityTieredContainer) tile),inventoryPlayer); this.ySize = 192; - this.tile = (TileEntityEnergyConnector) tile; + this.tile = (TileEntityFluidHatch) tile; this.entityplayer = inventoryPlayer.player; } diff --git a/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidIOConfig.java b/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidIOConfig.java index d3717441..71aaf23e 100644 --- a/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidIOConfig.java +++ b/src/main/java/sunsetsatellite/signalindustries/gui/GuiFluidIOConfig.java @@ -13,6 +13,7 @@ import org.lwjgl.opengl.GL11; import sunsetsatellite.fluidapi.template.tiles.TileEntityFluidContainer; import sunsetsatellite.signalindustries.SignalIndustries; +import sunsetsatellite.signalindustries.inventories.TileEntityEnergyConnector; import sunsetsatellite.sunsetutils.util.Connection; import sunsetsatellite.sunsetutils.util.Direction; @@ -102,6 +103,8 @@ public void drawScreen(int x, int y, float renderPartialTicks) { @Override public void initGui() { + + controlList.add(new GuiButton(2, Math.round(width / 2) - 10, Math.round(height / 2) - 63, 15, 15, tile.connections.get(Direction.Y_POS).getLetter())); //Y+ controlList.add(new GuiButton(4, Math.round(width / 2) - 10, Math.round(height / 2) - 48, 15, 15, tile.connections.get(Direction.Z_POS).getLetter())); //Z+ controlList.add(new GuiButton(3, Math.round(width / 2) - 10, Math.round(height / 2) - 33, 15, 15, tile.connections.get(Direction.Y_NEG).getLetter())); //Y- @@ -125,6 +128,10 @@ public void initGui() { controlList.get(11).enabled = false; } + if(tile instanceof TileEntityEnergyConnector && ((TileEntityEnergyConnector) tile).isConnected()){ + controlList.get(0).enabled = false; + } + super.initGui(); } diff --git a/src/main/java/sunsetsatellite/signalindustries/gui/GuiBus.java b/src/main/java/sunsetsatellite/signalindustries/gui/GuiItemBus.java similarity index 86% rename from src/main/java/sunsetsatellite/signalindustries/gui/GuiBus.java rename to src/main/java/sunsetsatellite/signalindustries/gui/GuiItemBus.java index c743d221..e1e76f58 100644 --- a/src/main/java/sunsetsatellite/signalindustries/gui/GuiBus.java +++ b/src/main/java/sunsetsatellite/signalindustries/gui/GuiItemBus.java @@ -9,21 +9,21 @@ import sunsetsatellite.fluidapi.api.GuiFluid; import sunsetsatellite.signalindustries.SignalIndustries; import sunsetsatellite.signalindustries.blocks.BlockContainerTiered; -import sunsetsatellite.signalindustries.containers.ContainerBus; -import sunsetsatellite.signalindustries.inventories.TileEntityEnergyConnector; +import sunsetsatellite.signalindustries.containers.ContainerItemBus; +import sunsetsatellite.signalindustries.inventories.TileEntityItemBus; import sunsetsatellite.signalindustries.inventories.TileEntityTieredContainer; -public class GuiBus extends GuiFluid { +public class GuiItemBus extends GuiFluid { - public String name = "I/O Bus"; + public String name = "Item Bus"; public EntityPlayer entityplayer; - public TileEntityEnergyConnector tile; + public TileEntityItemBus tile; - public GuiBus(InventoryPlayer inventoryPlayer, TileEntity tile) { - super(new ContainerBus(inventoryPlayer, (TileEntityTieredContainer) tile),inventoryPlayer); + public GuiItemBus(InventoryPlayer inventoryPlayer, TileEntity tile) { + super(new ContainerItemBus(inventoryPlayer, (TileEntityTieredContainer) tile),inventoryPlayer); this.ySize = 192; - this.tile = (TileEntityEnergyConnector) tile; + this.tile = (TileEntityItemBus) tile; this.entityplayer = inventoryPlayer.player; } diff --git a/src/main/java/sunsetsatellite/signalindustries/gui/GuiSignalumReactor.java b/src/main/java/sunsetsatellite/signalindustries/gui/GuiSignalumReactor.java index b02ca960..a4921f28 100644 --- a/src/main/java/sunsetsatellite/signalindustries/gui/GuiSignalumReactor.java +++ b/src/main/java/sunsetsatellite/signalindustries/gui/GuiSignalumReactor.java @@ -1,20 +1,51 @@ package sunsetsatellite.signalindustries.gui; +import net.minecraft.client.gui.GuiButton; import net.minecraft.core.player.inventory.InventoryPlayer; +import org.lwjgl.opengl.GL11; import sunsetsatellite.signalindustries.inventories.TileEntitySignalumReactor; public class GuiSignalumReactor extends GuiTileEntity { public GuiSignalumReactor(InventoryPlayer inventory, TileEntitySignalumReactor tile) { super(inventory, tile); + xSize = 256; } @Override protected void drawGuiContainerBackgroundLayer(float f) { - + int i2 = this.mc.renderEngine.getTexture("/assets/signalindustries/gui/signalum_reactor_ui.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(i2); + int i3 = (this.width - this.xSize) / 2; + int i4 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i3, i4, 0, 0, this.xSize, this.ySize); } @Override protected void drawGuiContainerForegroundLayer() { - drawStringCentered(fontRenderer,"Testing",0,0,0xFFFF0000); + fontRenderer.drawCenteredString("Signalum Reactor", 128, 6, 0xFFFF0000); + fontRenderer.drawCenteredString("State: "+tile.state,128,20,0xFFFFFFFF); + fontRenderer.drawCenteredString("Fuel: "+tile.getFuel()+"|"+tile.getDepletedFuel(),128,30,0xFFFFFFFF); + } + + @Override + protected void buttonPressed(GuiButton guibutton) { + switch (guibutton.id){ + case 0: + tile.start(); + break; + } + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() + { + controlList.add(new GuiButton(0, Math.round((float) width / 2) - 10, Math.round((float) height / 2) + 50, 20, 20, "S")); + super.initGui(); } } diff --git a/src/main/java/sunsetsatellite/signalindustries/interfaces/IMultiblockPart.java b/src/main/java/sunsetsatellite/signalindustries/interfaces/IMultiblockPart.java new file mode 100644 index 00000000..d076f829 --- /dev/null +++ b/src/main/java/sunsetsatellite/signalindustries/interfaces/IMultiblockPart.java @@ -0,0 +1,11 @@ +package sunsetsatellite.signalindustries.interfaces; + +import net.minecraft.core.block.entity.TileEntity; + +public interface IMultiblockPart { + boolean isConnected(); + + TileEntity getConnectedTileEntity(); + + boolean connect(TileEntity tileEntity); +} diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityBus.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityBus.java deleted file mode 100644 index 059a0792..00000000 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityBus.java +++ /dev/null @@ -1,20 +0,0 @@ -package sunsetsatellite.signalindustries.inventories; - -import net.minecraft.core.item.ItemStack; -import sunsetsatellite.fluidapi.api.FluidStack; - -public class TileEntityBus extends TileEntityTieredContainer{ - - public TileEntityBus(){ - itemContents = new ItemStack[9]; - fluidContents = new FluidStack[0]; - fluidCapacity = new int[0]; - acceptedFluids.clear(); - } - - @Override - public void updateEntity() { - super.updateEntity(); - extractFluids(); - } -} diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityConduit.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityConduit.java index a94e403f..96c01d58 100644 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityConduit.java +++ b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityConduit.java @@ -17,8 +17,13 @@ public TileEntityConduit(){ @Override public void updateEntity() { - fluidCapacity[0] = (int) Math.pow(2,((BlockContainerTiered)getBlockType()).tier.ordinal()) * 1000; - transferSpeed = 20 * (((BlockContainerTiered)getBlockType()).tier.ordinal()+1); + if(fluidContents[0] != null && fluidContents[0].amount < 0){ + fluidContents[0] = null; + } + if(getBlockType() != null){ + fluidCapacity[0] = (int) Math.pow(2,((BlockContainerTiered)getBlockType()).tier.ordinal()) * 1000; + transferSpeed = 20 * (((BlockContainerTiered)getBlockType()).tier.ordinal()+1); + } super.updateEntity(); } diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityDimensionalAnchor.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityDimensionalAnchor.java index 6d273325..894454b5 100644 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityDimensionalAnchor.java +++ b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityDimensionalAnchor.java @@ -3,12 +3,12 @@ import com.mojang.nbt.CompoundTag; import net.minecraft.core.block.BlockFluid; -import net.minecraft.core.block.entity.TileEntity; import net.minecraft.core.item.ItemStack; import sunsetsatellite.fluidapi.api.FluidStack; import sunsetsatellite.signalindustries.SignalIndustries; import sunsetsatellite.signalindustries.entities.EntityColorParticleFX; import sunsetsatellite.signalindustries.interfaces.IStabilizable; +import sunsetsatellite.sunsetutils.util.BlockInstance; import sunsetsatellite.sunsetutils.util.Direction; import sunsetsatellite.sunsetutils.util.Vec3i; import sunsetsatellite.sunsetutils.util.multiblocks.IMultiblock; @@ -40,7 +40,15 @@ public void updateEntity() { speedMultiplier = 1; extractFluids(); stabilizers.clear(); - for (Direction value : Direction.values()) { + Direction dir = Direction.getDirectionFromSide(getBlockMetadata()); + ArrayList tileEntities = multiblock.getTileEntities(worldObj,new Vec3i(xCoord,yCoord,zCoord),dir); + for (BlockInstance tileEntity : tileEntities) { + if(tileEntity.tile instanceof TileEntityStabilizer){ + ((TileEntityStabilizer) tileEntity.tile).connectedTo = this; + stabilizers.add((TileEntityStabilizer) tileEntity.tile); + } + } + /* for (Direction value : Direction.values()) { if(value == Direction.Y_NEG || value == Direction.Y_POS) continue; Vec3i v = value.getVec().multiply(2); Vec3i tileVec = new Vec3i(xCoord,yCoord,zCoord); @@ -50,7 +58,7 @@ public void updateEntity() { stabilizers.add((TileEntityStabilizer) tile); } - } + }*/ boolean update = false; if(fuelBurnTicks > 0){ diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityEnergyConnector.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityEnergyConnector.java index 8fdb1cf9..9ca0d08f 100644 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityEnergyConnector.java +++ b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityEnergyConnector.java @@ -1,11 +1,17 @@ package sunsetsatellite.signalindustries.inventories; import net.minecraft.core.block.BlockFluid; +import net.minecraft.core.block.entity.TileEntity; import net.minecraft.core.item.ItemStack; import sunsetsatellite.fluidapi.api.FluidStack; import sunsetsatellite.signalindustries.SignalIndustries; +import sunsetsatellite.signalindustries.interfaces.IMultiblockPart; +import sunsetsatellite.sunsetutils.util.Connection; +import sunsetsatellite.sunsetutils.util.Direction; -public class TileEntityEnergyConnector extends TileEntityTieredContainer{ +public class TileEntityEnergyConnector extends TileEntityTieredContainer implements IMultiblockPart { + + public TileEntity connectedTo; public TileEntityEnergyConnector(){ itemContents = new ItemStack[1]; @@ -13,11 +19,34 @@ public TileEntityEnergyConnector(){ fluidCapacity = new int[1]; fluidCapacity[0] = 16000; acceptedFluids.get(0).add((BlockFluid) SignalIndustries.energyFlowing); + connections.put(Direction.Y_POS, Connection.OUTPUT); } @Override public void updateEntity() { super.updateEntity(); - extractFluids(); + if(isConnected()){ + if(connectedTo instanceof TileEntitySignalumReactor){ + if(((TileEntitySignalumReactor) connectedTo).state != TileEntitySignalumReactor.State.INACTIVE){ + extractFluids(); + } + } + } + } + + @Override + public boolean isConnected() { + return connectedTo != null; + } + + @Override + public TileEntity getConnectedTileEntity() { + return connectedTo; + } + + @Override + public boolean connect(TileEntity tileEntity) { + connectedTo = tileEntity; + return true; } } diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityFluidConduit.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityFluidConduit.java index 8c1641e6..379743a8 100644 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityFluidConduit.java +++ b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityFluidConduit.java @@ -23,6 +23,9 @@ public TileEntityFluidConduit(){ @Override public void updateEntity() { + if(fluidContents[0] != null && fluidContents[0].amount < 0){ + fluidContents[0] = null; + } if(getBlockType() != null){ fluidCapacity[0] = (int) Math.pow(2,((BlockContainerTiered)getBlockType()).tier.ordinal()) * 1000; transferSpeed = 20 * (((BlockContainerTiered)getBlockType()).tier.ordinal()+1); diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityIgnitor.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityIgnitor.java index 2799a2f1..928cc127 100644 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityIgnitor.java +++ b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityIgnitor.java @@ -8,15 +8,17 @@ import sunsetsatellite.fluidapi.template.tiles.TileEntityFluidItemContainer; import sunsetsatellite.fluidapi.template.tiles.TileEntityFluidPipe; import sunsetsatellite.signalindustries.SignalIndustries; +import sunsetsatellite.signalindustries.interfaces.IMultiblockPart; import sunsetsatellite.sunsetutils.util.Connection; import sunsetsatellite.sunsetutils.util.Direction; import sunsetsatellite.sunsetutils.util.TickTimer; import java.util.*; -public class TileEntityIgnitor extends TileEntityFluidItemContainer { +public class TileEntityIgnitor extends TileEntityFluidItemContainer implements IMultiblockPart { public boolean isActivated = false; - private final TickTimer timer = new TickTimer(this,"work",5,true); + private final TickTimer timer = new TickTimer(this,"work",20,true); + public TileEntity connectedTo; public TileEntityIgnitor(){ itemContents = new ItemStack[0]; @@ -38,12 +40,12 @@ public TileEntityIgnitor(){ public void updateEntity() { super.updateEntity(); timer.tick(); + Random random = new Random(); spreadFluids(Direction.Y_POS); worldObj.markBlocksDirty(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord); extractFluids(); if(getFluidInSlot(0) != null && getFluidInSlot(0).amount <= 0) fluidContents[0] = null; if(isActivated && getFluidInSlot(0) != null && getFluidInSlot(0).amount >= 5){ - Random random = new Random(); if(random.nextFloat() < 0.25){ float xd = random.nextFloat() / 10 - 0.05f; float yd = random.nextFloat() / 10 - 0.05f; @@ -69,18 +71,6 @@ public void spreadFluids(Direction dir) { if(getFluidInSlot(0) != null){ this.give(dir); } - /*if(tile.getFluidInSlot(0) == null && getFluidInSlot(0) != null){ - this.give(dir); - } else if (tile.getFluidInSlot(0) != null && getFluidInSlot(0) == null) { - this.take(tile.getFluidInSlot(0), dir); - } else { - if(tile.getFluidInSlot(0) == null || getFluidInSlot(0) == null) return; - if(tile.getFluidInSlot(0).amount < getFluidInSlot(0).amount){ - this.give(dir); - } else { - this.take(tile.getFluidInSlot(0), dir); - } - }*/ for (Direction direction : Direction.values()) { connections.put(dir, Connection.INPUT); } @@ -90,6 +80,10 @@ public boolean isBurning(){ return fluidContents[0] != null && fluidContents[0].liquid == SignalIndustries.energyFlowing && fluidContents[0].amount > 0 && isActivated; } + public boolean isEmpty(){ + return fluidContents[0] == null || fluidContents[0].liquid == SignalIndustries.energyFlowing && fluidContents[0].amount == 0; + } + public boolean isReady(){ return fluidContents[0] != null && fluidContents[0].liquid == SignalIndustries.energyFlowing && fluidContents[0].amount >= fluidCapacity[0]; } @@ -148,4 +142,20 @@ public void unpressurizePipes(TileEntityFluidPipe pipe,ArrayList stabilizers = new ArrayList<>(); + public List ignitors = new ArrayList<>(); + public TileEntityEnergyConnector connector; + public TileEntityItemBus input; + public TileEntityItemBus output; + public State state = State.INACTIVE; + public TileEntitySignalumReactor(){ + multiblock = Multiblock.multiblocks.get("signalumReactor"); + } + + @Override + public boolean isActive() { + return state == State.RUNNING; + } + + @Override + public boolean isReady() { + return state == State.STARTING; } + public enum State { + INACTIVE, + STARTING, + RUNNING, + } + + @Override + public void updateEntity() { + stabilizers.clear(); + ignitors.clear(); + Direction dir = Direction.getDirectionFromSide(getBlockMetadata()); + ArrayList tileEntities = multiblock.getTileEntities(worldObj,new Vec3i(xCoord,yCoord,zCoord),Direction.Z_POS); + for (BlockInstance tileEntity : tileEntities) { + if(tileEntity.tile instanceof IMultiblockPart){ + if(tileEntity.tile instanceof TileEntityStabilizer){ + stabilizers.add((TileEntityStabilizer) tileEntity.tile); + } + else if(tileEntity.tile instanceof TileEntityIgnitor){ + ignitors.add((TileEntityIgnitor) tileEntity.tile); + } + else if(tileEntity.tile instanceof TileEntityItemBus){ + if(tileEntity.block == SignalIndustries.reinforcedItemInputBus){ + input = (TileEntityItemBus) tileEntity.tile; + } else if (tileEntity.block == SignalIndustries.reinforcedItemOutputBus) { + output = (TileEntityItemBus) tileEntity.tile; + } + } + else if(tileEntity.tile instanceof TileEntityEnergyConnector){ + connector = (TileEntityEnergyConnector) tileEntity.tile; + } + ((IMultiblockPart) tileEntity.tile).connect(this); + } + } + if(state == State.STARTING && checkIfIgnitorsReady() && checkIfStabilizersReady()){ + state = State.RUNNING; + } + //TODO: state machine maybe? + if(state == State.RUNNING && checkIfStabilizersReady() && getFuel() > 0){ + depleteRandomFuelCell(); + } else if (state == State.RUNNING) { + state = State.INACTIVE; + } + if(state == State.RUNNING){ + ItemStack[] itemContents = input.itemContents; + for (int i = 0; i < itemContents.length; i++) { + ItemStack stack = itemContents[i]; + if (stack != null && stack.getItem() instanceof ItemFuelCell) { + if (stack.getData().getInteger("fuel") <= 0) { + if(output.itemContents[i] == null){ + output.itemContents[i] = stack; + input.itemContents[i] = null; + } + } + } + } + + if(getFuel() <= 0){ + state = State.INACTIVE; + } + for (TileEntityIgnitor ignitor : ignitors) { + if(ignitor.isEmpty()){ + state = State.INACTIVE; + break; + } + ignitor.isActivated = true; + } + } else { + for (TileEntityIgnitor ignitor : ignitors) { + ignitor.isActivated = false; + } + } + } + + public void depleteRandomFuelCell(){ + Random random = new Random(); + if(random.nextFloat() <= 0.25){ + //TODO: actually pick a random cell + for (ItemStack stack : input.itemContents) { + if (stack != null && stack.getItem() instanceof ItemFuelCell) { + int fuel = stack.getData().getInteger("fuel"); + int depleted = stack.getData().getInteger("depleted"); + if(fuel >= 0){ + stack.getData().putInt("fuel",fuel-1); + stack.getData().putInt("depleted",depleted+1); + } + } + } + } + } + + public boolean checkIfIgnitorsReady(){ + for (TileEntityIgnitor ignitor : ignitors) { + if(!ignitor.isReady()){ + return false; + } + } + return true; + } + + public boolean checkIfStabilizersReady(){ + boolean ready = true; + for (TileEntityStabilizer stabilizer : stabilizers) { + if (!stabilizer.canProcess()) { + ready = false; + } + } + return ready; + } + + public int getFuel(){ + if(input == null) return 0; + int fuel = 0; + for (ItemStack stack : input.itemContents) { + if(stack != null && stack.getItem() instanceof ItemFuelCell){ + fuel += stack.getData().getInteger("fuel"); + } + } + return fuel; + } + + public int getDepletedFuel(){ + if(input == null) return 0; + int depleted = 0; + for (ItemStack stack : input.itemContents) { + if(stack != null && stack.getItem() instanceof ItemFuelCell){ + depleted += stack.getData().getInteger("depleted"); + } + } + return depleted; + } + + public void start() { + if(getFuel() > 0 && state == State.INACTIVE){ + state = State.STARTING; + } else if (state == State.STARTING || state == State.RUNNING) { + state = State.INACTIVE; + } + } + + @Override + public Multiblock getMultiblock() { + return multiblock; + } } diff --git a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityStabilizer.java b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityStabilizer.java index 0676c9ac..d9261959 100644 --- a/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityStabilizer.java +++ b/src/main/java/sunsetsatellite/signalindustries/inventories/TileEntityStabilizer.java @@ -10,6 +10,7 @@ import sunsetsatellite.fluidapi.template.tiles.TileEntityFluidPipe; import sunsetsatellite.signalindustries.SignalIndustries; import sunsetsatellite.signalindustries.entities.EntityColorParticleFX; +import sunsetsatellite.signalindustries.interfaces.IMultiblockPart; import sunsetsatellite.signalindustries.interfaces.IStabilizable; import sunsetsatellite.sunsetutils.util.Connection; import sunsetsatellite.sunsetutils.util.Direction; @@ -20,7 +21,7 @@ import java.util.Map; import java.util.Random; -public class TileEntityStabilizer extends TileEntityFluidItemContainer { +public class TileEntityStabilizer extends TileEntityFluidItemContainer implements IMultiblockPart { public int fuelBurnTicks = 0; public int fuelMaxBurnTicks = 0; @@ -68,26 +69,31 @@ public void updateEntity() { /*SignalIndustries.spawnParticle(new EntityColorParticleFX(worldObj,xCoord+random.nextFloat(),yCoord+random.nextFloat(),zCoord+random.nextFloat(),0,0,0,1.0f,1.0f,0.0f,1.0f)); SignalIndustries.spawnParticle(new EntityColorParticleFX(worldObj,xCoord+random.nextFloat(),yCoord+random.nextFloat(),zCoord+random.nextFloat(),0,0,0,1.0f,1.0f,0.0f,1.0f));*/ if(connectedTo instanceof IStabilizable && ((IStabilizable) connectedTo).isActive()){ - progressTicks--; - Vec3i pos = new Vec3i(xCoord,yCoord,zCoord); - Vec3i connectedPos = new Vec3i(connectedTo.xCoord, connectedTo.yCoord, connectedTo.zCoord); - if(pos.x > connectedPos.x){ - int temp = pos.x; - pos.x = connectedPos.x; - connectedPos.x = temp; - } - if(pos.z > connectedPos.z){ - int temp = pos.z; - pos.z = connectedPos.z; - connectedPos.z = temp; - } - for (float i = pos.x; i <= connectedPos.x; i+=0.1f) { - for (float k = pos.z; k <= connectedPos.z; k+=0.1f) { - for (float l = 0; l < 4; l++) { - SignalIndustries.spawnParticle(new EntityColorParticleFX(worldObj,i+0.5,yCoord+0.5,k+0.5,0,0,0,1.0f,1.0f,0.0f,1.0f,6)); + if(connectedTo instanceof TileEntityDimensionalAnchor){ + Vec3i pos = new Vec3i(xCoord,yCoord,zCoord); + Vec3i connectedPos = new Vec3i(connectedTo.xCoord, connectedTo.yCoord, connectedTo.zCoord); + if(pos.x > connectedPos.x){ + int temp = pos.x; + pos.x = connectedPos.x; + connectedPos.x = temp; + } + if(pos.z > connectedPos.z){ + int temp = pos.z; + pos.z = connectedPos.z; + connectedPos.z = temp; + } + for (float i = pos.x; i <= connectedPos.x; i+=0.1f) { + for (float k = pos.z; k <= connectedPos.z; k+=0.1f) { + for (float l = 0; l < 4; l++) { + SignalIndustries.spawnParticle(new EntityColorParticleFX(worldObj,i+0.5,yCoord+0.5,k+0.5,0,0,0,1.0f,1.0f,0.0f,1.0f,6)); + } } } + } else if (connectedTo instanceof TileEntitySignalumReactor) { + for (float i = 0; i < 12; i+=0.2f) { + SignalIndustries.spawnParticle(new EntityColorParticleFX(worldObj,xCoord+0.5,yCoord+i,zCoord+0.5,0,0,0,1.0f,1.0f,0.0f,1.0f,6)); + } } } } @@ -242,5 +248,19 @@ public void readFromNBT(CompoundTag nBTTagCompound1) { } + @Override + public boolean isConnected() { + return connectedTo != null; + } + + @Override + public TileEntity getConnectedTileEntity() { + return connectedTo; + } + @Override + public boolean connect(TileEntity tileEntity) { + connectedTo = tileEntity; + return true; + } } diff --git a/src/main/java/sunsetsatellite/signalindustries/mixin/BlockFluidMixin.java b/src/main/java/sunsetsatellite/signalindustries/mixin/BlockFluidMixin.java new file mode 100644 index 00000000..b976057c --- /dev/null +++ b/src/main/java/sunsetsatellite/signalindustries/mixin/BlockFluidMixin.java @@ -0,0 +1,32 @@ +package sunsetsatellite.signalindustries.mixin; + +import net.minecraft.core.block.Block; +import net.minecraft.core.block.BlockFluid; +import net.minecraft.core.block.material.Material; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import sunsetsatellite.signalindustries.SignalIndustries; + +@Mixin( + value = BlockFluid.class, + remap = false +) +public abstract class BlockFluidMixin extends Block { + + @Unique + private final BlockFluid thisAs = (BlockFluid) ((Object)this); + + private BlockFluidMixin(String key, int id, Material material) { + super(key, id, material); + } + + @Inject(method = "getRenderBlockPass",at = @At("HEAD"), cancellable = true) + public void getRenderBlockPass(CallbackInfoReturnable cir) { + if(thisAs == SignalIndustries.energyFlowing || thisAs == SignalIndustries.energyStill){ + cir.setReturnValue(1); + } + } +} diff --git a/src/main/java/sunsetsatellite/signalindustries/mixin/ChunkDecoratorOverworldMixin.java b/src/main/java/sunsetsatellite/signalindustries/mixin/ChunkDecoratorOverworldMixin.java index 4130239c..9efc7ae9 100644 --- a/src/main/java/sunsetsatellite/signalindustries/mixin/ChunkDecoratorOverworldMixin.java +++ b/src/main/java/sunsetsatellite/signalindustries/mixin/ChunkDecoratorOverworldMixin.java @@ -32,17 +32,17 @@ public abstract class ChunkDecoratorOverworldMixin implements ChunkDecorator { locals = LocalCapture.CAPTURE_FAILHARD) public void decorate(Chunk chunk, CallbackInfo ci, int chunkX, int chunkZ, int minY, int maxY, int rangeY, float oreHeightModifier, int x, int z, int y, Biome biome, Random rand, long l1, long l2) { if(rand.nextInt(512) == 0){ - SignalIndustries.LOGGER.info(String.format("Meteor fell at X:%d Z:%d (X:%d Y:%d Z:%d)",chunkX,chunkZ,x,y,z)); + SignalIndustries.LOGGER.info(String.format("Iron Meteor fell at X:%d Z:%d (X:%d Y:%d Z:%d)",chunkX,chunkZ,x,y,z)); y = this.world.getHeightValue(x,z) - 4; new WorldFeatureMeteor(Block.oreIronBasalt.id,0,25).generate(world,rand,x,y,z); } if(rand.nextInt(1024) == 0){ - SignalIndustries.LOGGER.info(String.format("Meteor fell at X:%d Z:%d (X:%d Y:%d Z:%d)",chunkX,chunkZ,x,y,z)); + SignalIndustries.LOGGER.info(String.format("Signalum Meteor fell at X:%d Z:%d (X:%d Y:%d Z:%d)",chunkX,chunkZ,x,y,z)); y = this.world.getHeightValue(x,z) - 4; new WorldFeatureMeteor(SignalIndustries.signalumOre.id,0,15).generate(world,rand,x,y,z); } if(rand.nextInt(2048) == 0){ - SignalIndustries.LOGGER.info(String.format("Meteor fell at X:%d Z:%d (X:%d Y:%d Z:%d)",chunkX,chunkZ,x,y,z)); + SignalIndustries.LOGGER.info(String.format("Dilithium Meteor fell at X:%d Z:%d (X:%d Y:%d Z:%d)",chunkX,chunkZ,x,y,z)); y = this.world.getHeightValue(x,z) - 4; new WorldFeatureMeteor(SignalIndustries.dilithiumOre.id,0,3).generate(world,rand,x,y,z); } diff --git a/src/main/java/sunsetsatellite/signalindustries/mixin/MinecraftMixin.java b/src/main/java/sunsetsatellite/signalindustries/mixin/MinecraftMixin.java index 977a8981..e0bf968e 100644 --- a/src/main/java/sunsetsatellite/signalindustries/mixin/MinecraftMixin.java +++ b/src/main/java/sunsetsatellite/signalindustries/mixin/MinecraftMixin.java @@ -54,7 +54,7 @@ public void handleKeyboard(CallbackInfo ci){ KeyBinding switchModeKey = ((IKeybinds) Minecraft.getMinecraft(Minecraft.class).gameSettings).signalIndustries$getKeySwitchMode(); SignalumPowerSuit powerSuit = ((IPlayerPowerSuit)thePlayer).signalIndustries$getPowerSuit(); if(debounce <= 0){ - if(switchModeKey.isPressed()){ + if(switchModeKey.isPressed() && currentScreen == null){ debounce = 10; if(thePlayer != null){ if(thePlayer.getCurrentEquippedItem().getItem() == SignalIndustries.reinforcedSignalumDrill){ diff --git a/src/main/java/sunsetsatellite/signalindustries/render/RenderSignalumReactor.java b/src/main/java/sunsetsatellite/signalindustries/render/RenderSignalumReactor.java new file mode 100644 index 00000000..28bf8a8b --- /dev/null +++ b/src/main/java/sunsetsatellite/signalindustries/render/RenderSignalumReactor.java @@ -0,0 +1,35 @@ +package sunsetsatellite.signalindustries.render; + +import net.minecraft.core.block.entity.TileEntity; +import org.lwjgl.opengl.GL11; +import sunsetsatellite.signalindustries.SignalIndustries; +import sunsetsatellite.signalindustries.inventories.TileEntitySignalumReactor; +import sunsetsatellite.sunsetutils.util.multiblocks.RenderMultiblock; + +public class RenderSignalumReactor extends RenderMultiblock { + + @Override + public void doRender(TileEntity tileEntity, double d, double e, double f, float g) { + TileEntitySignalumReactor reactor = (TileEntitySignalumReactor) tileEntity; + super.doRender(tileEntity, d, e, f, g); + float fluidAmount = reactor.getFuel() + reactor.getDepletedFuel(); + float fluidMaxAmount = 4000*9; + int fluidId = SignalIndustries.energyFlowing.id; + + float amount = Math.max(Math.abs(fluidAmount / fluidMaxAmount),fluidAmount != 0 ? 0.14f : 0f); + float depletedAmount = Math.min(Math.abs(reactor.getDepletedFuel() / fluidAmount),0.9f); + if (fluidId != 0 && reactor.isActive()) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)d, (float)e, (float)f); + GL11.glScalef(2.99F, 7f, 2.99F); + GL11.glTranslatef(0.70F, -0.42F, -0.35F); + GL11.glColor4f(1-depletedAmount,1-depletedAmount,1-depletedAmount,amount); + GL11.glDisable(2896); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable( GL11.GL_BLEND ); + this.drawBlock(this.getFontRenderer(), this.renderDispatcher.renderEngine.minecraft.renderEngine, fluidId, 0, 0, 0, 0, tileEntity); + GL11.glEnable(2896); + GL11.glPopMatrix(); + } + } +} diff --git a/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java b/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java new file mode 100644 index 00000000..d7d6f9ba --- /dev/null +++ b/src/main/java/sunsetsatellite/signalindustries/util/BlockDataExporter.java @@ -0,0 +1,68 @@ +package sunsetsatellite.signalindustries.util; + +import com.mojang.nbt.CompoundTag; +import com.mojang.nbt.NbtIo; +import net.minecraft.client.Minecraft; +import net.minecraft.core.block.Block; +import net.minecraft.core.block.BlockTileEntity; +import net.minecraft.core.util.helper.Side; +import sunsetsatellite.signalindustries.SignalIndustries; +import turniplabs.halplibe.helper.TextureHelper; + +import java.io.DataOutputStream; +import java.io.File; +import java.lang.reflect.Field; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class BlockDataExporter { + public static void export() { + List fields = new ArrayList<>(Arrays.asList(SignalIndustries.class.getDeclaredFields())); + fields.removeIf((F)->F.getType() != Block.class); + CompoundTag data = new CompoundTag(); + for (Field field : fields) { + Block block; + try { + block = (Block) field.get(null); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + CompoundTag tag = new CompoundTag(); + tag.putString("name",field.getName()); + tag.putString("mod",SignalIndustries.class.getName()); + CompoundTag uv = new CompoundTag(); + for (Side side : Side.values()) { + if(side == Side.NONE) continue; + int index = block.atlasIndices[side.getId()]; + String file = ""; + for (Map.Entry entry : TextureHelper.registeredBlockTextures.entrySet()) { + String K = entry.getKey(); + int[] V = entry.getValue(); + int texIndex = Block.texCoordToIndex(V[0],V[1]); + if(texIndex == index){ + file = K; + } + } + uv.putString(side.name(),file.split(":")[1]); + } + tag.putCompound("uv",uv); + tag.putString("main_uv",uv.getString("SOUTH")); + tag.putString("draw_type","normal"); + tag.putBoolean("tile_entity", BlockTileEntity.class.isAssignableFrom(block.getClass())); + data.putCompound(field.getName(),tag); + } + String s = String.format("%s\\%s.nbt", Minecraft.getMinecraft(Minecraft.class).getMinecraftDir(), "blockInfo"); + File file = new File(s); + try { + try (DataOutputStream output = new DataOutputStream(Files.newOutputStream(file.toPath()))) { + NbtIo.write(data, output); + SignalIndustries.LOGGER.info("exported block data"); + } + } catch (Exception e){ + throw new RuntimeException(e); + } + } +} diff --git a/src/main/resources/assets/signalindustries/block/signalum_energy_transparent.png b/src/main/resources/assets/signalindustries/block/signalum_energy_transparent.png new file mode 100644 index 00000000..232aad0c Binary files /dev/null and b/src/main/resources/assets/signalindustries/block/signalum_energy_transparent.png differ diff --git a/src/main/resources/assets/signalindustries/gui/signalum_reactor_ui.png b/src/main/resources/assets/signalindustries/gui/signalum_reactor_ui.png new file mode 100644 index 00000000..2155de9e Binary files /dev/null and b/src/main/resources/assets/signalindustries/gui/signalum_reactor_ui.png differ diff --git a/src/main/resources/assets/signalindustries/structures/dimensionalAnchor.nbt b/src/main/resources/assets/signalindustries/structures/dimensionalAnchor.nbt index 29f7426c..ce08f3ba 100644 Binary files a/src/main/resources/assets/signalindustries/structures/dimensionalAnchor.nbt and b/src/main/resources/assets/signalindustries/structures/dimensionalAnchor.nbt differ diff --git a/src/main/resources/assets/signalindustries/structures/dimensionalAnchorOld.nbt b/src/main/resources/assets/signalindustries/structures/dimensionalAnchorOld.nbt new file mode 100644 index 00000000..29f7426c Binary files /dev/null and b/src/main/resources/assets/signalindustries/structures/dimensionalAnchorOld.nbt differ diff --git a/src/main/resources/assets/signalindustries/structures/signalumReactor.nbt b/src/main/resources/assets/signalindustries/structures/signalumReactor.nbt new file mode 100644 index 00000000..178ec2c4 Binary files /dev/null and b/src/main/resources/assets/signalindustries/structures/signalumReactor.nbt differ diff --git a/src/main/resources/assets/signalindustries/structures/test.nbt b/src/main/resources/assets/signalindustries/structures/test.nbt new file mode 100644 index 00000000..2aac6b6b Binary files /dev/null and b/src/main/resources/assets/signalindustries/structures/test.nbt differ diff --git a/src/main/resources/lang/signalindustries/en_US.lang b/src/main/resources/lang/signalindustries/en_US.lang index 3fb24406..ff1468e8 100644 --- a/src/main/resources/lang/signalindustries/en_US.lang +++ b/src/main/resources/lang/signalindustries/en_US.lang @@ -98,7 +98,7 @@ item.signalindustries.monsterShard.desc=Horrendous and corrupted. item.signalindustries.evilCatalyst.name=Evil Catalyst item.signalindustries.evilCatalyst.desc=A deep evil sealed within, there's probably a machine to could unleash it. item.signalindustries.infernalEye.name=Infernal Eye -item.signalindustries.infernalEye.desc=But they were, all of them, deceived for an even greater evil could be unleashed. +item.signalindustries.infernalEye.desc=But they were, all of them, deceived for an even greater evil was made. item.signalindustries.infernalFragment.name=Infernal Fragment item.signalindustries.infernalFragment.desc=When the eclipse reaches totality, the monsters come out of hiding. @@ -177,7 +177,7 @@ item.signalindustries.reinforced.attachment.secondaryEnergyPack.desc=Provides an item.signalindustries.reinforced.attachment.pulsar.name=The Pulsar (Attachment) item.signalindustries.reinforced.attachment.pulsar.desc=A modified version of [The Pulsar] that can be connected to a [Signalum Power Suit] utilizing it's energy network. item.signalindustries.basic.attachment.backpack.name=Basic Backpack -item.signalindustries.basic.attachment.backpack.desc=Portable item & fluid storage. Capable of storing a the same amount of items as a chest and 2 fluids (that aren't Signalum Energy). +item.signalindustries.basic.attachment.backpack.desc=Portable item & fluid storage. Capable of storing the same amount of items as a chest and 2 fluids (that aren't Signalum Energy). item.signalindustries.reinforced.attachment.backpack.name=Reinforced Backpack item.signalindustries.reinforced.attachment.backpack.desc=Portable item & fluid storage. Using latest object shrinking technology it is capable of storing the same amount of items as a double chest and 4 fluids (that aren't Signalum Energy). item.signalindustries.basic.attachment.jetpack.name=Jetpack @@ -263,10 +263,18 @@ tile.signalindustries.awakened.signalumReactorCore.name=Awakened Signalum Igniti tile.signalindustries.awakened.signalumReactorCore.desc=The cutting edge of Signalum technology. Welcome to the far end of your adventure. tile.signalindustries.reinforced.ignitor.name=Reinforced Signalum Ignitor -tile.signalindustries.reinforced.ignitor.desc=A core part of the [Signalum Reactor]. +tile.signalindustries.reinforced.ignitor.desc=A core part of the [Signalum Reactor]. Drives the reaction by forcibly igniting [Signalum Energy]. tile.signalindustries.reinforced.energyConnector.name=Reinforced Energy Connector tile.signalindustries.reinforced.energyConnector.desc=A dedicated energy hatch for Reinforced-tier multiblocks. +tile.signalindustries.reinforced.fluidInputHatch.name=Reinforced Fluid Input Hatch +tile.signalindustries.reinforced.fluidInputHatch.desc=A dedicated fluid input for Reinforced-tier multiblocks. +tile.signalindustries.reinforced.fluidOutputHatch.name=Reinforced Fluid Output Hatch +tile.signalindustries.reinforced.fluidOutputHatch.desc=A dedicated fluid output for Reinforced-tier multiblocks. +tile.signalindustries.reinforced.itemInputBus.name=Reinforced Item Input Bus +tile.signalindustries.reinforced.itemInputBus.desc=A dedicated item input for Reinforced-tier multiblocks. +tile.signalindustries.reinforced.itemOutputBus.name=Reinforced Item Output Bus +tile.signalindustries.reinforced.itemOutputBus.desc=A dedicated item output for Reinforced-tier multiblocks. tile.signalindustries.reinforced.centrifuge.name=Separation Centrifuge tile.signalindustries.reinforced.centrifuge.desc=Separates a liquid substance into its components. @@ -293,10 +301,10 @@ tile.signalindustries.prototype.plateFormer.name=Prototype Plate Former tile.signalindustries.prototype.plateFormer.desc=Welcome to the hydraulic pressing channel. Makes more [Plates] than the [Plate Hammer] and out of more materials. tile.signalindustries.basic.plateFormer.name=Basic Metal Press tile.signalindustries.basic.plateFormer.desc=Bends and shapes metal ingots. -tile.signalindustries.reinforced.plateFormer.name=Reinforced Forming Press +tile.signalindustries.reinforced.plateFormer.name=Reinforced Compressor tile.signalindustries.reinforced.plateFormer.desc=Bends and shapes materials with more pressure. tile.signalindustries.awakened.plateFormer.name=Awakened Singularity Compressor Controller -tile.signalindustries.awakened.plateFormer.desc=Could compress something down to a black hole if it didn't mean the destruction of this world. +tile.signalindustries.awakened.plateFormer.desc=The raw power of this machine would be capable of compressing materials into black holes if it wasn't controlled. tile.signalindustries.prototype.crystalCutter.name=Prototype Crystal Cutter tile.signalindustries.prototype.crystalCutter.desc=Cuts and removes impurities from [Raw S. Crystals], turning them into brilliant [Signalum Crystals]! @@ -305,7 +313,7 @@ tile.signalindustries.basic.crystalCutter.desc=An upgraded [Crystal Cutter] that tile.signalindustries.reinforced.crystalCutter.name=Reinforced Crystal Cutter tile.signalindustries.reinforced.crystalCutter.desc=Better, faster, stronger. tile.signalindustries.awakened.crystalCutter.name=Awakened Precision Laser Cutter Controller -tile.signalindustries.awakened.crystalCutter.desc=Uses frigging laser beams! What more could you want. +tile.signalindustries.awakened.crystalCutter.desc=Uses frigging laser beams to slice through almost anything! What more could you want. tile.signalindustries.basic.crystalChamber.name=Basic Crystal Chamber tile.signalindustries.basic.crystalChamber.desc=Combines the heat of an [Alloy Smelter] and the pressure of a [Plate Former] to fuse 2 [S. Crystals] together! @@ -406,7 +414,7 @@ ability.signalindustries.normal.testingAbility.name=Testing Ability ability.signalindustries.normal.testingAbility.desc=Does not do anything. For testing only. ability.signalindustries.awakened.clockwork.name=Clockwork -ability.signalindustries.awakened.clockwork.desc= +ability.signalindustries.awakened.clockwork.desc=The sands of time freeze on your command. achievements.page.signalindustries.desc=Achievements for Signal Industries! achievement.signalindustries.init=Initialization diff --git a/src/main/resources/signalindustries.mixins.json b/src/main/resources/signalindustries.mixins.json index 5fa2ea4e..c21e6eb8 100644 --- a/src/main/resources/signalindustries.mixins.json +++ b/src/main/resources/signalindustries.mixins.json @@ -5,6 +5,7 @@ "compatibilityLevel": "JAVA_8", "mixins": [ "AchievementMixin", + "BlockFluidMixin", "BlockRailMixin", "ChunkDecoratorOverworldMixin", "EntityArrowMixin",