├── .gitmodules ├── LICENSE - ART.txt ├── LICENSE - CODE.txt ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── assets │ │ └── thermaldynamics │ │ │ ├── sounds │ │ │ └── woosh.ogg │ │ │ ├── textures │ │ │ ├── logo.png │ │ │ ├── gui │ │ │ │ ├── relay.png │ │ │ │ ├── connection.png │ │ │ │ ├── transport.png │ │ │ │ └── transport_config.png │ │ │ ├── items │ │ │ │ ├── relay.png │ │ │ │ ├── filter_0.png │ │ │ │ ├── filter_1.png │ │ │ │ ├── filter_2.png │ │ │ │ ├── filter_3.png │ │ │ │ ├── filter_4.png │ │ │ │ ├── servo_0.png │ │ │ │ ├── servo_1.png │ │ │ │ ├── servo_2.png │ │ │ │ ├── servo_3.png │ │ │ │ ├── servo_4.png │ │ │ │ ├── cover_test.png │ │ │ │ ├── retriever_0.png │ │ │ │ ├── retriever_1.png │ │ │ │ ├── retriever_2.png │ │ │ │ ├── retriever_3.png │ │ │ │ └── retriever_4.png │ │ │ └── blocks │ │ │ │ └── duct │ │ │ │ ├── base │ │ │ │ ├── dense.png │ │ │ │ ├── invar.png │ │ │ │ ├── iron.png │ │ │ │ ├── lead.png │ │ │ │ ├── tin.png │ │ │ │ ├── trans.png │ │ │ │ ├── bronze.png │ │ │ │ ├── copper.png │ │ │ │ ├── lumium.png │ │ │ │ ├── tin_alt.png │ │ │ │ ├── vacuum.png │ │ │ │ ├── electrum.png │ │ │ │ ├── enderium.png │ │ │ │ ├── invar_band.png │ │ │ │ ├── lead_band.png │ │ │ │ ├── lead_trans.png │ │ │ │ ├── platinum.png │ │ │ │ ├── signalum.png │ │ │ │ ├── structure.png │ │ │ │ ├── tin_trans.png │ │ │ │ ├── bronze_large.png │ │ │ │ ├── copper_band.png │ │ │ │ ├── copper_trans.png │ │ │ │ ├── green_glass.png │ │ │ │ ├── invar_trans.png │ │ │ │ ├── tin_signalum.png │ │ │ │ ├── electrum_band.png │ │ │ │ ├── electrum_trans.png │ │ │ │ ├── enderium_band.png │ │ │ │ ├── enderium_large.png │ │ │ │ ├── enderium_trans.png │ │ │ │ ├── flux_electrum.png │ │ │ │ ├── invar_signalum.png │ │ │ │ ├── metal_redstone.png │ │ │ │ ├── platinum_large.png │ │ │ │ ├── platinum_trans.png │ │ │ │ ├── signalum_trans.png │ │ │ │ ├── structure_trans.png │ │ │ │ ├── tin_alt_signalum.png │ │ │ │ ├── enderium_trans_large.png │ │ │ │ ├── invar_signalum_trans.png │ │ │ │ ├── redstone_background.png │ │ │ │ └── tin_signalum_trans.png │ │ │ │ ├── side_ducts.png │ │ │ │ ├── connection │ │ │ │ ├── iron.png │ │ │ │ ├── lead.png │ │ │ │ ├── tin.png │ │ │ │ ├── copper.png │ │ │ │ ├── invar.png │ │ │ │ ├── lumium.png │ │ │ │ ├── electrum.png │ │ │ │ ├── enderium.png │ │ │ │ ├── platinum.png │ │ │ │ ├── signalum.png │ │ │ │ └── flux_electrum.png │ │ │ │ └── attachment │ │ │ │ ├── cover │ │ │ │ └── cover_side.png │ │ │ │ ├── filter │ │ │ │ ├── filter_0.png │ │ │ │ ├── filter_1.png │ │ │ │ ├── filter_2.png │ │ │ │ ├── filter_3.png │ │ │ │ └── filter_4.png │ │ │ │ ├── servo │ │ │ │ ├── servo_base_0_0.png │ │ │ │ ├── servo_base_0_1.png │ │ │ │ ├── servo_base_0_2.png │ │ │ │ ├── servo_base_0_3.png │ │ │ │ ├── servo_base_0_4.png │ │ │ │ ├── servo_base_1_0.png │ │ │ │ ├── servo_base_1_1.png │ │ │ │ ├── servo_base_1_2.png │ │ │ │ ├── servo_base_1_3.png │ │ │ │ └── servo_base_1_4.png │ │ │ │ ├── signallers │ │ │ │ └── signaller.png │ │ │ │ └── retriever │ │ │ │ ├── retriever_base_0_0.png │ │ │ │ ├── retriever_base_0_1.png │ │ │ │ ├── retriever_base_0_2.png │ │ │ │ ├── retriever_base_0_3.png │ │ │ │ ├── retriever_base_0_4.png │ │ │ │ ├── retriever_base_1_0.png │ │ │ │ ├── retriever_base_1_1.png │ │ │ │ ├── retriever_base_1_2.png │ │ │ │ ├── retriever_base_1_3.png │ │ │ │ └── retriever_base_1_4.png │ │ │ ├── lang │ │ │ └── en_GB.lang │ │ │ ├── sounds.json │ │ │ └── blockstates │ │ │ └── attachment.json │ └── mcmod.info │ └── java │ ├── cofh │ └── thermaldynamics │ │ ├── plugins │ │ └── jei │ │ │ ├── RecipeUidsTD.java │ │ │ ├── CoverRecipeHandler.java │ │ │ ├── CoverRecipeWrapper.java │ │ │ ├── JEIPluginTD.java │ │ │ └── CoverRecipeCategory.java │ │ ├── multiblock │ │ ├── IOccasionalTick.java │ │ ├── ISingleTick.java │ │ ├── IGridHolder.java │ │ ├── IGridTileRoute.java │ │ ├── IDuctTile.java │ │ ├── IGridTile.java │ │ ├── Tracker.java │ │ ├── NoComodSet.java │ │ ├── MultiBlockFormer.java │ │ ├── MultiBlockGridTracking.java │ │ └── MultiBlockGridWithRoutes.java │ │ ├── duct │ │ ├── attachments │ │ │ ├── filter │ │ │ │ ├── IFilterAttachment.java │ │ │ │ ├── IFilterFluid.java │ │ │ │ ├── IFilterConfig.java │ │ │ │ ├── IFilterItems.java │ │ │ │ ├── FilterItem.java │ │ │ │ ├── FilterFluid.java │ │ │ │ └── FilterBase.java │ │ │ ├── IStuffable.java │ │ │ ├── cover │ │ │ │ └── CoverHelper.java │ │ │ └── servo │ │ │ │ └── ServoFluid.java │ │ ├── IDuctFactory.java │ │ ├── ConnectionType.java │ │ ├── item │ │ │ ├── RouteInfo.java │ │ │ ├── GridItem.java │ │ │ └── SimulatedInv.java │ │ ├── tiles │ │ │ ├── TileDuctLight.java │ │ │ ├── IDuctHolder.java │ │ │ ├── TileEnergyDuctSuper.java │ │ │ ├── TileStructuralDuct.java │ │ │ ├── TileGridSingle.java │ │ │ ├── TileDuctEnergy.java │ │ │ ├── TileDuctOmni.java │ │ │ ├── TileTransportDuct.java │ │ │ ├── DuctToken.java │ │ │ ├── TileDuctFluid.java │ │ │ └── TileGridStructureBase.java │ │ ├── energy │ │ │ ├── DuctUnitEnergySuper.java │ │ │ ├── DuctUnitEnergyStorage.java │ │ │ └── GridEnergySuper.java │ │ ├── entity │ │ │ ├── GridTransport.java │ │ │ ├── SoundWoosh.java │ │ │ └── Camera.java │ │ ├── DuctTransport.java │ │ ├── light │ │ │ ├── DuctLight.java │ │ │ ├── PacketLight.java │ │ │ └── GridLight.java │ │ ├── fluid │ │ │ ├── DuctUnitFluidOmni.java │ │ │ ├── FluidTankGrid.java │ │ │ ├── PacketFluid.java │ │ │ ├── GridFluidSuper.java │ │ │ └── DuctUnitFluidSuper.java │ │ ├── AttachmentRegistry.java │ │ ├── DuctItem.java │ │ ├── DuctUnitStructural.java │ │ └── GridStructural.java │ │ ├── network │ │ └── PacketTDBase.java │ │ ├── render │ │ ├── RenderTest.java │ │ ├── RenderDuctOmni.java │ │ ├── RenderDuctFluids.java │ │ ├── TextureTransparent.java │ │ └── item │ │ │ └── RenderItemCover.java │ │ ├── proxy │ │ └── Proxy.java │ │ ├── gui │ │ ├── GuiConfigTDFactory.java │ │ ├── slot │ │ │ ├── SlotFilterFluid.java │ │ │ ├── SlotIcon.java │ │ │ └── SlotFilter.java │ │ ├── CreativeTabTDCovers.java │ │ ├── client │ │ │ ├── DirectoryEntry.java │ │ │ └── GuiTransportConfig.java │ │ ├── container │ │ │ ├── ContainerRelay.java │ │ │ ├── ContainerAttachmentBase.java │ │ │ ├── ContainerTransportConfig.java │ │ │ ├── ContainerTransport.java │ │ │ └── ContainerDuctConnection.java │ │ ├── GuiConfigTD.java │ │ ├── CreativeTabTD.java │ │ ├── GuiHandler.java │ │ └── element │ │ │ └── ElementDirectoryButton.java │ │ ├── init │ │ ├── TDBlocks.java │ │ ├── TDItems.java │ │ └── TDProps.java │ │ ├── util │ │ ├── TickHandlerClient.java │ │ ├── RecipeCover.java │ │ ├── ListWrapper.java │ │ └── WorldGridList.java │ │ └── item │ │ └── ItemRelay.java │ └── powercrystals │ └── minefactoryreloaded │ └── api │ └── IDeepStorageUnit.java ├── gradlew.bat ├── README.md └── .gitignore /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LICENSE - ART.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/LICENSE - ART.txt -------------------------------------------------------------------------------- /LICENSE - CODE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/LICENSE - CODE.txt -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/sounds/woosh.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/sounds/woosh.ogg -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/logo.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/gui/relay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/gui/relay.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/relay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/relay.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/gui/connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/gui/connection.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/gui/transport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/gui/transport.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/filter_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/filter_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/filter_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/filter_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/filter_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/filter_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/filter_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/filter_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/filter_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/servo_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/servo_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/servo_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/servo_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/servo_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/servo_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/servo_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/servo_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/servo_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/servo_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/cover_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/cover_test.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/retriever_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/retriever_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/retriever_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/retriever_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/retriever_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/retriever_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/retriever_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/retriever_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/items/retriever_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/items/retriever_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/dense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/dense.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/iron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/iron.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lead.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/side_ducts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/side_ducts.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/gui/transport_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/gui/transport_config.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/bronze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/bronze.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/copper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/copper.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lumium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lumium.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_alt.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/vacuum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/vacuum.png -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/plugins/jei/RecipeUidsTD.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.plugins.jei; 2 | 3 | public class RecipeUidsTD { 4 | 5 | public static final String COVER = "thermaldynamics.cover"; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/electrum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/electrum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_band.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_band.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lead_band.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lead_band.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lead_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/lead_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/platinum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/platinum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/signalum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/signalum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/structure.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/iron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/iron.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/lead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/lead.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/tin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/tin.png -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/IOccasionalTick.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | public interface IOccasionalTick { 4 | 5 | boolean occasionalTick(int pass); 6 | 7 | int numPasses(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/bronze_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/bronze_large.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/copper_band.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/copper_band.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/copper_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/copper_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/green_glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/green_glass.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_signalum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_signalum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/copper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/copper.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/invar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/invar.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/lumium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/lumium.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/electrum_band.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/electrum_band.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/electrum_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/electrum_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_band.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_band.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_large.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/flux_electrum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/flux_electrum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_signalum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_signalum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/metal_redstone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/metal_redstone.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/platinum_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/platinum_large.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/platinum_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/platinum_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/signalum_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/signalum_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/structure_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/structure_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/electrum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/electrum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/enderium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/enderium.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/platinum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/platinum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/signalum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/signalum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_alt_signalum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_alt_signalum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_trans_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/enderium_trans_large.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_signalum_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/invar_signalum_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/redstone_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/redstone_background.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_signalum_trans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/base/tin_signalum_trans.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/flux_electrum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/connection/flux_electrum.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/cover/cover_side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/cover/cover_side.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/filter/filter_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_0_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/servo/servo_base_1_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/signallers/signaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/signallers/signaller.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/lang/en_GB.lang: -------------------------------------------------------------------------------- 1 | #en_GB 2 | #*drinks tea angrily* 3 | 4 | tile.thermaldynamics.duct.energySuperconductor.name=Cryo-Stabilised Fluxduct 5 | tile.thermaldynamics.duct.energySuperconductorEmpty.name=Cryo-Stabilised Fluxduct (Empty) -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_0_4.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_3.png -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCBProject/ThermalDynamics/HEAD/src/main/resources/assets/thermaldynamics/textures/blocks/duct/attachment/retriever/retriever_base_1_4.png -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/IFilterAttachment.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | public interface IFilterAttachment { 4 | 5 | IFilterItems getItemFilter(); 6 | 7 | IFilterFluid getFluidFilter(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Sep 07 14:31:39 EDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/sounds.json: -------------------------------------------------------------------------------- 1 | { 2 | "ductsTransportWoosh": { 3 | "category": "neutral", 4 | "sounds": [ 5 | { 6 | "name": "thermaldynamics:woosh", 7 | "stream": false 8 | } 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/IDuctFactory.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | import cofh.thermaldynamics.duct.tiles.TileGrid; 4 | import net.minecraft.world.World; 5 | 6 | public interface IDuctFactory { 7 | 8 | TileGrid createTileEntity(Duct duct, World worldObj); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/ISingleTick.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import net.minecraft.world.World; 4 | 5 | public interface ISingleTick { 6 | 7 | boolean existsYet(); 8 | 9 | void singleTick(); 10 | 11 | World world(); 12 | 13 | boolean isOutdated(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/IStuffable.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public interface IStuffable { 6 | 7 | void stuffItem(ItemStack item); 8 | 9 | boolean canStuff(); 10 | 11 | boolean isStuffed(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/IFilterFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | import net.minecraftforge.fluids.FluidStack; 4 | 5 | public interface IFilterFluid { 6 | 7 | boolean allowFluid(FluidStack fluid); 8 | 9 | IFilterFluid nullFilter = fluid -> true; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/IGridHolder.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import java.util.List; 4 | 5 | public interface IGridHolder { 6 | 7 | List getConnectedSides(); 8 | 9 | void setInvalidForForming(); 10 | 11 | void setValidForForming(); 12 | 13 | boolean isValidForForming(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/ConnectionType.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | public enum ConnectionType { 4 | NORMAL(true), ONEWAY(true), BLOCKED(false), FORCED(true); 5 | 6 | ConnectionType(boolean allowTransfer) { 7 | 8 | this.allowTransfer = allowTransfer; 9 | } 10 | 11 | public final boolean allowTransfer; 12 | 13 | public ConnectionType next() { 14 | 15 | if (this == NORMAL) { 16 | return BLOCKED; 17 | } 18 | return NORMAL; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/item/RouteInfo.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.item; 2 | 3 | public class RouteInfo { 4 | 5 | public static final RouteInfo noRoute = new RouteInfo(); 6 | public boolean canRoute = false; 7 | public int stackSize = -1; 8 | public byte side = -1; 9 | 10 | public RouteInfo(int stackSizeLeft, byte i) { 11 | 12 | canRoute = true; 13 | stackSize = stackSizeLeft; 14 | side = i; 15 | } 16 | 17 | public RouteInfo() { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/network/PacketTDBase.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.network; 2 | 3 | import cofh.core.network.PacketCoFHBase; 4 | import cofh.core.network.PacketHandler; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | 7 | public class PacketTDBase extends PacketCoFHBase { 8 | 9 | public static void initialize() { 10 | 11 | PacketHandler.instance.registerPacket(PacketTDBase.class); 12 | } 13 | 14 | @Override 15 | public void handlePacket(EntityPlayer player, boolean isServer) { 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/IFilterConfig.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public interface IFilterConfig { 6 | 7 | ItemStack[] getFilterStacks(); 8 | 9 | void onChange(); 10 | 11 | int filterStackGridWidth(); 12 | 13 | boolean getFlag(int flagType); 14 | 15 | boolean setFlag(int flagType, boolean flag); 16 | 17 | boolean canAlterFlag(int flagType); 18 | 19 | String flagType(int flagType); 20 | 21 | int numFlags(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileDuctLight.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.thermaldynamics.duct.Duct; 4 | import cofh.thermaldynamics.duct.TDDucts; 5 | import cofh.thermaldynamics.duct.light.DuctUnitLight; 6 | 7 | public class TileDuctLight extends TileGridSingle { 8 | 9 | public TileDuctLight() { 10 | 11 | super(DuctToken.LIGHT, TDDucts.lightDuct); 12 | } 13 | 14 | @Override 15 | protected DuctUnit createDuctUnit(DuctToken token, Duct ductType) { 16 | 17 | return new DuctUnitLight(this, ductType); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "thermaldynamics", 4 | "name": "Thermal Dynamics", 5 | "description": "Thermal meets Dynamic - provides options for transporting items, fluids, and Redstone Flux!", 6 | "version": "${version}", 7 | "credits": "Team CoFH", 8 | "logoFile": "assets/thermaldynamics/textures/logo.png", 9 | "mcversion": "${mc_version}", 10 | "url": "http://www.teamcofh.com", 11 | "updateUrl": "", 12 | "authorList": [ "Team CoFH" ], 13 | "parent": "", 14 | "screenshots": [], 15 | "dependencies": [ 16 | "Forge,cofhcore,thermalfoundation" 17 | ] 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/energy/DuctUnitEnergySuper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.energy; 2 | 3 | import cofh.thermaldynamics.duct.Duct; 4 | import cofh.thermaldynamics.duct.tiles.TileGrid; 5 | 6 | public class DuctUnitEnergySuper extends DuctUnitEnergy { 7 | 8 | public DuctUnitEnergySuper(TileGrid parent, Duct duct, int transferLimit, int capacity) { 9 | 10 | super(parent, duct, transferLimit, capacity); 11 | } 12 | 13 | @Override 14 | public GridEnergySuper createGrid() { 15 | 16 | return new GridEnergySuper(parent.world(), getTransferLimit(), getCapacity()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/render/RenderTest.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.render; 2 | 3 | import cofh.core.render.ShaderHelper; 4 | import cofh.thermalfoundation.render.shader.ShaderStarfield; 5 | import net.minecraftforge.client.event.RenderLivingEvent; 6 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 7 | 8 | public class RenderTest { 9 | 10 | @SubscribeEvent 11 | public void renderStart(RenderLivingEvent.Pre event) { 12 | 13 | ShaderHelper.useShader(ShaderStarfield.starfieldShader, null); 14 | } 15 | 16 | @SubscribeEvent 17 | public void renderStop(RenderLivingEvent.Post event) { 18 | 19 | ShaderHelper.releaseShader(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/IFilterItems.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public interface IFilterItems { 6 | 7 | boolean matchesFilter(ItemStack item); 8 | 9 | boolean shouldIncRouteItems(); 10 | 11 | IFilterItems nullFilter = new IFilterItems() { 12 | 13 | @Override 14 | public boolean matchesFilter(ItemStack item) { 15 | 16 | return true; 17 | } 18 | 19 | @Override 20 | public boolean shouldIncRouteItems() { 21 | 22 | return true; 23 | } 24 | 25 | @Override 26 | public int getMaxStock() { 27 | 28 | return Integer.MAX_VALUE; 29 | } 30 | }; 31 | 32 | int getMaxStock(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/IGridTileRoute.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import cofh.thermaldynamics.duct.ConnectionType; 4 | import cofh.thermaldynamics.duct.item.RouteInfo; 5 | import net.minecraft.item.ItemStack; 6 | 7 | public interface IGridTileRoute, G extends MultiBlockGrid> extends IGridTile { 8 | 9 | int getWeight(); 10 | 11 | boolean canStuffItem(); 12 | 13 | boolean isOutput(); 14 | 15 | int getMaxRange(); 16 | 17 | ConnectionType getConnectionType(byte side); 18 | 19 | T getCachedTile(byte side); 20 | 21 | RouteInfo canRouteItem(ItemStack stack); 22 | 23 | byte getStuffedSide(); 24 | 25 | boolean acceptingStuff(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/IDuctHolder.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 4 | import net.minecraft.tileentity.TileEntity; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | public interface IDuctHolder { 9 | 10 | @Nullable 11 | , G extends MultiBlockGrid, C> T getDuct(DuctToken token); 12 | 13 | boolean isSideBlocked(int side); 14 | 15 | @Nullable 16 | static , G extends MultiBlockGrid, C> T getTokenFromTile(TileEntity tile, DuctToken token) { 17 | 18 | if (tile instanceof IDuctHolder) { 19 | return ((IDuctHolder) tile).getDuct(token); 20 | } 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileEnergyDuctSuper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.api.energy.IEnergyProvider; 4 | import cofh.api.energy.IEnergyReceiver; 5 | import cofh.thermaldynamics.duct.Duct; 6 | import cofh.thermaldynamics.duct.TDDucts; 7 | import cofh.thermaldynamics.duct.energy.DuctUnitEnergySuper; 8 | 9 | public class TileEnergyDuctSuper extends TileGridSingle implements IEnergyProvider, IEnergyReceiver { 10 | 11 | public TileEnergyDuctSuper() { 12 | 13 | super(DuctToken.ENERGY, TDDucts.energySuperCond); 14 | } 15 | 16 | @Override 17 | public DuctUnit createDuctUnit(DuctToken token, Duct ductType) { 18 | 19 | return new DuctUnitEnergySuper(this, ductType, 1000, 1000); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/proxy/Proxy.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.proxy; 2 | 3 | import cofh.core.render.IModelRegister; 4 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 5 | import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; 6 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 7 | 8 | public class Proxy { 9 | 10 | /* INIT */ 11 | public void preInit(FMLPreInitializationEvent event) { 12 | 13 | } 14 | 15 | public void initialize(FMLInitializationEvent event) { 16 | 17 | } 18 | 19 | public void postInit(FMLPostInitializationEvent event) { 20 | 21 | } 22 | 23 | /* HELPERS */ 24 | public boolean addIModelRegister(IModelRegister register) { 25 | 26 | return false; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/entity/GridTransport.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.entity; 2 | 3 | import cofh.thermaldynamics.multiblock.IGridTile; 4 | import cofh.thermaldynamics.multiblock.MultiBlockGridWithRoutes; 5 | import net.minecraft.world.World; 6 | import net.minecraftforge.common.DimensionManager; 7 | 8 | public class GridTransport extends MultiBlockGridWithRoutes { 9 | 10 | public GridTransport(World world) { 11 | 12 | super(world); 13 | } 14 | 15 | public GridTransport() { 16 | 17 | this(DimensionManager.getWorld(0)); 18 | } 19 | 20 | @Override 21 | public void tickGrid() { 22 | 23 | super.tickGrid(); 24 | 25 | } 26 | 27 | @Override 28 | public boolean canAddBlock(IGridTile aBlock) { 29 | 30 | return aBlock instanceof DuctUnitTransportBase; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/DuctTransport.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | import net.minecraft.client.renderer.texture.TextureMap; 4 | 5 | public class DuctTransport extends Duct { 6 | 7 | public DuctTransport(int id, boolean opaque, int pathWeight, int type, String name, Type ductType, IDuctFactory factory, String baseTexture, String connectionTexture, String fluidTexture, int fluidTransparency, String frameTexture, String frameFluidTexture, int frameFluidTransparency) { 8 | 9 | super(id, opaque, pathWeight, type, name, ductType, factory, baseTexture, connectionTexture, fluidTexture, fluidTransparency, frameTexture, frameFluidTexture, frameFluidTransparency); 10 | } 11 | 12 | @Override 13 | public void registerIcons(TextureMap textureMap) { 14 | 15 | super.registerIcons(textureMap); 16 | frameType = 4; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/GuiConfigTDFactory.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.gui.GuiScreen; 5 | import net.minecraftforge.fml.client.IModGuiFactory; 6 | 7 | import java.util.Set; 8 | 9 | public class GuiConfigTDFactory implements IModGuiFactory { 10 | 11 | /* IModGuiFactory */ 12 | @Override 13 | public void initialize(Minecraft minecraftInstance) { 14 | 15 | } 16 | 17 | @Override 18 | public Class mainConfigGuiClass() { 19 | 20 | return GuiConfigTD.class; 21 | } 22 | 23 | @Override 24 | public Set runtimeGuiCategories() { 25 | 26 | return null; 27 | } 28 | 29 | @Override 30 | public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { 31 | 32 | return null; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/slot/SlotFilterFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.slot; 2 | 3 | import cofh.core.util.item.ISpecialFilterFluid; 4 | import cofh.lib.util.helpers.FluidHelper; 5 | import cofh.thermaldynamics.duct.attachments.filter.IFilterConfig; 6 | import net.minecraft.item.ItemStack; 7 | 8 | public class SlotFilterFluid extends SlotFilter { 9 | 10 | public SlotFilterFluid(IFilterConfig tile, int slotIndex, int x, int y) { 11 | 12 | super(tile, slotIndex, x, y); 13 | } 14 | 15 | @Override 16 | public void putStack(ItemStack stack) { 17 | 18 | if (stack == null || isItemValid(stack)) { 19 | super.putStack(stack); 20 | } 21 | } 22 | 23 | @Override 24 | public boolean isItemValid(ItemStack stack) { 25 | 26 | return stack != null && (FluidHelper.getFluidForFilledItem(stack) != null || stack.getItem() instanceof ISpecialFilterFluid); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/render/RenderDuctOmni.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.render; 2 | 3 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluid; 4 | import cofh.thermaldynamics.duct.tiles.DuctToken; 5 | import cofh.thermaldynamics.duct.tiles.TileGrid; 6 | import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; 7 | 8 | public class RenderDuctOmni extends RenderDuctItems { 9 | 10 | public static final TileEntitySpecialRenderer instance = new RenderDuctOmni(); 11 | 12 | @Override 13 | public void renderTileEntityAt(TileGrid tile, double x, double y, double z, float frame, int destroyStage) { 14 | 15 | super.renderTileEntityAt(tile, x, y, z, frame, destroyStage); 16 | DuctUnitFluid ductUnitFluid = tile.getDuct(DuctToken.FLUID); 17 | if (ductUnitFluid != null) { 18 | RenderDuctFluids.instance.renderFluids(ductUnitFluid, x, y, z); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/plugins/jei/CoverRecipeHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.plugins.jei; 2 | 3 | import mezz.jei.api.recipe.IRecipeHandler; 4 | import mezz.jei.api.recipe.IRecipeWrapper; 5 | 6 | public class CoverRecipeHandler implements IRecipeHandler { 7 | 8 | @Override 9 | public Class getRecipeClass() { 10 | 11 | return CoverRecipeWrapper.class; 12 | } 13 | 14 | @Override 15 | public String getRecipeCategoryUid() { 16 | 17 | return RecipeUidsTD.COVER; 18 | } 19 | 20 | @Override 21 | public String getRecipeCategoryUid(CoverRecipeWrapper recipe) { 22 | 23 | return getRecipeCategoryUid(); 24 | } 25 | 26 | @Override 27 | public IRecipeWrapper getRecipeWrapper(CoverRecipeWrapper recipe) { 28 | 29 | return recipe; 30 | } 31 | 32 | @Override 33 | public boolean isRecipeValid(CoverRecipeWrapper recipe) { 34 | 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/energy/DuctUnitEnergyStorage.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.energy; 2 | 3 | import cofh.api.energy.IEnergyReceiver; 4 | import cofh.thermaldynamics.duct.Duct; 5 | import cofh.thermaldynamics.duct.tiles.DuctUnit; 6 | import cofh.thermaldynamics.duct.tiles.TileGrid; 7 | 8 | public class DuctUnitEnergyStorage extends DuctUnitEnergy { 9 | 10 | public DuctUnitEnergyStorage(TileGrid parent, Duct duct, int transferLimit, int capacity) { 11 | 12 | super(parent, duct, transferLimit, capacity); 13 | } 14 | 15 | @Override 16 | public boolean canConnectToOtherDuct(DuctUnit adjDuct, byte side, byte oppositeSide) { 17 | 18 | return super.canConnectToOtherDuct(adjDuct, side, oppositeSide) && adjDuct.cast() instanceof DuctUnitEnergyStorage; 19 | } 20 | 21 | @Override 22 | public boolean sendEnergy() { 23 | 24 | return true; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java: -------------------------------------------------------------------------------- 1 | package powercrystals.minefactoryreloaded.api; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public interface IDeepStorageUnit { 6 | 7 | /** 8 | * @return A populated ItemStack with stackSize for the full amount of materials in the DSU. May have a stackSize > getMaxStackSize(). May have a stackSize 9 | * of 0 (indicating locked contents). 10 | */ 11 | ItemStack getStoredItemType(); 12 | 13 | /** 14 | * Sets the total amount of the item currently being stored, or zero if all items are to be removed. 15 | */ 16 | void setStoredItemCount(int amount); 17 | 18 | /** 19 | * Sets the type of the stored item and initializes the number of stored items to amount. Will overwrite any existing stored items. 20 | */ 21 | void setStoredItemType(ItemStack type, int amount); 22 | 23 | /** 24 | * @return The maximum number of items the DSU can hold. May change based on the current type stored. 25 | */ 26 | int getMaxStoredCount(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileStructuralDuct.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.thermaldynamics.duct.Duct; 4 | import cofh.thermaldynamics.duct.DuctUnitStructural; 5 | import cofh.thermaldynamics.duct.TDDucts; 6 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 7 | 8 | import javax.annotation.Nullable; 9 | import java.util.Collections; 10 | 11 | public class TileStructuralDuct extends TileGrid { 12 | 13 | DuctUnitStructural structural = new DuctUnitStructural(this, TDDucts.structure); 14 | 15 | @Nullable 16 | @Override 17 | public , G extends MultiBlockGrid, C> T getDuct(DuctToken token) { 18 | 19 | if (token == DuctToken.STRUCTURAL) { 20 | return (T) structural; 21 | } 22 | return null; 23 | } 24 | 25 | @Override 26 | public Iterable getDuctUnits() { 27 | 28 | return Collections.singleton(structural); 29 | } 30 | 31 | @Override 32 | public Duct getDuctType() { 33 | 34 | return TDDucts.structure; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/plugins/jei/CoverRecipeWrapper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.plugins.jei; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import cofh.thermaldynamics.duct.TDDucts; 5 | import cofh.thermaldynamics.duct.attachments.cover.CoverHelper; 6 | import com.google.common.collect.ImmutableList; 7 | import mezz.jei.api.ingredients.IIngredients; 8 | import mezz.jei.api.recipe.BlankRecipeWrapper; 9 | import net.minecraft.item.ItemStack; 10 | 11 | public class CoverRecipeWrapper extends BlankRecipeWrapper { 12 | 13 | protected final ItemStack coverStack; 14 | protected final ItemStack coverBlock; 15 | 16 | public CoverRecipeWrapper(ItemStack cover) { 17 | 18 | coverStack = ItemHelper.cloneStack(cover, 6); 19 | coverBlock = CoverHelper.getCoverItemStack(coverStack, false); 20 | } 21 | 22 | @Override 23 | public void getIngredients(IIngredients ingredients) { 24 | 25 | ingredients.setInputs(ItemStack.class, ImmutableList.of(coverBlock, TDDucts.structure.itemStack)); 26 | ingredients.setOutputs(ItemStack.class, ImmutableList.of(coverStack)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileGridSingle.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.thermaldynamics.duct.Duct; 4 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 5 | 6 | import javax.annotation.Nullable; 7 | import java.util.Collections; 8 | 9 | public abstract class TileGridSingle extends TileGrid { 10 | 11 | final DuctToken token; 12 | final DuctUnit unit; 13 | 14 | public TileGridSingle(DuctToken token, Duct ductType) { 15 | 16 | this.token = token; 17 | this.unit = createDuctUnit(token, ductType); 18 | } 19 | 20 | protected abstract DuctUnit createDuctUnit(DuctToken token, Duct ductType); 21 | 22 | @Nullable 23 | @Override 24 | public , G extends MultiBlockGrid, C> T getDuct(DuctToken token) { 25 | 26 | if (token == this.token) { 27 | return (T) unit; 28 | } 29 | return null; 30 | } 31 | 32 | @Override 33 | public Iterable getDuctUnits() { 34 | 35 | return Collections.singleton(unit); 36 | } 37 | 38 | @Override 39 | public Duct getDuctType() { 40 | 41 | return unit.getDuctType(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/IDuctTile.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import net.minecraft.world.World; 4 | 5 | public interface IDuctTile extends IGridTile { 6 | 7 | IDuctTile getConnectedSide(byte side); 8 | 9 | boolean isBlockedSide(int side); 10 | 11 | boolean isSideConnected(byte side); 12 | 13 | // Used by some multiblocks to start their formations. Removed from the ticking list after initial tick. 14 | void singleTick(); 15 | 16 | // Used to do multiblock steps passed off by the grid. IE: Distribute liquids. 17 | // return false if the grid has altered 18 | boolean tickPass(int pass); 19 | 20 | boolean isNode(); 21 | 22 | boolean existsYet(); 23 | 24 | // Some tiles will have sub-grids that may not match the parent grid 25 | // e.g. Ender-pipes will require power but will not share power through regular pipes 26 | // we could also do stuff like pipe-wire using this if we were so inclined 27 | IDuctTile[] getSubTiles(); 28 | 29 | void addRelays(); 30 | 31 | /* PASSTHROUGH METHODS */ 32 | void onNeighborBlockChange(); 33 | 34 | int x(); 35 | 36 | int y(); 37 | 38 | int z(); 39 | 40 | World world(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/init/TDBlocks.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.init; 2 | 3 | import cofh.core.util.core.IInitializer; 4 | import cofh.thermaldynamics.block.BlockDuct; 5 | import cofh.thermaldynamics.duct.TDDucts; 6 | 7 | import java.util.ArrayList; 8 | 9 | public class TDBlocks { 10 | 11 | private TDBlocks() { 12 | 13 | } 14 | 15 | public static void preInit() { 16 | 17 | TDDucts.addDucts(); 18 | 19 | int numBlocks = (int) Math.ceil(cofh.thermaldynamics.duct.TDDucts.ductList.size() / 16.0); 20 | blockDuct = new BlockDuct[numBlocks]; 21 | for (int i = 0; i < numBlocks; i++) { 22 | blockDuct[i] = new BlockDuct(i); 23 | initList.add(blockDuct[i]); 24 | } 25 | 26 | for (IInitializer init : initList) { 27 | init.preInit(); 28 | } 29 | } 30 | 31 | public static void initialize() { 32 | 33 | for (IInitializer init : initList) { 34 | init.initialize(); 35 | } 36 | } 37 | 38 | public static void postInit() { 39 | 40 | for (IInitializer init : initList) { 41 | init.postInit(); 42 | } 43 | initList.clear(); 44 | } 45 | 46 | private static ArrayList initList = new ArrayList<>(); 47 | 48 | /* REFERENCES */ 49 | public static BlockDuct[] blockDuct; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/IGridTile.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import net.minecraft.util.math.BlockPos; 4 | import net.minecraft.world.World; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | public interface IGridTile, G extends MultiBlockGrid> extends ISingleTick { 9 | 10 | G createGrid(); 11 | 12 | G getGrid(); 13 | 14 | /* GRID FORMATION */ 15 | void setGrid(@Nullable G newGrid); 16 | 17 | void setInvalidForForming(); 18 | 19 | void setValidForForming(); 20 | 21 | boolean isValidForForming(); 22 | 23 | IGridTile getConnectedSide(int side); 24 | 25 | boolean isBlockedSide(int side); 26 | 27 | boolean isSideConnected(byte side); 28 | 29 | // Used to do multiblock steps passed off by the grid. IE: Distribute liquids. 30 | // return false if the grid has altered 31 | boolean tickPass(int pass); 32 | 33 | boolean isNode(); 34 | 35 | /* PASSTHROUGH METHODS */ 36 | void onNeighborBlockChange(); 37 | 38 | BlockPos pos(); 39 | 40 | World world(); 41 | 42 | default int x() { 43 | 44 | return pos().getX(); 45 | } 46 | 47 | default int y() { 48 | 49 | return pos().getY(); 50 | } 51 | 52 | default int z() { 53 | 54 | return pos().getZ(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/slot/SlotIcon.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.slot; 2 | 3 | import cofh.lib.gui.slot.SlotFalseCopy; 4 | import cofh.thermaldynamics.duct.entity.DuctUnitTransport; 5 | import net.minecraft.inventory.IInventory; 6 | import net.minecraft.inventory.InventoryBasic; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class SlotIcon extends SlotFalseCopy { 10 | 11 | private static final IInventory INV = new InventoryBasic("[FALSE]", false, 0); 12 | 13 | private final DuctUnitTransport duct; 14 | 15 | public SlotIcon(int x, int y, DuctUnitTransport duct) { 16 | 17 | super(INV, 0, x, y); 18 | this.duct = duct; 19 | } 20 | 21 | @Override 22 | public ItemStack getStack() { 23 | 24 | return ItemStack.copyItemStack(duct.data.item); 25 | } 26 | 27 | @Override 28 | public void putStack(ItemStack stack) { 29 | 30 | if (stack != null) { 31 | stack.stackSize = 1; 32 | } 33 | duct.setIcon(stack); 34 | } 35 | 36 | @Override 37 | public void onSlotChanged() { 38 | 39 | } 40 | 41 | @Override 42 | public int getSlotStackLimit() { 43 | 44 | return 1; 45 | } 46 | 47 | @Override 48 | public ItemStack decrStackSize(int amount) { 49 | 50 | return null; 51 | } 52 | 53 | @Override 54 | public boolean isHere(IInventory inv, int slotIn) { 55 | 56 | return false; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/light/DuctLight.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.light; 2 | 3 | import cofh.core.network.PacketHandler; 4 | import cofh.thermaldynamics.duct.Duct; 5 | import cofh.thermaldynamics.duct.IDuctFactory; 6 | import cofh.thermaldynamics.render.TextureOverlay; 7 | import cofh.thermaldynamics.render.TextureTransparent; 8 | import net.minecraft.client.renderer.texture.TextureMap; 9 | 10 | public class DuctLight extends Duct { 11 | 12 | static { 13 | PacketHandler.instance.registerPacket(PacketLight.class); 14 | } 15 | 16 | public DuctLight(int id, int type, String name, Type ductType, IDuctFactory factory, String baseTexture, String connectionTexture, String fluidTexture, int fluidTransparency) { 17 | 18 | super(id, false, 0, type, name, ductType, factory, baseTexture, connectionTexture, fluidTexture, fluidTransparency, null, null, 0); 19 | } 20 | 21 | @Override 22 | public void registerIcons(TextureMap textureMap) { 23 | 24 | iconBaseTexture = TextureOverlay.generateBaseTexture(textureMap, baseTexture); 25 | 26 | if (connectionTexture != null) { 27 | iconConnectionTexture = TextureOverlay.generateConnectionTexture(textureMap, connectionTexture); 28 | } 29 | if (fluidTexture != null) { 30 | iconFluidTexture = TextureTransparent.registerTransparentIcon(textureMap, fluidTexture, fluidTransparency); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/init/TDItems.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.init; 2 | 3 | import cofh.core.util.core.IInitializer; 4 | import cofh.thermaldynamics.item.*; 5 | 6 | import java.util.ArrayList; 7 | 8 | public class TDItems { 9 | 10 | private TDItems() { 11 | 12 | } 13 | 14 | public static void preInit() { 15 | 16 | itemServo = new ItemServo(); 17 | itemFilter = new ItemFilter(); 18 | itemRetriever = new ItemRetriever(); 19 | itemRelay = new ItemRelay(); 20 | itemCover = new ItemCover(); 21 | 22 | initList.add(itemServo); 23 | initList.add(itemFilter); 24 | initList.add(itemRetriever); 25 | initList.add(itemRelay); 26 | initList.add(itemCover); 27 | 28 | for (IInitializer init : initList) { 29 | init.preInit(); 30 | } 31 | } 32 | 33 | public static void initialize() { 34 | 35 | for (IInitializer init : initList) { 36 | init.initialize(); 37 | } 38 | } 39 | 40 | public static void postInit() { 41 | 42 | for (IInitializer init : initList) { 43 | init.postInit(); 44 | } 45 | initList.clear(); 46 | } 47 | 48 | static ArrayList initList = new ArrayList<>(); 49 | 50 | /* REFERENCES */ 51 | public static ItemServo itemServo; 52 | public static ItemFilter itemFilter; 53 | public static ItemRetriever itemRetriever; 54 | public static ItemRelay itemRelay; 55 | public static ItemCover itemCover; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/fluid/DuctUnitFluidOmni.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.fluid; 2 | 3 | import cofh.core.network.PacketCoFHBase; 4 | import cofh.thermaldynamics.block.BlockDuct; 5 | import cofh.thermaldynamics.duct.Duct; 6 | import cofh.thermaldynamics.duct.tiles.TileGrid; 7 | 8 | public class DuctUnitFluidOmni extends DuctUnitFluid { 9 | 10 | byte fluidMask; 11 | 12 | public DuctUnitFluidOmni(TileGrid parent, Duct duct) { 13 | 14 | super(parent, duct); 15 | } 16 | 17 | @Override 18 | public void writeToTilePacket(PacketCoFHBase payload) { 19 | 20 | super.writeToTilePacket(payload); 21 | 22 | byte fluidMask = 0; 23 | for (int i = 0; i < ductCache.length; i++) { 24 | if (ductCache[i] != null) { 25 | fluidMask |= (1 << i); 26 | } 27 | } 28 | payload.addByte(fluidMask); 29 | } 30 | 31 | @Override 32 | public void handleTilePacket(PacketCoFHBase payload) { 33 | 34 | super.handleTilePacket(payload); 35 | this.fluidMask = payload.getByte(); 36 | } 37 | 38 | @Override 39 | public int[] getRenderFluidConnections() { 40 | 41 | int[] renderFluidConnections = super.getRenderFluidConnections(); 42 | for (int i = 0; i < 6; i++) { 43 | if ((fluidMask & (1 << i)) == 0) { 44 | renderFluidConnections[i] = BlockDuct.ConnectionType.STRUCTURE_CONNECTION.ordinal(); 45 | } 46 | } 47 | return renderFluidConnections; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/FilterItem.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | import cofh.thermaldynamics.duct.AttachmentRegistry; 4 | import cofh.thermaldynamics.duct.Duct; 5 | import cofh.thermaldynamics.duct.tiles.TileGrid; 6 | import net.minecraft.inventory.IInventory; 7 | import net.minecraft.inventory.ISidedInventory; 8 | import net.minecraft.tileentity.TileEntity; 9 | 10 | public class FilterItem extends FilterBase { 11 | 12 | public FilterItem(TileGrid tile, byte side, int type) { 13 | 14 | super(tile, side, type); 15 | } 16 | 17 | public FilterItem(TileGrid tile, byte side) { 18 | 19 | super(tile, side); 20 | } 21 | 22 | IInventory inventory; 23 | ISidedInventory sidedInventory; 24 | 25 | @Override 26 | public void clearCache() { 27 | 28 | inventory = null; 29 | sidedInventory = null; 30 | } 31 | 32 | @Override 33 | public void cacheTile(TileEntity tile) { 34 | 35 | inventory = (IInventory) tile; 36 | if (tile instanceof ISidedInventory) { 37 | sidedInventory = (ISidedInventory) tile; 38 | } 39 | } 40 | 41 | @Override 42 | public boolean isValidTile(TileEntity tile) { 43 | 44 | return tile instanceof IInventory; 45 | } 46 | 47 | @Override 48 | public int getId() { 49 | 50 | return AttachmentRegistry.FILTER_ITEM; 51 | } 52 | 53 | @Override 54 | public FilterLogic createFilterLogic() { 55 | 56 | return new FilterLogic(type, Duct.Type.ITEM, this); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileDuctEnergy.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.api.energy.IEnergyProvider; 4 | import cofh.api.energy.IEnergyReceiver; 5 | import cofh.thermaldynamics.duct.Duct; 6 | import cofh.thermaldynamics.duct.TDDucts; 7 | import cofh.thermaldynamics.duct.energy.DuctUnitEnergy; 8 | 9 | public class TileDuctEnergy extends TileGridStructureBase implements IEnergyReceiver, IEnergyProvider { 10 | 11 | public TileDuctEnergy(Duct duct) { 12 | 13 | addDuctUnits(DuctToken.ENERGY, new DuctUnitEnergy(this, duct)); 14 | } 15 | 16 | @Override 17 | protected DuctToken getPrimaryDuctToken() { 18 | 19 | return DuctToken.ENERGY; 20 | } 21 | 22 | public static class Basic extends TileDuctEnergy { 23 | 24 | public Basic() { 25 | 26 | super(TDDucts.energyBasic); 27 | } 28 | } 29 | 30 | public static class Reinforced extends TileDuctEnergy { 31 | 32 | public Reinforced() { 33 | 34 | super(TDDucts.energyReinforced); 35 | } 36 | } 37 | 38 | public static class Hardened extends TileDuctEnergy { 39 | 40 | public Hardened() { 41 | 42 | super(TDDucts.energyHardened); 43 | } 44 | } 45 | 46 | public static class Signalum extends TileDuctEnergy { 47 | 48 | public Signalum() { 49 | 50 | super(TDDucts.energySignalum); 51 | } 52 | } 53 | 54 | public static class Resonant extends TileDuctEnergy { 55 | 56 | public Resonant() { 57 | 58 | super(TDDucts.energyResonant); 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/entity/SoundWoosh.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.entity; 2 | 3 | import net.minecraft.client.audio.MovingSound; 4 | import net.minecraft.util.ResourceLocation; 5 | import net.minecraft.util.SoundCategory; 6 | import net.minecraft.util.SoundEvent; 7 | 8 | public class SoundWoosh extends MovingSound { 9 | 10 | private final EntityTransport transport; 11 | 12 | public static final SoundEvent WOOSH = new SoundEvent(new ResourceLocation("thermaldynamics", "ductsTransportWoosh")).setRegistryName("thermaldynamics:ducts_transport_woosh"); 13 | 14 | protected SoundWoosh(EntityTransport transport) { 15 | 16 | super(WOOSH, SoundCategory.NEUTRAL); 17 | this.transport = transport; 18 | this.repeat = true; 19 | this.repeatDelay = 0; 20 | this.volume = 0.0001F; 21 | } 22 | 23 | @Override 24 | public void update() { 25 | 26 | if (transport == null || this.transport.isDead) { 27 | if (this.volume > 0) { 28 | this.volume -= 0.25f; 29 | } else { 30 | this.donePlaying = true; 31 | } 32 | } else { 33 | if (this.transport.pause > 0) { 34 | if (this.volume > 0) { 35 | this.volume -= 0.25f; 36 | } else { 37 | this.volume = 0; 38 | } 39 | } else { 40 | if (this.volume < 0.5) { 41 | this.volume += 0.0625f; 42 | } else { 43 | this.volume = 0.5F; 44 | } 45 | } 46 | this.xPosF = (float) this.transport.posX; 47 | this.yPosF = (float) this.transport.posY; 48 | this.zPosF = (float) this.transport.posZ; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/FilterFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | import cofh.thermaldynamics.duct.AttachmentRegistry; 4 | import cofh.thermaldynamics.duct.Duct; 5 | import cofh.thermaldynamics.duct.tiles.TileGrid; 6 | import net.minecraft.tileentity.TileEntity; 7 | import net.minecraft.util.EnumFacing; 8 | import net.minecraftforge.fluids.capability.CapabilityFluidHandler; 9 | import net.minecraftforge.fluids.capability.IFluidHandler; 10 | 11 | public class FilterFluid extends FilterBase { 12 | 13 | public FilterFluid(TileGrid tile, byte side, int type) { 14 | 15 | super(tile, side, type); 16 | } 17 | 18 | public FilterFluid(TileGrid tile, byte side) { 19 | 20 | super(tile, side); 21 | } 22 | 23 | IFluidHandler tank; 24 | 25 | @Override 26 | public void clearCache() { 27 | 28 | tank = null; 29 | } 30 | 31 | @Override 32 | public void cacheTile(TileEntity tile) { 33 | 34 | tank = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.VALUES[side ^ 1]); 35 | } 36 | 37 | @Override 38 | public boolean isValidTile(TileEntity tile) { 39 | 40 | return tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.VALUES[side ^ 1]); 41 | } 42 | 43 | @Override 44 | public int getId() { 45 | 46 | return AttachmentRegistry.FILTER_FLUID; 47 | } 48 | 49 | @Override 50 | public FilterLogic createFilterLogic() { 51 | 52 | return new FilterLogic(type, Duct.Type.FLUID, this); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/slot/SlotFilter.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.slot; 2 | 3 | import cofh.lib.gui.slot.SlotFalseCopy; 4 | import cofh.thermaldynamics.duct.attachments.filter.IFilterConfig; 5 | import net.minecraft.inventory.IInventory; 6 | import net.minecraft.inventory.InventoryBasic; 7 | import net.minecraft.item.ItemStack; 8 | 9 | public class SlotFilter extends SlotFalseCopy { 10 | 11 | IFilterConfig filter; 12 | 13 | private static final IInventory INV = new InventoryBasic("[FALSE]", false, 0); 14 | 15 | public SlotFilter(IFilterConfig tile, int slotIndex, int x, int y) { 16 | 17 | super(INV, slotIndex, x, y); 18 | filter = tile; 19 | } 20 | 21 | @Override 22 | public boolean isItemValid(ItemStack stack) { 23 | 24 | return stack != null; 25 | } 26 | 27 | @Override 28 | public ItemStack getStack() { 29 | 30 | return filter.getFilterStacks()[getSlotIndex()]; 31 | } 32 | 33 | @Override 34 | public void putStack(ItemStack stack) { 35 | 36 | synchronized (filter.getFilterStacks()) { 37 | if (stack != null) { 38 | stack.stackSize = 1; 39 | } 40 | filter.getFilterStacks()[getSlotIndex()] = stack; 41 | onSlotChanged(); 42 | } 43 | } 44 | 45 | @Override 46 | public void onSlotChanged() { 47 | 48 | filter.onChange(); 49 | } 50 | 51 | @Override 52 | public int getSlotStackLimit() { 53 | 54 | return 1; 55 | } 56 | 57 | @Override 58 | public ItemStack decrStackSize(int amount) { 59 | 60 | return null; 61 | } 62 | 63 | @Override 64 | public boolean isHere(IInventory inv, int slotIn) { 65 | 66 | return false; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/CreativeTabTDCovers.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.core.util.CoreUtils; 5 | import cofh.lib.util.TimeTracker; 6 | import cofh.lib.util.helpers.MathHelper; 7 | import cofh.thermaldynamics.item.ItemCover; 8 | import net.minecraft.creativetab.CreativeTabs; 9 | import net.minecraft.item.Item; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.world.World; 12 | import net.minecraftforge.fml.relauncher.Side; 13 | import net.minecraftforge.fml.relauncher.SideOnly; 14 | 15 | public class CreativeTabTDCovers extends CreativeTabs { 16 | 17 | int iconIndex = 0; 18 | TimeTracker iconTracker = new TimeTracker(); 19 | 20 | public CreativeTabTDCovers() { 21 | 22 | super("ThermalDynamicsCovers"); 23 | } 24 | 25 | @Override 26 | public ItemStack getIconItemStack() { 27 | 28 | updateIcon(); 29 | return ItemCover.getCoverList().get(iconIndex); 30 | } 31 | 32 | @Override 33 | @SideOnly (Side.CLIENT) 34 | public Item getTabIconItem() { 35 | 36 | return getIconItemStack().getItem(); 37 | } 38 | 39 | @Override 40 | @SideOnly (Side.CLIENT) 41 | public String getTabLabel() { 42 | 43 | return "thermaldynamics.creativeTabCovers"; 44 | } 45 | 46 | private void updateIcon() { 47 | 48 | World world = CoFHCore.proxy.getClientWorld(); 49 | 50 | if (CoreUtils.isClient() && iconTracker.hasDelayPassed(world, 80)) { 51 | int next = MathHelper.RANDOM.nextInt(ItemCover.getCoverList().size() - 1); 52 | iconIndex = next >= iconIndex ? next + 1 : next; 53 | iconTracker.markTime(world); 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/client/DirectoryEntry.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.client; 2 | 3 | import cofh.core.network.PacketCoFHBase; 4 | import cofh.core.network.PacketTileInfo; 5 | import cofh.lib.util.helpers.StringHelper; 6 | import cofh.thermaldynamics.duct.entity.DuctUnitTransport; 7 | import com.google.common.base.Strings; 8 | import net.minecraft.item.ItemStack; 9 | 10 | public final class DirectoryEntry { 11 | 12 | public final String name; 13 | public final int x, y, z; 14 | public final ItemStack icon; 15 | 16 | public static void addDirectoryEntry(PacketTileInfo myPayload, DuctUnitTransport endPoint) { 17 | 18 | myPayload.addString(endPoint.data.name); 19 | myPayload.addInt(endPoint.x()); 20 | myPayload.addInt(endPoint.y()); 21 | myPayload.addInt(endPoint.z()); 22 | myPayload.addItemStack(endPoint.data.item); 23 | } 24 | 25 | public DirectoryEntry(PacketCoFHBase packet) { 26 | 27 | this(packet.getString(), packet.getInt(), packet.getInt(), packet.getInt(), packet.getItemStack()); 28 | } 29 | 30 | public DirectoryEntry(String name, int x, int y, int z, ItemStack icon) { 31 | 32 | this.name = name; 33 | this.x = x; 34 | this.y = y; 35 | this.z = z; 36 | this.icon = icon; 37 | 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | 43 | return "DirectoryEntry{" + "name='" + name + '\'' + ", x=" + x + ", y=" + y + ", z=" + z + ", icon=" + icon + '}'; 44 | } 45 | 46 | public String getName() { 47 | 48 | if (Strings.isNullOrEmpty(name)) { 49 | return StringHelper.localize("gui.thermaldynamics.transport.unnamed"); 50 | } else { 51 | return name; 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/container/ContainerRelay.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.container; 2 | 3 | import cofh.thermaldynamics.duct.GridStructural; 4 | import cofh.thermaldynamics.duct.attachments.relay.Relay; 5 | import net.minecraft.inventory.IContainerListener; 6 | 7 | public class ContainerRelay extends ContainerAttachmentBase { 8 | 9 | private final Relay relay; 10 | public int relayPower = 0; 11 | public int gridPower = 0; 12 | 13 | public ContainerRelay(Relay relay) { 14 | 15 | super(relay); 16 | this.relay = relay; 17 | } 18 | 19 | @Override 20 | public void detectAndSendChanges() { 21 | 22 | super.detectAndSendChanges(); 23 | 24 | int prevRelay = relayPower; 25 | int prevGrid = gridPower; 26 | 27 | relayPower = relay.getPowerLevel(); 28 | 29 | GridStructural grid = relay.structureUnit.getGrid(); 30 | if (grid != null && grid.rs != null) { 31 | if (grid.rs.nextRedstoneLevel == -128) { 32 | gridPower = grid.rs.redstoneLevel; 33 | } else { 34 | gridPower = grid.rs.nextRedstoneLevel; 35 | } 36 | } else { 37 | gridPower = 0; 38 | } 39 | 40 | if (relayPower == prevRelay && gridPower == prevGrid) { 41 | return; 42 | } 43 | 44 | for (IContainerListener listener : this.listeners) { 45 | if (gridPower != prevGrid) { 46 | listener.sendProgressBarUpdate(this, 0, gridPower); 47 | } 48 | if (relayPower != prevRelay) { 49 | listener.sendProgressBarUpdate(this, 1, relayPower); 50 | } 51 | } 52 | } 53 | 54 | @Override 55 | public void updateProgressBar(int i, int j) { 56 | 57 | if (i == 0) { 58 | gridPower = j; 59 | } 60 | if (i == 1) { 61 | relayPower = j; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/container/ContainerAttachmentBase.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.container; 2 | 3 | import cofh.thermaldynamics.duct.Attachment; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.entity.player.InventoryPlayer; 6 | import net.minecraft.inventory.IContainerListener; 7 | 8 | public class ContainerAttachmentBase extends ContainerTDBase { 9 | 10 | Attachment baseTile; 11 | 12 | public ContainerAttachmentBase() { 13 | 14 | } 15 | 16 | public ContainerAttachmentBase(Attachment tile) { 17 | 18 | baseTile = tile; 19 | } 20 | 21 | public ContainerAttachmentBase(InventoryPlayer inventory, Attachment tile) { 22 | 23 | baseTile = tile; 24 | 25 | /* Player Inventory */ 26 | addPlayerInventory(inventory); 27 | } 28 | 29 | @Override 30 | public boolean canInteractWith(EntityPlayer player) { 31 | 32 | return baseTile == null || baseTile.isUseable(player); 33 | } 34 | 35 | @Override 36 | public void detectAndSendChanges() { 37 | 38 | super.detectAndSendChanges(); 39 | 40 | if (baseTile == null) { 41 | return; 42 | } 43 | baseTile.sendGuiNetworkData(this, listeners, false); 44 | } 45 | 46 | @Override 47 | public void addListener(IContainerListener listener) { 48 | 49 | super.addListener(listener); 50 | baseTile.sendGuiNetworkData(this, listeners, true); 51 | } 52 | 53 | @Override 54 | public void updateProgressBar(int i, int j) { 55 | 56 | if (baseTile == null) { 57 | return; 58 | } 59 | baseTile.receiveGuiNetworkData(i, j); 60 | } 61 | 62 | @Override 63 | public int numTileSlots() { 64 | 65 | return baseTile == null ? 0 : baseTile.getInvSlotCount(); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/resources/assets/thermaldynamics/blockstates/attachment.json: -------------------------------------------------------------------------------- 1 | { 2 | "forge_marker": 1, 3 | "defaults": { 4 | "model": "builtin/generated", 5 | "textures": { 6 | "layer0": "blocks/dirt" 7 | }, 8 | "transform": "forge:default-item" 9 | }, 10 | "variants": { 11 | "type": { 12 | "relay": {"textures":{"layer0":"thermaldynamics:items/relay"}}, 13 | "filter_basic": {"textures":{"layer0":"thermaldynamics:items/filter_0"}}, 14 | "filter_hardened": {"textures":{"layer0":"thermaldynamics:items/filter_1"}}, 15 | "filter_reinforced": {"textures":{"layer0":"thermaldynamics:items/filter_2"}}, 16 | "filter_signalum": {"textures":{"layer0":"thermaldynamics:items/filter_3"}}, 17 | "filter_resonant": {"textures":{"layer0":"thermaldynamics:items/filter_4"}}, 18 | "retriever_basic": {"textures":{"layer0":"thermaldynamics:items/retriever_0"}}, 19 | "retriever_hardened": {"textures":{"layer0":"thermaldynamics:items/retriever_1"}}, 20 | "retriever_reinforced": {"textures":{"layer0":"thermaldynamics:items/retriever_2"}}, 21 | "retriever_signalum": {"textures":{"layer0":"thermaldynamics:items/retriever_3"}}, 22 | "retriever_resonant": {"textures":{"layer0":"thermaldynamics:items/retriever_4"}}, 23 | "servo_basic": {"textures":{"layer0":"thermaldynamics:items/servo_0"}}, 24 | "servo_hardened": {"textures":{"layer0":"thermaldynamics:items/servo_1"}}, 25 | "servo_reinforced": {"textures":{"layer0":"thermaldynamics:items/servo_2"}}, 26 | "servo_signalum": {"textures":{"layer0":"thermaldynamics:items/servo_3"}}, 27 | "servo_resonant": {"textures":{"layer0":"thermaldynamics:items/servo_4"}} 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/render/RenderDuctFluids.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.render; 2 | 3 | import codechicken.lib.render.CCRenderState; 4 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluid; 5 | import cofh.thermaldynamics.duct.tiles.DuctToken; 6 | import cofh.thermaldynamics.duct.tiles.TileDuctFluid; 7 | import net.minecraft.client.renderer.GlStateManager; 8 | import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; 9 | import org.apache.commons.lang3.Validate; 10 | import org.lwjgl.opengl.GL11; 11 | 12 | public class RenderDuctFluids extends TileEntitySpecialRenderer { 13 | 14 | public static final RenderDuctFluids instance = new RenderDuctFluids(); 15 | 16 | @Override 17 | public void renderTileEntityAt(TileDuctFluid duct, double x, double y, double z, float frame, int destroyStage) { 18 | 19 | DuctUnitFluid fluid = Validate.notNull(duct.getDuct(DuctToken.FLUID)); 20 | 21 | renderFluids(fluid, x, y, z); 22 | 23 | } 24 | 25 | public void renderFluids(DuctUnitFluid fluid, double x, double y, double z) { 26 | 27 | int[] connections = fluid.getRenderFluidConnections(); 28 | CCRenderState ccrs = CCRenderState.instance(); 29 | ccrs.preRenderWorld(fluid.parent.getWorld(), fluid.parent.getPos()); 30 | 31 | GlStateManager.pushMatrix(); 32 | 33 | GlStateManager.enableBlend(); 34 | GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); 35 | GlStateManager.disableLighting(); 36 | 37 | RenderDuct.instance.renderFluid(ccrs, fluid.myRenderFluid, connections, fluid.getRenderFluidLevel(), x, y, z); 38 | 39 | GlStateManager.enableLighting(); 40 | GlStateManager.disableBlend(); 41 | 42 | GlStateManager.popMatrix(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/client/GuiTransportConfig.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.client; 2 | 3 | import cofh.core.gui.GuiCore; 4 | import cofh.lib.gui.element.ElementTextField; 5 | import cofh.thermaldynamics.duct.entity.DuctUnitTransport; 6 | import cofh.thermaldynamics.gui.container.ContainerTransportConfig; 7 | import net.minecraft.entity.player.InventoryPlayer; 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | public class GuiTransportConfig extends GuiCore { 11 | 12 | static final String TEX_PATH = "thermaldynamics:textures/gui/transport_config.png"; 13 | static final ResourceLocation TEXTURE = new ResourceLocation(TEX_PATH); 14 | private final InventoryPlayer inventory; 15 | private final DuctUnitTransport transportDuct; 16 | 17 | public GuiTransportConfig(InventoryPlayer inventory, DuctUnitTransport transportDuct) { 18 | 19 | super(new ContainerTransportConfig(inventory, transportDuct), TEXTURE); 20 | this.inventory = inventory; 21 | this.transportDuct = transportDuct; 22 | 23 | this.ySize = 134; 24 | } 25 | 26 | @Override 27 | public void initGui() { 28 | 29 | super.initGui(); 30 | 31 | final boolean drawBack = inventory != null; 32 | 33 | addElement(new ElementTextField(this, 32, 18, 135, 10) { 34 | 35 | @Override 36 | protected void onCharacterEntered(boolean success) { 37 | 38 | super.onCharacterEntered(success); 39 | transportDuct.setName(this.getText()); 40 | } 41 | 42 | @Override 43 | public void drawBackground(int mouseX, int mouseY, float gameTicks) { 44 | 45 | if (drawBack) { 46 | super.drawBackground(mouseX, mouseY, gameTicks); 47 | } 48 | } 49 | }.setText(transportDuct.data.name).setBackgroundColor(0, 0, 0)); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/plugins/jei/JEIPluginTD.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.plugins.jei; 2 | 3 | import cofh.thermaldynamics.duct.attachments.cover.CoverHelper; 4 | import cofh.thermaldynamics.init.TDItems; 5 | import cofh.thermaldynamics.init.TDProps; 6 | import cofh.thermaldynamics.item.ItemCover; 7 | import mezz.jei.api.BlankModPlugin; 8 | import mezz.jei.api.IModRegistry; 9 | import mezz.jei.api.ISubtypeRegistry; 10 | import mezz.jei.api.JEIPlugin; 11 | import mezz.jei.api.ingredients.IIngredientBlacklist; 12 | import net.minecraft.init.Blocks; 13 | import net.minecraft.item.Item; 14 | import net.minecraft.item.ItemStack; 15 | 16 | @JEIPlugin 17 | public class JEIPluginTD extends BlankModPlugin { 18 | 19 | @Override 20 | public void register(IModRegistry registry) { 21 | 22 | CoverRecipeCategory.initialize(registry); 23 | if (!TDProps.showCoversInJEI) { 24 | blacklistCovers(registry.getJeiHelpers().getIngredientBlacklist()); 25 | } 26 | } 27 | 28 | @Override 29 | public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) { 30 | 31 | subtypeRegistry.registerSubtypeInterpreter(TDItems.itemCover, (itemStack -> { 32 | ItemStack block = CoverHelper.getCoverItemStack(itemStack, false); 33 | return "thermaldynamics:cover" + "|" + block.getItem().getRegistryName() + "@" + block.getMetadata(); 34 | })); 35 | } 36 | 37 | private static void blacklistCovers(IIngredientBlacklist ingredientBlacklist) { 38 | 39 | for (ItemStack stack : ItemCover.getCoverList()) { 40 | ItemStack coverBlock = CoverHelper.getCoverItemStack(stack, false); 41 | if (coverBlock.getItem() == Item.getItemFromBlock(Blocks.STONE) && coverBlock.getMetadata() == 0) { 42 | continue; 43 | } 44 | ingredientBlacklist.addIngredientToBlacklist(stack); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/Tracker.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Tracker { 6 | 7 | private final static byte MEMORY = 101; 8 | private final static double AVG_MULTIPLIER = 1 / (MEMORY - 1.0); 9 | 10 | public final static short LIFESPAN = 3600; 11 | 12 | byte i = 0; 13 | 14 | short life = 0; 15 | 16 | final int[] mem = new int[MEMORY]; 17 | final long[] memIn = new long[MEMORY]; 18 | final long[] memOut = new long[MEMORY]; 19 | 20 | public Tracker(int n) { 21 | 22 | Arrays.fill(mem, n); 23 | } 24 | 25 | public void newTick(int n) { 26 | 27 | i++; 28 | life++; 29 | if (i >= MEMORY) { 30 | i = 0; 31 | } 32 | 33 | mem[i] = n; 34 | memIn[i] = 0; 35 | memOut[i] = 0; 36 | } 37 | 38 | public void stuffIn(int n) { 39 | 40 | memIn[i] += n; 41 | } 42 | 43 | public void stuffOut(int n) { 44 | 45 | memOut[i] += n; 46 | } 47 | 48 | public double avgStuff() { 49 | 50 | double v = 0; 51 | for (int j = 0; j < mem.length; j++) { 52 | if (i == j) { 53 | continue; 54 | } 55 | int m = mem[j]; 56 | v += m; 57 | } 58 | return v * AVG_MULTIPLIER; 59 | } 60 | 61 | public double avgStuffIn() { 62 | 63 | return getUnsignedLongAverage(memIn); 64 | } 65 | 66 | public double avgStuffOut() { 67 | 68 | return getUnsignedLongAverage(memOut); 69 | } 70 | 71 | public double getUnsignedLongAverage(long[] arr) { 72 | 73 | double v = 0; 74 | for (int j = 0; j < arr.length; j++) { 75 | if (j == i) { 76 | continue; 77 | } 78 | long m = arr[j]; 79 | if (m < 0) { 80 | double dValue = m & 0x7fffffffffffffffL; 81 | dValue += 0x1.0p63; 82 | v += dValue; 83 | } else { 84 | v += m; 85 | } 86 | 87 | } 88 | return v * AVG_MULTIPLIER; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/NoComodSet.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import java.util.AbstractSet; 4 | import java.util.Iterator; 5 | import java.util.LinkedHashSet; 6 | import java.util.Set; 7 | 8 | public class NoComodSet extends AbstractSet { 9 | 10 | public final Set set; 11 | 12 | int modCount = 0; 13 | 14 | public NoComodSet() { 15 | 16 | this(new LinkedHashSet<>()); 17 | } 18 | 19 | public NoComodSet(Set set) { 20 | 21 | this.set = set; 22 | } 23 | 24 | @Override 25 | public boolean add(E aMultiBlock) { 26 | 27 | updateModCount(); 28 | return set.add(aMultiBlock); 29 | } 30 | 31 | public void updateModCount() { 32 | 33 | modCount++; 34 | } 35 | 36 | @Override 37 | public void clear() { 38 | 39 | updateModCount(); 40 | set.clear(); 41 | } 42 | 43 | @Override 44 | public boolean contains(Object o) { 45 | 46 | return set.contains(o); 47 | } 48 | 49 | @Override 50 | public boolean remove(Object o) { 51 | 52 | updateModCount(); 53 | return set.remove(o); 54 | } 55 | 56 | @Override 57 | public Iterator iterator() { 58 | 59 | return new NoComodIterator(set.iterator()); 60 | } 61 | 62 | @Override 63 | public int size() { 64 | 65 | return set.size(); 66 | } 67 | 68 | public class NoComodIterator implements Iterator { 69 | 70 | private final Iterator iterator; 71 | int expectedModCount; 72 | 73 | public NoComodIterator(Iterator iterator) { 74 | 75 | this.iterator = iterator; 76 | expectedModCount = modCount; 77 | } 78 | 79 | @Override 80 | public boolean hasNext() { 81 | 82 | return expectedModCount == modCount && iterator.hasNext(); 83 | } 84 | 85 | @Override 86 | public E next() { 87 | 88 | return iterator.next(); 89 | } 90 | 91 | @Override 92 | public void remove() { 93 | 94 | iterator.remove(); 95 | } 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/AttachmentRegistry.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | import cofh.thermaldynamics.duct.attachments.cover.Cover; 4 | import cofh.thermaldynamics.duct.attachments.filter.FilterFluid; 5 | import cofh.thermaldynamics.duct.attachments.filter.FilterItem; 6 | import cofh.thermaldynamics.duct.attachments.relay.Relay; 7 | import cofh.thermaldynamics.duct.attachments.retriever.RetrieverFluid; 8 | import cofh.thermaldynamics.duct.attachments.retriever.RetrieverItem; 9 | import cofh.thermaldynamics.duct.attachments.servo.ServoFluid; 10 | import cofh.thermaldynamics.duct.attachments.servo.ServoItem; 11 | import cofh.thermaldynamics.duct.tiles.TileGrid; 12 | 13 | public class AttachmentRegistry { 14 | 15 | public final static byte FACADE = 0; 16 | public final static byte SERVO_FLUID = 1; 17 | public final static byte SERVO_ITEM = 2; 18 | public final static byte FILTER_FLUID = 3; 19 | public final static byte FILTER_ITEM = 4; 20 | public final static byte RETRIEVER_FLUID = 5; 21 | public final static byte RETRIEVER_ITEM = 6; 22 | public final static byte RELAY = 7; 23 | 24 | public static Attachment createAttachment(TileGrid tile, byte side, int id) { 25 | 26 | if (id == FACADE) { 27 | return new Cover(tile, side); 28 | } else if (id == SERVO_FLUID) { 29 | return new ServoFluid(tile, side); 30 | } else if (id == SERVO_ITEM) { 31 | return new ServoItem(tile, side); 32 | } else if (id == FILTER_FLUID) { 33 | return new FilterFluid(tile, side); 34 | } else if (id == FILTER_ITEM) { 35 | return new FilterItem(tile, side); 36 | } else if (id == RETRIEVER_FLUID) { 37 | return new RetrieverFluid(tile, side); 38 | } else if (id == RETRIEVER_ITEM) { 39 | return new RetrieverItem(tile, side); 40 | } else if (id == RELAY) { 41 | return new Relay(tile, side); 42 | } 43 | throw new RuntimeException("Illegal Attachment ID"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/GuiConfigTD.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui; 2 | 3 | import cofh.thermaldynamics.ThermalDynamics; 4 | import net.minecraft.client.gui.GuiScreen; 5 | import net.minecraftforge.common.config.ConfigElement; 6 | import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement; 7 | import net.minecraftforge.fml.client.config.GuiConfig; 8 | import net.minecraftforge.fml.client.config.IConfigElement; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class GuiConfigTD extends GuiConfig { 14 | 15 | public GuiConfigTD(GuiScreen parentScreen) { 16 | 17 | super(parentScreen, getConfigElements(parentScreen), ThermalDynamics.MOD_ID, false, false, ThermalDynamics.MOD_NAME); 18 | } 19 | 20 | public static final String[] CATEGORIES_CLIENT = { "Duct" }; 21 | public static final String[] CATEGORIES_COMMON = { "Duct" }; 22 | 23 | private static List getConfigElements(GuiScreen parent) { 24 | 25 | List list = new ArrayList<>(); 26 | 27 | list.add(new DummyCategoryElement("Client", "config.Client", getClientConfigElements())); 28 | list.add(new DummyCategoryElement("Common", "config.Common", getCommonConfigElements())); 29 | 30 | return list; 31 | } 32 | 33 | private static List getClientConfigElements() { 34 | 35 | List list = new ArrayList<>(); 36 | 37 | for (int i = 0; i < CATEGORIES_CLIENT.length; i++) { 38 | list.add(new ConfigElement(ThermalDynamics.CONFIG_CLIENT.getCategory(CATEGORIES_CLIENT[i]))); 39 | } 40 | return list; 41 | } 42 | 43 | private static List getCommonConfigElements() { 44 | 45 | List list = new ArrayList<>(); 46 | 47 | for (int i = 0; i < CATEGORIES_COMMON.length; i++) { 48 | list.add(new ConfigElement(ThermalDynamics.CONFIG.getCategory(CATEGORIES_COMMON[i]))); 49 | } 50 | return list; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileDuctOmni.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.api.energy.IEnergyReceiver; 4 | import cofh.thermaldynamics.block.BlockDuct; 5 | import cofh.thermaldynamics.duct.DuctItem; 6 | import cofh.thermaldynamics.duct.TDDucts; 7 | import cofh.thermaldynamics.duct.energy.DuctUnitEnergy; 8 | import cofh.thermaldynamics.duct.energy.GridEnergy; 9 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluidOmni; 10 | import cofh.thermaldynamics.duct.item.DuctUnitItem; 11 | 12 | import javax.annotation.Nonnull; 13 | 14 | public class TileDuctOmni extends TileGridStructureBase implements IEnergyReceiver { 15 | 16 | public TileDuctOmni(DuctItem ductType) { 17 | 18 | super(); 19 | DuctUnitEnergy energy = new DuctUnitEnergy(this, ductType, 1000, 1000) { 20 | @Override 21 | public boolean canConnectToOtherDuct(DuctUnit adjDuct, byte side, byte oppositeSide) { 22 | 23 | return super.canConnectToOtherDuct(adjDuct, side, oppositeSide) && (adjDuct.getDuctType() == TDDucts.itemOmni || adjDuct.getDuctType() == TDDucts.itemOmniOpaque); 24 | } 25 | 26 | @Nonnull 27 | @Override 28 | protected BlockDuct.ConnectionType getConnectionTypeDuct(DuctUnitEnergy duct, int side) { 29 | 30 | return BlockDuct.ConnectionType.CLEAN_DUCT; 31 | } 32 | }; 33 | addDuctUnits(DuctToken.ENERGY, energy); 34 | addDuctUnits(DuctToken.ITEMS, new DuctUnitItem(this, ductType)); 35 | addDuctUnits(DuctToken.FLUID, new DuctUnitFluidOmni(this, ductType)); 36 | } 37 | 38 | @Override 39 | protected DuctToken getPrimaryDuctToken() { 40 | 41 | return DuctToken.ITEMS; 42 | } 43 | 44 | public static class Transparent extends TileDuctOmni { 45 | 46 | public Transparent() { 47 | 48 | super(TDDucts.itemOmni); 49 | } 50 | } 51 | 52 | public static class Opaque extends TileDuctOmni { 53 | 54 | public Opaque() { 55 | 56 | super(TDDucts.itemOmniOpaque); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/fluid/FluidTankGrid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.fluid; 2 | 3 | import cofh.core.fluid.FluidTankCore; 4 | import cofh.lib.util.helpers.MathHelper; 5 | import gnu.trove.map.hash.TObjectIntHashMap; 6 | import net.minecraftforge.fluids.FluidStack; 7 | 8 | public class FluidTankGrid extends FluidTankCore { 9 | 10 | public int fluidThroughput = 120; 11 | public int fluidPerDuct = 3000; 12 | public GridFluid myMaster; 13 | static TObjectIntHashMap fluidFlowrate = new TObjectIntHashMap<>(); 14 | 15 | static { 16 | fluidFlowrate.put("steam", 600); 17 | } 18 | 19 | public FluidTankGrid(int capacity, GridFluid theGrid) { 20 | 21 | super(capacity); 22 | myMaster = theGrid; 23 | } 24 | 25 | @Override 26 | public void setFluid(FluidStack fluid) { 27 | 28 | if (fluid != null) { 29 | setFluidData(fluid); 30 | } 31 | super.setFluid(fluid); 32 | } 33 | 34 | @Override 35 | public int fill(FluidStack resource, boolean doFill) { 36 | 37 | if (fluid == null && resource != null) { 38 | setFluidData(resource); 39 | } 40 | return myMaster.trackIn(super.fill(resource, doFill), !doFill); 41 | } 42 | 43 | @Override 44 | public FluidStack drain(int maxDrain, boolean doDrain) { 45 | 46 | FluidStack drain = super.drain(maxDrain, doDrain); 47 | if (doDrain && drain != null) { 48 | myMaster.trackOut(drain.amount, false); 49 | } 50 | return drain; 51 | } 52 | 53 | public void setFluidData(FluidStack fluid) { 54 | 55 | int viscosity; 56 | 57 | if (fluid != null) { 58 | viscosity = Math.max(fluid.getFluid().getViscosity(), 100); 59 | fluidThroughput = MathHelper.clamp(120000 / viscosity, 80, 600); 60 | 61 | if (fluidFlowrate.containsKey(fluid.getFluid().getName())) { 62 | fluidThroughput = fluidFlowrate.get(fluid.getFluid().getName()); 63 | } 64 | fluidThroughput *= myMaster.getThroughPutModifier(); 65 | fluidPerDuct = Math.min(25 * fluidThroughput, myMaster.getMaxFluidPerDuct()); 66 | } 67 | myMaster.fluidChanged(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/MultiBlockFormer.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import cofh.thermaldynamics.duct.tiles.DuctUnit; 4 | import net.minecraft.util.EnumFacing; 5 | 6 | import java.util.LinkedList; 7 | import java.util.Queue; 8 | 9 | public class MultiBlockFormer, G extends MultiBlockGrid, C> { 10 | 11 | Queue blocksToCheck = new LinkedList<>(); 12 | G theGrid; 13 | 14 | public void formGrid(T theMultiBlock) { 15 | 16 | theGrid = theMultiBlock.createGrid(); 17 | theMultiBlock.setGrid(theGrid); 18 | theGrid.addBlock(theMultiBlock); 19 | 20 | blocksToCheck.add(theMultiBlock); 21 | 22 | while (!blocksToCheck.isEmpty()) { 23 | checkMultiBlock(blocksToCheck.remove()); 24 | } 25 | theGrid.resetMultiBlocks(); 26 | } 27 | 28 | private void checkMultiBlock(T currentMultiBlock) { 29 | 30 | if (!currentMultiBlock.isValidForForming()) { 31 | return; 32 | } 33 | currentMultiBlock.onNeighborBlockChange(); 34 | currentMultiBlock.setInvalidForForming(); 35 | 36 | T aBlock; 37 | for (byte i = 0; i < EnumFacing.VALUES.length; i++) { 38 | if (currentMultiBlock.isSideConnected(i)) { 39 | aBlock = currentMultiBlock.getConnectedSide(i); 40 | if (aBlock != null && aBlock.isValidForForming() && aBlock.getConnectedSide(i ^ 1) == currentMultiBlock) { 41 | if (aBlock.getGrid() == null && theGrid.canAddBlock(aBlock)) { 42 | aBlock.setGrid(theGrid); 43 | theGrid.addBlock(aBlock); 44 | blocksToCheck.add(aBlock); 45 | } else if (theGrid.canAddBlock(aBlock) && aBlock.getGrid() != null && theGrid.canGridsMerge(aBlock.getGrid())) { 46 | if (theGrid != aBlock.getGrid()) { 47 | if (theGrid.size() >= aBlock.getGrid().size()) { 48 | theGrid.mergeGrids(aBlock.getGrid()); 49 | } else { 50 | aBlock.getGrid().mergeGrids(theGrid); 51 | theGrid = aBlock.getGrid(); 52 | } 53 | } 54 | } else { 55 | currentMultiBlock.onConnectionRejected(i); 56 | aBlock.onConnectionRejected(i ^ 1); 57 | } 58 | } 59 | } 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/util/TickHandlerClient.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.util; 2 | 3 | import cofh.thermaldynamics.duct.item.DuctUnitItem; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.gui.GuiMainMenu; 6 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 7 | import net.minecraftforge.fml.common.gameevent.TickEvent; 8 | import net.minecraftforge.fml.relauncher.Side; 9 | import net.minecraftforge.fml.relauncher.SideOnly; 10 | 11 | import java.util.HashSet; 12 | import java.util.Iterator; 13 | 14 | public class TickHandlerClient { 15 | 16 | public static final TickHandlerClient INSTANCE = new TickHandlerClient(); 17 | public static HashSet tickBlocks = new HashSet<>(); 18 | public static HashSet tickBlocksToAdd = new HashSet<>(); 19 | public static HashSet tickBlocksToRemove = new HashSet<>(); 20 | 21 | boolean needsMenu = false; 22 | 23 | @SubscribeEvent 24 | @SideOnly (Side.CLIENT) 25 | public void tick(TickEvent.ClientTickEvent event) { 26 | 27 | Minecraft mc = Minecraft.getMinecraft(); 28 | 29 | if (event.phase == TickEvent.Phase.END) { 30 | if (mc.currentScreen instanceof GuiMainMenu) { 31 | if (needsMenu) { 32 | onMainMenu(); 33 | needsMenu = false; 34 | } 35 | } else if (mc.inGameHasFocus) { 36 | needsMenu = true; 37 | } 38 | if (!tickBlocksToAdd.isEmpty()) { 39 | tickBlocks.addAll(tickBlocksToAdd); 40 | tickBlocksToAdd.clear(); 41 | } 42 | if (!mc.isGamePaused() && !tickBlocks.isEmpty()) { 43 | for (Iterator iterator = tickBlocks.iterator(); iterator.hasNext(); ) { 44 | DuctUnitItem aCond = iterator.next(); 45 | if (aCond.isOutdated()) { 46 | iterator.remove(); 47 | } else { 48 | aCond.tickItemsClient(); 49 | } 50 | } 51 | tickBlocks.removeAll(tickBlocksToRemove); 52 | tickBlocksToRemove.clear(); 53 | } 54 | } 55 | } 56 | 57 | public void onMainMenu() { 58 | 59 | synchronized (TickHandler.HANDLERS) { 60 | TickHandler.HANDLERS.clear(); 61 | } 62 | tickBlocks.clear(); 63 | tickBlocksToAdd.clear(); 64 | tickBlocksToRemove.clear(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/item/ItemRelay.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.item; 2 | 3 | import cofh.lib.util.helpers.StringHelper; 4 | import cofh.thermaldynamics.ThermalDynamics; 5 | import cofh.thermaldynamics.duct.Attachment; 6 | import cofh.thermaldynamics.duct.attachments.relay.Relay; 7 | import cofh.thermaldynamics.duct.tiles.TileGrid; 8 | import net.minecraft.client.renderer.block.model.ModelResourceLocation; 9 | import net.minecraft.creativetab.CreativeTabs; 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.item.Item; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraft.util.EnumFacing; 14 | import net.minecraftforge.client.model.ModelLoader; 15 | import net.minecraftforge.fml.common.registry.GameRegistry; 16 | 17 | import java.util.List; 18 | 19 | public class ItemRelay extends ItemAttachment { 20 | 21 | public ItemRelay() { 22 | 23 | super(); 24 | this.setUnlocalizedName("thermaldynamics.relay"); 25 | } 26 | 27 | @Override 28 | public void getSubItems(Item item, CreativeTabs tab, List list) { 29 | 30 | } 31 | 32 | @Override 33 | public Attachment getAttachment(EnumFacing side, ItemStack stack, TileGrid tile) { 34 | 35 | return new Relay(tile, (byte) (side.ordinal() ^ 1)); 36 | } 37 | 38 | @Override 39 | public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean extraInfo) { 40 | 41 | super.addInformation(stack, player, list, extraInfo); 42 | list.add(StringHelper.getInfoText("item.thermaldynamics.relay.info")); 43 | list.add(StringHelper.getNoticeText("info.thermaldynamics.toggle")); 44 | } 45 | 46 | /* IInitializer */ 47 | @Override 48 | public boolean preInit() { 49 | 50 | GameRegistry.register(this.setRegistryName("relay")); 51 | 52 | ThermalDynamics.proxy.addIModelRegister(this); 53 | 54 | return true; 55 | } 56 | 57 | @Override 58 | public boolean initialize() { 59 | 60 | return true; 61 | } 62 | 63 | @Override 64 | public void registerModels() { 65 | 66 | ModelResourceLocation location = new ModelResourceLocation("thermaldynamics:attachment", "type=relay"); 67 | ModelLoader.setCustomModelResourceLocation(this, 0, location); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/util/RecipeCover.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.util; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import cofh.thermaldynamics.duct.TDDucts; 5 | import cofh.thermaldynamics.duct.attachments.cover.CoverHelper; 6 | import cofh.thermaldynamics.init.TDItems; 7 | import net.minecraft.inventory.InventoryCrafting; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.item.crafting.IRecipe; 10 | import net.minecraft.world.World; 11 | import net.minecraftforge.common.ForgeHooks; 12 | 13 | import javax.annotation.Nonnull; 14 | 15 | public class RecipeCover implements IRecipe { 16 | 17 | public static final RecipeCover INSTANCE = new RecipeCover(); 18 | 19 | @Override 20 | public boolean matches(InventoryCrafting craft, World world) { 21 | 22 | boolean a = false; 23 | boolean b = false; 24 | 25 | for (int i = 0; i < craft.getSizeInventory(); i++) { 26 | ItemStack stack = craft.getStackInSlot(i); 27 | if (stack == null) { 28 | continue; 29 | } 30 | if (ItemHelper.itemsEqualForCrafting(stack, TDDucts.structure.itemStack)) { 31 | if (a) { 32 | return false; 33 | } else { 34 | a = true; 35 | } 36 | } else { 37 | if (!CoverHelper.isValid(stack)) { 38 | return false; 39 | } 40 | if (b) { 41 | return false; 42 | } else { 43 | b = true; 44 | } 45 | } 46 | } 47 | return a && b; 48 | } 49 | 50 | @Override 51 | public ItemStack getCraftingResult(InventoryCrafting craft) { 52 | 53 | for (int i = 0; i < craft.getSizeInventory(); i++) { 54 | ItemStack stack = craft.getStackInSlot(i); 55 | if (stack == null) { 56 | continue; 57 | } 58 | if (!ItemHelper.itemsEqualForCrafting(stack, TDDucts.structure.itemStack)) { 59 | 60 | return ItemHelper.cloneStack(CoverHelper.getCoverStack(stack), 6); 61 | } 62 | } 63 | return null; 64 | } 65 | 66 | @Override 67 | public int getRecipeSize() { 68 | 69 | return 2; 70 | } 71 | 72 | @Override 73 | public ItemStack getRecipeOutput() { 74 | 75 | return new ItemStack(TDItems.itemCover, 6); 76 | } 77 | 78 | @Override 79 | public ItemStack[] getRemainingItems(@Nonnull InventoryCrafting inv) { 80 | 81 | return ForgeHooks.defaultRecipeGetRemainingItems(inv); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/light/PacketLight.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.light; 2 | 3 | import cofh.core.network.PacketCoFHBase; 4 | import cofh.thermaldynamics.duct.tiles.DuctToken; 5 | import cofh.thermaldynamics.duct.tiles.IDuctHolder; 6 | import cofh.thermaldynamics.multiblock.IGridTile; 7 | import com.google.common.collect.Iterables; 8 | import io.netty.buffer.ByteBuf; 9 | import io.netty.channel.ChannelHandlerContext; 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.tileentity.TileEntity; 12 | import net.minecraft.util.math.BlockPos; 13 | import net.minecraft.world.World; 14 | 15 | import java.io.ByteArrayInputStream; 16 | import java.io.DataInputStream; 17 | import java.io.IOException; 18 | 19 | public class PacketLight extends PacketCoFHBase { 20 | 21 | public ByteArrayInputStream stream; 22 | 23 | public PacketLight() { 24 | 25 | super(); 26 | } 27 | 28 | public PacketLight(boolean lit, GridLight grid) { 29 | 30 | addBool(lit); 31 | 32 | addVarInt(grid.idleSet.size() + grid.nodeSet.size()); 33 | 34 | for (IGridTile iGridTile : Iterables.concat(grid.nodeSet, grid.idleSet)) { 35 | addVarInt(iGridTile.x()); 36 | addVarInt(iGridTile.y()); 37 | addVarInt(iGridTile.z()); 38 | } 39 | } 40 | 41 | @Override 42 | public void handlePacket(EntityPlayer player, boolean isServer) { 43 | 44 | boolean lit = getBool(); 45 | 46 | int n = getVarInt(); 47 | World world = player.worldObj; 48 | for (int i = 0; i < n; i++) { 49 | int x = getVarInt(); 50 | int y = getVarInt(); 51 | int z = getVarInt(); 52 | BlockPos pos = new BlockPos(x, y, z); 53 | if (!world.isBlockLoaded(pos)) { 54 | continue; 55 | } 56 | 57 | TileEntity tile = world.getTileEntity(pos); 58 | if (tile instanceof IDuctHolder) { 59 | DuctUnitLight lamp = ((IDuctHolder) tile).getDuct(DuctToken.LIGHT); 60 | 61 | if (lamp != null) { 62 | lamp.lit = lit; 63 | lamp.checkLight(); 64 | } 65 | } 66 | } 67 | } 68 | 69 | @Override 70 | public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { 71 | 72 | datain = new DataInputStream(stream = new ByteArrayInputStream(buffer.array())); 73 | try { 74 | datain.skipBytes(1); 75 | } catch (IOException e) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/energy/GridEnergySuper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.energy; 2 | 3 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 4 | import net.minecraft.world.World; 5 | 6 | public class GridEnergySuper extends GridEnergy { 7 | 8 | int nodeTracker; 9 | boolean isSendingEnergy; 10 | 11 | DuctUnitEnergy[] nodeList = null; 12 | 13 | public GridEnergySuper(World world, int transferLimit, int capacity) { 14 | 15 | super(world, transferLimit, capacity); 16 | myStorage.setMaxExtract(myStorage.getMaxEnergyStored()); 17 | } 18 | 19 | @Override 20 | public void tickGrid() { 21 | 22 | super.tickGrid(); 23 | int i = 0; 24 | if (nodeList == null) { 25 | nodeList = new DuctUnitEnergy[nodeSet.size()]; 26 | for (DuctUnitEnergy multiBlock : nodeSet) { 27 | nodeList[i] = multiBlock; 28 | i++; 29 | } 30 | } 31 | } 32 | 33 | @Override 34 | public int receiveEnergy(int energy, boolean simulate) { 35 | 36 | if (isSendingEnergy) { 37 | return 0; 38 | } 39 | int tempTracker = nodeTracker; 40 | 41 | DuctUnitEnergy[] list = nodeList; 42 | 43 | if (list == null || list.length == 0) { 44 | return 0; 45 | } 46 | 47 | int startAmount = energy; 48 | isSendingEnergy = true; 49 | for (int i = nodeTracker; i < list.length && energy > 0; i++) { 50 | energy -= trackInOut(list[i].transmitEnergy(energy, simulate), simulate); 51 | if (energy == 0) { 52 | nodeTracker = i + 1; 53 | } 54 | } 55 | for (int i = 0; i < list.length && i < nodeTracker && energy > 0; i++) { 56 | energy -= trackInOut(list[i].transmitEnergy(energy, simulate), simulate); 57 | if (energy == 0) { 58 | nodeTracker = i + 1; 59 | } 60 | } 61 | if (energy > 0) { 62 | nodeTracker++; 63 | } 64 | if (nodeTracker >= list.length) { 65 | nodeTracker = 0; 66 | } 67 | if (simulate) { 68 | nodeTracker = tempTracker; 69 | } 70 | isSendingEnergy = false; 71 | return startAmount - energy; 72 | } 73 | 74 | @Override 75 | public void onMajorGridChange() { 76 | 77 | super.onMajorGridChange(); 78 | nodeList = null; 79 | } 80 | 81 | @Override 82 | public boolean canGridsMerge(MultiBlockGrid grid) { 83 | 84 | return grid instanceof GridEnergySuper; 85 | } 86 | 87 | @Override 88 | public void destroy() { 89 | 90 | nodeList = null; 91 | super.destroy(); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/container/ContainerTransportConfig.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.container; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import cofh.thermaldynamics.duct.entity.DuctUnitTransport; 5 | import cofh.thermaldynamics.gui.slot.SlotIcon; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.entity.player.InventoryPlayer; 8 | import net.minecraft.inventory.Slot; 9 | import net.minecraft.item.ItemStack; 10 | 11 | public class ContainerTransportConfig extends ContainerTDBase { 12 | 13 | public ContainerTransportConfig(InventoryPlayer inventory, DuctUnitTransport transportDuct) { 14 | 15 | addPlayerInventory(inventory); 16 | 17 | addSlotToContainer(new SlotIcon(8, 15, transportDuct)); 18 | } 19 | 20 | @Override 21 | protected void addPlayerInventory(InventoryPlayer inventory) { 22 | 23 | for (int i = 0; i < 3; i++) { 24 | for (int j = 0; j < 9; j++) { 25 | addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 53 + i * 18)); 26 | } 27 | } 28 | for (int i = 0; i < 9; i++) { 29 | addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 111)); 30 | } 31 | } 32 | 33 | @Override 34 | public boolean canInteractWith(EntityPlayer p_75145_1_) { 35 | 36 | return true; 37 | } 38 | 39 | @Override 40 | public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { 41 | 42 | Slot slot = inventorySlots.get(slotIndex); 43 | 44 | int invPlayer = 27; 45 | int invFull = invPlayer + 9; 46 | int invTile = invFull + 1; 47 | 48 | if (slot != null && slot.getHasStack()) { 49 | ItemStack stack = slot.getStack(); 50 | if (slotIndex < 0) { 51 | return null; 52 | } else if (slotIndex < invFull) { 53 | Slot k = null; 54 | for (int i = invFull; i < invTile; i++) { 55 | Slot slot1 = inventorySlots.get(i); 56 | if (!slot1.getHasStack()) { 57 | if (k == null) { 58 | k = slot1; 59 | } 60 | } else { 61 | if (ItemHelper.itemsEqualWithMetadata(slot1.getStack(), stack)) { 62 | return null; 63 | } 64 | } 65 | } 66 | if (k != null) { 67 | k.putStack(stack.copy()); 68 | } 69 | 70 | return null; 71 | } else { 72 | slot.putStack(null); 73 | slot.onSlotChanged(); 74 | } 75 | } 76 | return null; 77 | } 78 | 79 | @Override 80 | protected int numTileSlots() { 81 | 82 | return 1; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/CreativeTabTD.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui; 2 | 3 | import cofh.CoFHCore; 4 | import cofh.core.util.CoreUtils; 5 | import cofh.lib.util.TimeTracker; 6 | import cofh.lib.util.helpers.MathHelper; 7 | import cofh.thermaldynamics.block.ItemBlockDuct; 8 | import cofh.thermaldynamics.duct.Duct; 9 | import cofh.thermaldynamics.duct.TDDucts; 10 | import net.minecraft.creativetab.CreativeTabs; 11 | import net.minecraft.item.Item; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraft.world.World; 14 | import net.minecraftforge.fml.relauncher.Side; 15 | import net.minecraftforge.fml.relauncher.SideOnly; 16 | 17 | import java.util.LinkedList; 18 | import java.util.List; 19 | 20 | public class CreativeTabTD extends CreativeTabs { 21 | 22 | int iconIndex = 0; 23 | TimeTracker iconTracker = new TimeTracker(); 24 | 25 | public CreativeTabTD() { 26 | 27 | super("ThermalDynamics"); 28 | } 29 | 30 | @Override 31 | @SideOnly (Side.CLIENT) 32 | public ItemStack getIconItemStack() { 33 | 34 | updateIcon(); 35 | return TDDucts.getDuct(iconIndex).itemStack; 36 | } 37 | 38 | @Override 39 | @SideOnly (Side.CLIENT) 40 | public Item getTabIconItem() { 41 | 42 | return getIconItemStack().getItem(); 43 | } 44 | 45 | @Override 46 | @SideOnly (Side.CLIENT) 47 | public String getTabLabel() { 48 | 49 | return "thermaldynamics.creativeTab"; 50 | } 51 | 52 | @Override 53 | @SideOnly (Side.CLIENT) 54 | public void displayAllRelevantItems(List list) { 55 | 56 | LinkedList itemStacks = new LinkedList<>(); 57 | super.displayAllRelevantItems(itemStacks); 58 | 59 | for (Duct d : TDDucts.getSortedDucts()) { 60 | list.add(d.itemStack.copy()); 61 | 62 | // if (d instanceof DuctItem) { 63 | // list.add(((DuctItem) d).getDenseItemStack()); 64 | // list.add(((DuctItem) d).getVacuumItemStack()); 65 | // } 66 | } 67 | for (ItemStack item : itemStacks) { 68 | if (!(item.getItem() instanceof ItemBlockDuct)) { 69 | list.add(item); 70 | } 71 | } 72 | } 73 | 74 | private void updateIcon() { 75 | 76 | World world = CoFHCore.proxy.getClientWorld(); 77 | 78 | if (CoreUtils.isClient() && iconTracker.hasDelayPassed(world, 80)) { 79 | int next = MathHelper.RANDOM.nextInt(TDDucts.ductList.size() - 1); 80 | iconIndex = next >= iconIndex ? next + 1 : next; 81 | iconTracker.markTime(world); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/filter/FilterBase.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.filter; 2 | 3 | import codechicken.lib.render.CCRenderState; 4 | import codechicken.lib.vec.Translation; 5 | import codechicken.lib.vec.Vector3; 6 | import codechicken.lib.vec.uv.IconTransformation; 7 | import cofh.thermaldynamics.duct.attachments.ConnectionBase; 8 | import cofh.thermaldynamics.duct.tiles.TileGrid; 9 | import cofh.thermaldynamics.init.TDItems; 10 | import cofh.thermaldynamics.init.TDTextures; 11 | import cofh.thermaldynamics.render.RenderDuct; 12 | import net.minecraft.entity.player.EntityPlayer; 13 | import net.minecraft.item.ItemStack; 14 | import net.minecraft.nbt.NBTTagCompound; 15 | import net.minecraft.util.BlockRenderLayer; 16 | import net.minecraft.world.IBlockAccess; 17 | import net.minecraftforge.fml.relauncher.Side; 18 | import net.minecraftforge.fml.relauncher.SideOnly; 19 | 20 | public abstract class FilterBase extends ConnectionBase { 21 | 22 | public FilterBase(TileGrid tile, byte side) { 23 | 24 | super(tile, side); 25 | } 26 | 27 | public FilterBase(TileGrid tile, byte side, int type) { 28 | 29 | super(tile, side, type); 30 | 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | 36 | return "item.thermaldynamics.filter." + type + ".name"; 37 | } 38 | 39 | // @Override 40 | // public BlockDuct.ConnectionType getNeighborType() { 41 | // 42 | // return isValidInput ? NeighborType.OUTPUT : NeighborType.DUCT_ATTACHMENT; 43 | // } 44 | 45 | @Override 46 | public ItemStack getPickBlock() { 47 | 48 | return new ItemStack(TDItems.itemFilter, 1, type); 49 | } 50 | 51 | @Override 52 | @SideOnly (Side.CLIENT) 53 | public boolean render(IBlockAccess world, BlockRenderLayer layer, CCRenderState ccRenderState) { 54 | 55 | if (layer != BlockRenderLayer.SOLID) { 56 | return false; 57 | } 58 | 59 | Translation trans = Vector3.fromTileCenter(baseTile).translation(); 60 | RenderDuct.modelConnection[stuffed ? 2 : 1][side].render(ccRenderState, trans, new IconTransformation(TDTextures.FILTER_BASE[type])); 61 | return true; 62 | } 63 | 64 | /* IPortableData */ 65 | @Override 66 | public void writePortableData(EntityPlayer player, NBTTagCompound tag) { 67 | 68 | super.writePortableData(player, tag); 69 | tag.setString("DisplayType", "item.thermaldynamics.filter.0.name"); 70 | } 71 | 72 | @Override 73 | public boolean allowDuctConnection() { 74 | 75 | return true; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/DuctItem.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | import cofh.thermaldynamics.render.TextureOverlay; 4 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 5 | import net.minecraft.client.renderer.texture.TextureMap; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.nbt.NBTTagCompound; 8 | 9 | public class DuctItem extends Duct { 10 | 11 | public static final String PATHWEIGHT_NBT = "DenseType"; 12 | 13 | public static final byte PATHWEIGHT_DENSE = 1; 14 | public static final byte PATHWEIGHT_VACUUM = 2; 15 | 16 | public TextureAtlasSprite iconBaseTextureVacuum; 17 | public TextureAtlasSprite iconBaseTextureDense; 18 | 19 | public DuctItem(int id, boolean opaque, int pathWeight, int type, String name, Type ductType, IDuctFactory factory, String baseTexture, String connectionTexture, String fluidTexture, int fluidTransparency, String frameTexture, String frameFluidTexture, int frameFluidTransparency) { 20 | 21 | super(id, opaque, pathWeight, type, name, ductType, factory, baseTexture, connectionTexture, fluidTexture, fluidTransparency, frameTexture, frameFluidTexture, frameFluidTransparency); 22 | } 23 | 24 | @Override 25 | public void registerIcons(TextureMap textureMap) { 26 | 27 | super.registerIcons(textureMap); 28 | iconBaseTextureVacuum = TextureOverlay.generateBaseTexture(textureMap, baseTexture, opaque ? null : "trans", "vacuum"); 29 | iconBaseTextureDense = TextureOverlay.generateBaseTexture(textureMap, baseTexture, opaque ? null : "trans", "dense"); 30 | } 31 | 32 | @Override 33 | public TextureAtlasSprite getBaseTexture(ItemStack itemStack) { 34 | 35 | if (itemStack.getTagCompound() != null) { 36 | byte b = itemStack.getTagCompound().getByte(PATHWEIGHT_NBT); 37 | if (b == PATHWEIGHT_DENSE) { 38 | return iconBaseTextureDense; 39 | } else if (b == PATHWEIGHT_VACUUM) { 40 | return iconBaseTextureVacuum; 41 | } 42 | } 43 | return super.getBaseTexture(itemStack); 44 | } 45 | 46 | public ItemStack getDenseItemStack() { 47 | 48 | ItemStack item = itemStack.copy(); 49 | item.setTagCompound(new NBTTagCompound()); 50 | item.getTagCompound().setByte(PATHWEIGHT_NBT, PATHWEIGHT_DENSE); 51 | return item; 52 | } 53 | 54 | public ItemStack getVacuumItemStack() { 55 | 56 | ItemStack item = itemStack.copy(); 57 | item.setTagCompound(new NBTTagCompound()); 58 | item.getTagCompound().setByte(PATHWEIGHT_NBT, PATHWEIGHT_VACUUM); 59 | return item; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/fluid/PacketFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.fluid; 2 | 3 | import cofh.core.network.PacketCoFHBase; 4 | import cofh.lib.util.helpers.BlockHelper; 5 | import cofh.thermaldynamics.duct.tiles.DuctToken; 6 | import cofh.thermaldynamics.duct.tiles.IDuctHolder; 7 | import com.google.common.collect.Iterables; 8 | import io.netty.buffer.ByteBuf; 9 | import io.netty.channel.ChannelHandlerContext; 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.tileentity.TileEntity; 12 | import net.minecraft.util.math.BlockPos; 13 | import net.minecraft.world.World; 14 | import net.minecraftforge.fluids.FluidStack; 15 | 16 | import java.io.ByteArrayInputStream; 17 | import java.io.DataInputStream; 18 | import java.io.IOException; 19 | 20 | public class PacketFluid extends PacketCoFHBase { 21 | 22 | public ByteArrayInputStream stream; 23 | 24 | public PacketFluid() { 25 | 26 | super(); 27 | } 28 | 29 | public PacketFluid(GridFluid grid, int size) { 30 | 31 | addFluidStack(grid.getRenderFluid()); 32 | addVarInt(size); 33 | 34 | for (Object block : Iterables.concat(grid.nodeSet, grid.idleSet)) { 35 | DuctUnitFluid duct = ((DuctUnitFluid) block); 36 | if (!duct.getDuctType().opaque) { 37 | addVarInt(duct.x()); 38 | addVarInt(duct.y()); 39 | addVarInt(duct.z()); 40 | } 41 | } 42 | } 43 | 44 | @Override 45 | public void handlePacket(EntityPlayer player, boolean isServer) { 46 | 47 | FluidStack fluid = getFluidStack(); 48 | 49 | int n = getVarInt(); 50 | World world = player.worldObj; 51 | for (int i = 0; i < n; i++) { 52 | int x = getVarInt(); 53 | int y = getVarInt(); 54 | int z = getVarInt(); 55 | BlockPos pos = new BlockPos(x, y, z); 56 | if (!world.isBlockLoaded(pos)) { 57 | continue; 58 | } 59 | 60 | TileEntity tile = world.getTileEntity(pos); 61 | 62 | if (tile instanceof IDuctHolder) { 63 | DuctUnitFluid duct = ((IDuctHolder) tile).getDuct(DuctToken.FLUID); 64 | if (duct != null) { 65 | duct.myRenderFluid = fluid; 66 | duct.updateLighting(); 67 | BlockHelper.callBlockUpdate(world, new BlockPos(x, y, z)); 68 | } 69 | } 70 | } 71 | } 72 | 73 | @Override 74 | public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { 75 | 76 | datain = new DataInputStream(stream = new ByteArrayInputStream(buffer.array())); 77 | try { 78 | datain.skipBytes(1); 79 | } catch (IOException e) { 80 | e.printStackTrace(); 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/entity/Camera.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.entity; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.entity.EntityLivingBase; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.inventory.EntityEquipmentSlot; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.util.EnumHandSide; 10 | 11 | import javax.annotation.Nullable; 12 | 13 | public class Camera extends EntityLivingBase { 14 | 15 | public Camera() { 16 | 17 | super(null); 18 | this.width = 0; 19 | this.height = 0; 20 | this.setEntityInvulnerable(true); 21 | } 22 | 23 | @Override 24 | public boolean canTriggerWalking() { 25 | 26 | return false; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public ItemStack getHeldItemMainhand() { 32 | 33 | return null; 34 | } 35 | 36 | @Nullable 37 | @Override 38 | public ItemStack getHeldItemOffhand() { 39 | 40 | return null; 41 | } 42 | 43 | @Override 44 | public EnumHandSide getPrimaryHand() { 45 | 46 | return EnumHandSide.RIGHT; 47 | } 48 | 49 | @Nullable 50 | @Override 51 | public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn) { 52 | 53 | return null; 54 | } 55 | 56 | @Override 57 | public void setItemStackToSlot(EntityEquipmentSlot slotIn, @Nullable ItemStack stack) { 58 | 59 | } 60 | 61 | @Override 62 | public Iterable getArmorInventoryList() { 63 | 64 | return ImmutableList.of(); 65 | } 66 | 67 | public void copyFromEntityTransport(EntityTransport other, EntityPlayer player) { 68 | 69 | if (other.pos != null) { 70 | other.setPosition(0); 71 | } 72 | 73 | if (worldObj == null) { 74 | worldObj = Minecraft.getMinecraft().theWorld; 75 | } 76 | 77 | double dx = 0, dy = player.getYOffset() + 0.35D, dz = 0; 78 | 79 | posX = other.posX + dx; 80 | posY = other.posY + dy; 81 | posZ = other.posZ + dz; 82 | 83 | lastTickPosX = other.lastTickPosX + dx; 84 | lastTickPosY = other.lastTickPosY + dy; 85 | lastTickPosZ = other.lastTickPosZ + dz; 86 | 87 | prevPosX = other.prevPosX + dx; 88 | prevPosY = other.prevPosY + dy; 89 | prevPosZ = other.prevPosZ + dz; 90 | 91 | rotationYaw = player.rotationYaw; 92 | rotationPitch = player.rotationPitch; 93 | 94 | prevRotationYaw = player.prevRotationYaw; 95 | prevRotationPitch = player.prevRotationPitch; 96 | } 97 | 98 | @Override 99 | public float getEyeHeight() { 100 | 101 | return 0; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileTransportDuct.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import codechicken.lib.raytracer.IndexedCuboid6; 4 | import cofh.CoFHCore; 5 | import cofh.thermaldynamics.duct.Duct; 6 | import cofh.thermaldynamics.duct.DuctTransport; 7 | import cofh.thermaldynamics.duct.TDDucts; 8 | import cofh.thermaldynamics.duct.entity.*; 9 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 10 | import com.google.common.collect.ImmutableList; 11 | import net.minecraft.entity.player.EntityPlayer; 12 | 13 | import javax.annotation.Nonnull; 14 | import javax.annotation.Nullable; 15 | import java.util.List; 16 | 17 | public class TileTransportDuct extends TileGrid { 18 | 19 | DuctUnitTransportBase transport; 20 | 21 | public TileTransportDuct() { 22 | 23 | this(TDDucts.transportBasic); 24 | } 25 | 26 | public TileTransportDuct(DuctTransport transportBasic) { 27 | 28 | transport = createDuctUnit(transportBasic); 29 | } 30 | 31 | @Nonnull 32 | public DuctUnitTransportBase createDuctUnit(DuctTransport transportBasic) { 33 | 34 | return new DuctUnitTransport(this, transportBasic); 35 | } 36 | 37 | @Nullable 38 | @Override 39 | public , G extends MultiBlockGrid, C> T getDuct(DuctToken token) { 40 | 41 | if (token == DuctToken.TRANSPORT) { 42 | return (T) transport; 43 | } 44 | return null; 45 | } 46 | 47 | @Override 48 | public Iterable getDuctUnits() { 49 | 50 | return ImmutableList.of(transport); 51 | } 52 | 53 | @Override 54 | public Duct getDuctType() { 55 | 56 | return TDDucts.transportBasic; 57 | } 58 | 59 | @Override 60 | public void addTraceableCuboids(List cuboids) { 61 | 62 | EntityPlayer player = CoFHCore.proxy.getClientPlayer(); 63 | if (player != null && player.getRidingEntity() != null && player.getRidingEntity().getClass() == EntityTransport.class) { 64 | return; 65 | } 66 | super.addTraceableCuboids(cuboids); 67 | } 68 | 69 | public static class Linking extends TileTransportDuct { 70 | 71 | public Linking() { 72 | 73 | super(TDDucts.transportLinking); 74 | } 75 | 76 | @Nonnull 77 | @Override 78 | public DuctUnitTransportBase createDuctUnit(DuctTransport duct) { 79 | 80 | return new DuctUnitTransportLinking(this, duct); 81 | } 82 | } 83 | 84 | public static class LongRange extends TileTransportDuct { 85 | 86 | public LongRange() { 87 | 88 | super(TDDucts.transportLongRange); 89 | } 90 | 91 | @Nonnull 92 | @Override 93 | public DuctUnitTransportBase createDuctUnit(DuctTransport duct) { 94 | 95 | return new DuctUnitTransportLongRange(this, duct); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/init/TDProps.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.init; 2 | 3 | import cofh.lib.util.helpers.MathHelper; 4 | import cofh.thermaldynamics.ThermalDynamics; 5 | import cofh.thermaldynamics.gui.CreativeTabTD; 6 | import cofh.thermaldynamics.gui.CreativeTabTDCovers; 7 | 8 | public class TDProps { 9 | 10 | private TDProps() { 11 | 12 | } 13 | 14 | public static void preInit() { 15 | 16 | configCommon(); 17 | configClient(); 18 | } 19 | 20 | public static void loadComplete() { 21 | 22 | } 23 | 24 | /* HELPERS */ 25 | private static void configCommon() { 26 | 27 | } 28 | 29 | private static void configClient() { 30 | 31 | String category; 32 | String comment; 33 | 34 | /* GRAPHICS */ 35 | category = "Render"; 36 | 37 | comment = "This value affects the size of the inner duct model, such as fluids. Lower it if you experience texture z-fighting."; 38 | smallInnerModelScaling = MathHelper.clamp((float) ThermalDynamics.CONFIG_CLIENT.get(category, "InnerModelScaling", 0.99, comment), 0.50F, 0.99F); 39 | 40 | comment = "This value affects the size of the inner duct model, such as fluids, on the large (octagonal) ducts. Lower it if you experience texture z-fighting."; 41 | largeInnerModelScaling = MathHelper.clamp((float) ThermalDynamics.CONFIG_CLIENT.get(category, "LargeInnerModelScaling", 0.99, comment), 0.50F, 0.99F); 42 | 43 | category = "Interface"; 44 | 45 | comment = "If TRUE, Thermal Dynamics Covers will have a Creative Tab."; 46 | enableCoverCreativeTab = ThermalDynamics.CONFIG_CLIENT.getConfiguration().getBoolean("ItemsInCommonTab", category, enableCoverCreativeTab, comment); 47 | 48 | comment = "If TRUE, Thermal Dynamics Covers will be shown in JEI."; 49 | showCoversInJEI = ThermalDynamics.CONFIG_CLIENT.getConfiguration().getBoolean("CoversInJEI", category, showCoversInJEI, comment); 50 | 51 | /* CREATIVE TABS */ 52 | ThermalDynamics.tabCommon = new CreativeTabTD(); 53 | 54 | if (enableCoverCreativeTab) { 55 | ThermalDynamics.tabCovers = new CreativeTabTDCovers(); 56 | } 57 | } 58 | 59 | /* GENERAL */ 60 | public static final int MAX_ITEMS_TRANSMITTED = 6; 61 | public static final int FLUID_EMPTY_UPDATE_DELAY = 96; 62 | public static final byte FLUID_UPDATE_DELAY = 4; 63 | public static final int ENDER_TRANSMIT_COST = 50; 64 | public static final int MAX_STUFFED_ITEMSTACKS_DROP = 30; 65 | 66 | /* TEXTURES */ 67 | public static final String PATH_GFX = "thermaldynamics:textures/"; 68 | 69 | /* RENDER */ 70 | public static float smallInnerModelScaling = 0.99F; 71 | public static float largeInnerModelScaling = 0.99F; 72 | 73 | /* MISC */ 74 | public static boolean enableCoverCreativeTab = true; 75 | public static boolean showCoversInJEI = false; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui; 2 | 3 | import cofh.core.block.TileCore; 4 | import cofh.thermaldynamics.duct.Attachment; 5 | import cofh.thermaldynamics.duct.tiles.TileGrid; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.tileentity.TileEntity; 8 | import net.minecraft.util.math.BlockPos; 9 | import net.minecraft.world.World; 10 | import net.minecraftforge.fml.common.network.IGuiHandler; 11 | 12 | public class GuiHandler implements IGuiHandler { 13 | 14 | public static final int TILE_ID = 0; 15 | public static final int TILE_CONFIG = 1; 16 | public static final int TILE_ATTACHMENT_ID = 10; 17 | 18 | @Override 19 | public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { 20 | 21 | BlockPos pos = new BlockPos(x, y, z); 22 | TileEntity tile = world.getTileEntity(pos); 23 | 24 | switch (id) { 25 | case TILE_ID: 26 | tile = world.getTileEntity(pos); 27 | if (tile instanceof TileCore) { 28 | return ((TileCore) tile).getGuiClient(player.inventory); 29 | } 30 | return null; 31 | case TILE_CONFIG: 32 | tile = world.getTileEntity(pos); 33 | if (tile instanceof TileGrid) { 34 | return ((TileGrid) tile).getConfigGuiClient(player.inventory); 35 | } 36 | return null; 37 | default: 38 | if (id >= TILE_ATTACHMENT_ID && id <= TILE_ATTACHMENT_ID + 5) { 39 | if (tile instanceof TileGrid) { 40 | Attachment attachment = ((TileGrid) tile).getAttachment(id - TILE_ATTACHMENT_ID); 41 | if (attachment != null) { 42 | return attachment.getGuiClient(player.inventory); 43 | } 44 | } 45 | } 46 | return null; 47 | } 48 | } 49 | 50 | @Override 51 | public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { 52 | 53 | BlockPos pos = new BlockPos(x, y, z); 54 | TileEntity tile = world.getTileEntity(pos); 55 | 56 | switch (id) { 57 | case TILE_ID: 58 | tile = world.getTileEntity(pos); 59 | if (tile instanceof TileCore) { 60 | return ((TileCore) tile).getGuiServer(player.inventory); 61 | } 62 | return null; 63 | case TILE_CONFIG: 64 | tile = world.getTileEntity(pos); 65 | if (tile instanceof TileGrid) { 66 | return ((TileGrid) tile).getConfigGuiServer(player.inventory); 67 | } 68 | return null; 69 | default: 70 | if (id >= TILE_ATTACHMENT_ID && id <= TILE_ATTACHMENT_ID + 5) { 71 | if (tile instanceof TileGrid) { 72 | Attachment attachment = ((TileGrid) tile).getAttachment(id - TILE_ATTACHMENT_ID); 73 | if (attachment != null) { 74 | return attachment.getGuiServer(player.inventory); 75 | } 76 | } 77 | } 78 | return null; 79 | } 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/fluid/GridFluidSuper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.fluid; 2 | 3 | import cofh.lib.util.helpers.FluidHelper; 4 | import cofh.thermaldynamics.multiblock.IGridTile; 5 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 6 | import net.minecraft.world.World; 7 | import net.minecraftforge.fluids.FluidStack; 8 | 9 | public class GridFluidSuper extends GridFluid { 10 | 11 | public GridFluidSuper(World world) { 12 | 13 | super(world); 14 | } 15 | 16 | int nodeTracker; 17 | boolean isSendingFluid; 18 | 19 | DuctUnitFluid[] nodeList = null; 20 | 21 | @Override 22 | public void tickGrid() { 23 | 24 | super.tickGrid(); 25 | int i = 0; 26 | if (nodeList == null) { 27 | nodeList = new DuctUnitFluid[nodeSet.size()]; 28 | for (IGridTile multiBlock : nodeSet) { 29 | nodeList[i] = (DuctUnitFluid) multiBlock; 30 | i++; 31 | } 32 | } 33 | } 34 | 35 | public int sendFluid(FluidStack fluid, boolean simulate) { 36 | 37 | if (fluid == null || !FluidHelper.isFluidEqualOrNull(myTank.getFluid(), fluid) || isSendingFluid) { 38 | return 0; 39 | } 40 | int fluidToSend = fluid.amount; 41 | int addedToGrid = myTank.fill(fluid, !simulate); 42 | 43 | fluidToSend -= addedToGrid; 44 | 45 | if (fluidToSend <= 0) { 46 | return fluid.amount; 47 | } 48 | int tempTracker = nodeTracker; 49 | 50 | DuctUnitFluid[] list = nodeList; 51 | if (list == null || list.length == 0) { 52 | return fluid.amount - fluidToSend; 53 | } 54 | isSendingFluid = true; 55 | for (int i = nodeTracker; i < list.length && fluidToSend > 0; i++) { 56 | fluidToSend -= trackInOut(list[i].transfer(fluidToSend, simulate, fluid, false), simulate); 57 | if (fluidToSend == 0) { 58 | nodeTracker = i + 1; 59 | } 60 | } 61 | for (int i = 0; i < list.length && i < nodeTracker && fluidToSend > 0; i++) { 62 | fluidToSend -= trackInOut(list[i].transfer(fluidToSend, simulate, fluid, false), simulate); 63 | if (fluidToSend == 0) { 64 | nodeTracker = i + 1; 65 | } 66 | } 67 | if (fluidToSend > 0) { 68 | nodeTracker++; 69 | } 70 | if (nodeTracker >= list.length) { 71 | nodeTracker = 0; 72 | } 73 | if (simulate) { 74 | nodeTracker = tempTracker; 75 | } 76 | isSendingFluid = false; 77 | 78 | return fluid.amount - fluidToSend; 79 | } 80 | 81 | @Override 82 | public void onMajorGridChange() { 83 | 84 | super.onMajorGridChange(); 85 | nodeList = null; 86 | } 87 | 88 | @Override 89 | public boolean canGridsMerge(MultiBlockGrid grid) { 90 | 91 | return grid instanceof GridFluidSuper; 92 | } 93 | 94 | @Override 95 | public void destroy() { 96 | 97 | nodeList = null; 98 | super.destroy(); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/MultiBlockGridTracking.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import cofh.thermaldynamics.util.WorldGridList; 4 | import com.google.common.math.DoubleMath; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.util.text.ITextComponent; 7 | import net.minecraft.util.text.TextComponentTranslation; 8 | import net.minecraft.world.World; 9 | 10 | import java.util.List; 11 | 12 | public abstract class MultiBlockGridTracking extends MultiBlockGrid { 13 | 14 | public MultiBlockGridTracking(WorldGridList worldGrid) { 15 | 16 | super(worldGrid); 17 | } 18 | 19 | public MultiBlockGridTracking(World worldObj) { 20 | 21 | super(worldObj); 22 | } 23 | 24 | private Tracker tracker; 25 | 26 | public Tracker getTracker() { 27 | 28 | if (tracker == null) { 29 | tracker = new Tracker(getLevel()); 30 | } 31 | tracker.life = 0; 32 | return tracker; 33 | } 34 | 35 | public abstract int getLevel(); 36 | 37 | public int trackIn(int a, boolean simulate) { 38 | 39 | if (!simulate && tracker != null) { 40 | tracker.stuffIn(a); 41 | } 42 | return a; 43 | } 44 | 45 | public int trackOut(int a, boolean simulate) { 46 | 47 | if (!simulate && tracker != null) { 48 | tracker.stuffOut(a); 49 | } 50 | return a; 51 | } 52 | 53 | public int trackInOut(int a, boolean simulate) { 54 | 55 | if (!simulate && tracker != null) { 56 | tracker.stuffIn(a); 57 | tracker.stuffOut(a); 58 | } 59 | return a; 60 | } 61 | 62 | @Override 63 | public void tickGrid() { 64 | 65 | super.tickGrid(); 66 | if (tracker != null) { 67 | tracker.newTick(getLevel()); 68 | if (tracker.life > Tracker.LIFESPAN) { 69 | tracker = null; 70 | } 71 | } 72 | } 73 | 74 | @Override 75 | public void addInfo(List info, EntityPlayer player, boolean debug) { 76 | 77 | super.addInfo(info, player, debug); 78 | addInfo(info, "tracker.cur", format(getLevel())); 79 | 80 | if (tracker == null) { 81 | info.add(new TextComponentTranslation("info.thermaldynamics.info.tracker.activate")); 82 | getTracker(); 83 | return; 84 | } 85 | 86 | tracker.life = 0; 87 | 88 | addInfo(info, "tracker.avg", format(tracker.avgStuff()) + getUnit()); 89 | addInfo(info, "tracker.avgInOut", String.format("+%s%s/-%s%s", format(tracker.avgStuffIn()), getUnit(), format(tracker.avgStuffOut()), getUnit())); 90 | } 91 | 92 | private String format(double v) { 93 | 94 | if (v == 0) { 95 | return "0"; 96 | } 97 | if (DoubleMath.isMathematicalInteger(v)) { 98 | return Integer.toString((int) v); 99 | } 100 | return String.format("%.2f", v); 101 | } 102 | 103 | protected abstract String getUnit(); 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/item/GridItem.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.item; 2 | 3 | import cofh.thermaldynamics.duct.Attachment; 4 | import cofh.thermaldynamics.multiblock.IGridTile; 5 | import cofh.thermaldynamics.multiblock.MultiBlockGridWithRoutes; 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.util.text.ITextComponent; 9 | import net.minecraft.world.World; 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | 15 | public class GridItem extends MultiBlockGridWithRoutes { 16 | 17 | public GridItem(World world) { 18 | 19 | super(world); 20 | } 21 | 22 | public int travelingItemsCount = 0; 23 | public static ArrayList toTick = new ArrayList<>(); 24 | public HashMap travelingItems = new HashMap<>(); 25 | public boolean shouldRepoll = true; 26 | public boolean repoll = false; 27 | 28 | @Override 29 | public void tickGrid() { 30 | 31 | super.tickGrid(); 32 | 33 | repoll = shouldRepoll; 34 | if (shouldRepoll) { 35 | if (!travelingItems.isEmpty()) { 36 | travelingItems.clear(); 37 | } 38 | travelingItemsCount = 0; 39 | } 40 | shouldRepoll = false; 41 | 42 | for (IGridTile m : nodeSet) { 43 | if (!m.tickPass(0)) { 44 | break; 45 | } 46 | } 47 | if (repoll || travelingItemsCount > 0) { 48 | for (IGridTile m : idleSet) { 49 | if (!m.tickPass(0)) { 50 | break; 51 | } 52 | } 53 | } 54 | if (!toTick.isEmpty()) { 55 | for (Attachment attachment : toTick) { 56 | attachment.tick(1); 57 | } 58 | for (Attachment attachment : toTick) { 59 | attachment.tick(2); 60 | } 61 | toTick.clear(); 62 | } 63 | super.tickGrid(); 64 | } 65 | 66 | @Override 67 | public boolean canAddBlock(IGridTile aBlock) { 68 | 69 | return aBlock instanceof DuctUnitItem; 70 | } 71 | 72 | public void poll(TravelingItem item) { 73 | 74 | travelingItemsCount++; 75 | 76 | if (item.myPath == null) { 77 | return; 78 | } 79 | BlockPos dest = item.getDest(); 80 | StackMap list = travelingItems.computeIfAbsent(dest, k -> new StackMap()); 81 | list.addItemEntry(item.getStackEntry(), item.stack.stackSize); 82 | } 83 | 84 | @Override 85 | public void onMinorGridChange() { 86 | 87 | super.onMinorGridChange(); 88 | shouldRepoll = true; 89 | } 90 | 91 | @Override 92 | public void onMajorGridChange() { 93 | 94 | super.onMajorGridChange(); 95 | shouldRepoll = true; 96 | } 97 | 98 | @Override 99 | public void addInfo(List info, EntityPlayer player, boolean debug) { 100 | 101 | super.addInfo(info, player, debug); 102 | addInfo(info, "items", travelingItemsCount); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/DuctToken.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.api.energy.IEnergyReceiver; 4 | import cofh.thermaldynamics.duct.DuctUnitStructural; 5 | import cofh.thermaldynamics.duct.GridStructural; 6 | import cofh.thermaldynamics.duct.energy.DuctUnitEnergy; 7 | import cofh.thermaldynamics.duct.energy.GridEnergy; 8 | import cofh.thermaldynamics.duct.entity.DuctUnitTransportBase; 9 | import cofh.thermaldynamics.duct.entity.GridTransport; 10 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluid; 11 | import cofh.thermaldynamics.duct.fluid.GridFluid; 12 | import cofh.thermaldynamics.duct.item.DuctUnitItem; 13 | import cofh.thermaldynamics.duct.item.GridItem; 14 | import cofh.thermaldynamics.duct.light.DuctUnitLight; 15 | import cofh.thermaldynamics.duct.light.GridLight; 16 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 17 | 18 | import javax.annotation.Nonnull; 19 | 20 | public class DuctToken, G extends MultiBlockGrid, C> implements Comparable { 21 | 22 | // Structure grid, for redstone signals relays 23 | public static final DuctToken STRUCTURAL = new DuctToken<>("Structural"); 24 | 25 | // Energy grid, for any energy transfer 26 | public static final DuctToken ENERGY = new DuctToken<>("Energy"); 27 | 28 | // public static final DuctToken ENERGY_STORAGE = new DuctToken<>("Energy_Storage"); 29 | 30 | // Storage energy grid, for storing internal energy 31 | 32 | // 'Super' energy duct, for large amounts of energy 33 | 34 | // Item grid 35 | public static final DuctToken ITEMS = new DuctToken<>("Item"); 36 | 37 | // Fluid grid 38 | public static final DuctToken FLUID = new DuctToken<>("Fluid"); 39 | 40 | public static final DuctToken TRANSPORT = new DuctToken<>("Transport"); 41 | 42 | public static final DuctToken LIGHT = new DuctToken<>("Light"); 43 | 44 | public final static DuctToken[] TOKENS = new DuctToken[] { STRUCTURAL, ENERGY, ITEMS, FLUID, TRANSPORT, LIGHT }; 45 | 46 | static { 47 | for (int i = 0; i < TOKENS.length; i++) { 48 | TOKENS[i].id = (byte) i; 49 | } 50 | } 51 | 52 | public final String key; 53 | private byte id; 54 | 55 | public DuctToken(String key) { 56 | 57 | this.key = key; 58 | } 59 | 60 | public byte getId() { 61 | 62 | return id; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | 68 | return "[" + key + "=" + id + "]"; 69 | } 70 | 71 | @Override 72 | public int compareTo(@Nonnull DuctToken o) { 73 | 74 | return Integer.compare(id, o.id); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/container/ContainerTransport.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.container; 2 | 3 | import cofh.core.network.PacketHandler; 4 | import cofh.thermaldynamics.duct.entity.DuctUnitTransport; 5 | import cofh.thermaldynamics.gui.client.DirectoryEntry; 6 | import cofh.thermaldynamics.multiblock.RouteCache; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.inventory.Container; 10 | import net.minecraft.inventory.IContainerListener; 11 | import net.minecraft.item.ItemStack; 12 | 13 | import java.util.ArrayList; 14 | import java.util.Comparator; 15 | 16 | public class ContainerTransport extends Container { 17 | 18 | public final DuctUnitTransport transportDuct; 19 | public DirectoryEntry directoryEntry; 20 | 21 | public ContainerTransport(DuctUnitTransport transportDuct) { 22 | 23 | this.transportDuct = transportDuct; 24 | } 25 | 26 | @Override 27 | public boolean canInteractWith(EntityPlayer p_75145_1_) { 28 | 29 | return !transportDuct.parent.isInvalid() && (transportDuct.isOutput() || transportDuct.world().isRemote); 30 | } 31 | 32 | @Override 33 | public void addListener(IContainerListener listener) { 34 | 35 | super.addListener(listener); 36 | if (listener instanceof EntityPlayerMP) { 37 | PacketHandler.sendTo(transportDuct.getDirectoryPacket(), (EntityPlayerMP) listener); 38 | cache = transportDuct.getCache(); 39 | } 40 | 41 | } 42 | 43 | @Override 44 | public void detectAndSendChanges() { 45 | 46 | super.detectAndSendChanges(); 47 | 48 | if (!this.listeners.isEmpty()) { 49 | if (cache == null || cache.invalid) { 50 | if (transportDuct.getGrid() == null) { 51 | cache = null; 52 | } else { 53 | cache = transportDuct.getCache(); 54 | for (IContainerListener listener : listeners) { 55 | if (listener instanceof EntityPlayerMP) { 56 | PacketHandler.sendTo(transportDuct.getDirectoryPacket(), (EntityPlayerMP) listener); 57 | } 58 | } 59 | } 60 | } 61 | } 62 | } 63 | 64 | RouteCache cache; 65 | 66 | public ArrayList directory; 67 | 68 | public Comparator blockDist = (o1, o2) -> compareStrings(o1.name, o2.name); 69 | 70 | public int compareStrings(String name1, String name2) { 71 | 72 | return name1 == null ? name2 == null ? 0 : -1 : name2 == null ? 1 : name1.compareTo(name2); 73 | } 74 | 75 | boolean needsResort = false; 76 | 77 | public void setDirectory(ArrayList entries) { 78 | 79 | directory = entries; 80 | directory.sort(blockDist); 81 | needsResort = true; 82 | } 83 | 84 | @Override 85 | public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { 86 | 87 | return null; 88 | } 89 | 90 | public void setEntry(DirectoryEntry directoryEntry) { 91 | 92 | this.directoryEntry = directoryEntry; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/cover/CoverHelper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.cover; 2 | 3 | import cofh.thermaldynamics.init.TDItems; 4 | import net.minecraft.block.Block; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.init.Blocks; 7 | import net.minecraft.item.ItemBlock; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.nbt.NBTTagCompound; 10 | import net.minecraftforge.common.IShearable; 11 | import net.minecraftforge.fml.common.registry.ForgeRegistries; 12 | 13 | public class CoverHelper { 14 | 15 | public static boolean isValid(ItemStack stack) { 16 | 17 | try { 18 | if (stack.getItem() instanceof ItemBlock) { 19 | if (isValid(((ItemBlock) stack.getItem()).getBlock(), stack.getItem().getMetadata(stack.getItemDamage()))) { 20 | return true; 21 | } 22 | } 23 | return false; 24 | } catch (Exception e) { 25 | e.printStackTrace(); 26 | } 27 | return false; 28 | } 29 | 30 | public static boolean isValid(Block block, int meta) { 31 | 32 | try { 33 | if (block == null || block instanceof IShearable) { 34 | return false; 35 | } 36 | IBlockState state = block.getStateFromMeta(meta); 37 | return !(block.hasTileEntity(state) || block.hasTileEntity()) && state.isFullCube(); 38 | } catch (Exception e) { 39 | return false; 40 | } 41 | } 42 | 43 | public static ItemStack getCoverStack(ItemStack stack) { 44 | 45 | if (stack.getItem() instanceof ItemBlock) { 46 | return getCoverStack(((ItemBlock) stack.getItem()).getBlock(), stack.getItem().getMetadata(stack.getItemDamage())); 47 | } 48 | return null; 49 | } 50 | 51 | public static ItemStack getCoverStack(IBlockState state) { 52 | 53 | return getCoverStack(state.getBlock(), state.getBlock().getMetaFromState(state)); 54 | } 55 | 56 | public static ItemStack getCoverStack(Block block, int meta) { 57 | 58 | NBTTagCompound tag = new NBTTagCompound(); 59 | tag.setString("Block", ForgeRegistries.BLOCKS.getKey(block).toString()); 60 | tag.setByte("Meta", ((byte) meta)); 61 | 62 | ItemStack itemStack = new ItemStack(TDItems.itemCover, 1); 63 | itemStack.setTagCompound(tag); 64 | return itemStack; 65 | } 66 | 67 | public static ItemStack getCoverItemStack(ItemStack stack, boolean removeInvalidData) { 68 | 69 | NBTTagCompound nbt = stack.getTagCompound(); 70 | 71 | if (nbt == null || !nbt.hasKey("Meta", 1) || !nbt.hasKey("Block", 8)) { 72 | return null; 73 | } 74 | int meta = nbt.getByte("Meta"); 75 | Block block = Block.getBlockFromName(nbt.getString("Block")); 76 | 77 | if (block == Blocks.AIR || meta < 0 || meta >= 16 || !isValid(block, meta)) { 78 | if (removeInvalidData) { 79 | nbt.removeTag("Meta"); 80 | nbt.removeTag("Block"); 81 | if (nbt.hasNoTags()) { 82 | stack.setTagCompound(null); 83 | } 84 | } 85 | return null; 86 | } 87 | return new ItemStack(block, 1, meta); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CoFH "Don't Be a Jerk" License 2 | ==================================== 3 | #### Okay, so here's the deal. 4 | 5 | You'll notice that this repository does not have a license! By default, that means "All Rights Reserved." 6 | 7 | That is indeed the case. All rights reserved, as far as the code is concerned. 8 | 9 | Art and sound assets are released under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0), a summary of which can be found at: https://creativecommons.org/licenses/by-sa/4.0/ 10 | 11 | ©2012-2017 Cult of the Full Hub / Team CoFH / CoFH 12 | 13 | #### Homepage 14 | 15 | [TeamCoFH Home Page](http://teamcofh.com/) 16 | 17 | [IRC #ThermalExpansion on esper.net](http://webchat.esper.net/?nick=ThermalWiki....&channels=ThermalExpansion) 18 | 19 | #### Notice 20 | 21 | Contribution to this repository means that you are granting us rights over the code that you choose to contribute. If you do not agree with that, do not contribute. 22 | 23 | So, why is this here? Well, the rights are reserved, but what that really means is that we choose what to do with the rights. So here you go. 24 | 25 | #### You CAN 26 | - Fork and modify the code. 27 | - Submit Pull Requests to this repository. 28 | - Copy portions of this code for use in other projects. 29 | - Write your own code that uses this code as a dependency. (addon mods!) 30 | 31 | #### You CANNOT 32 | - Redistribute this in its entirety as source or compiled code. 33 | - Create or distribute code which contains 50% or more Functionally Equivalent Statements* from this repository. 34 | 35 | #### You MUST 36 | - Maintain a visible repository of your code which is inspired by, derived from, or copied from this code. Basically, if you use it, pay it forward. You keep rights to your OWN code, but you still must make your source visible. 37 | - Not be a jerk**. Seriously, if you're a jerk, you can't use this code. That's part of the agreement. 38 | 39 | #### Notes, License & Copyright 40 | 41 | *A Functionally Equivalent Statement is a code fragment which, regardless of whitespace and object names, achieves the same result within the context of a Minecraft mod or addon. Basically you can't copy the code, rename the variables, add whitespace and say it's different. It's not. 42 | 43 | **A jerk is anyone who attempts to or intends to claim partial or total ownership of the original or repackaged code and/or attempts to or intends to redistribute original or repackaged code without prior express written permission from the owners (CoFH). 44 | 45 | Essentially, take this and learn from it! Create addon mods that depend on it! If you see something we can improve, tell us. Submit a Pull Request. The one catch: don't steal! A lot of effort has gone into this, and if you were to take this and call it your own, you'd basically be a big jerk. 46 | 47 | Don't be a jerk. 48 | 49 | See LICENSE-CODE.txt and LICENSE-ART.txt for license information. 50 | 51 | ©2012-2017 Cult of the Full Hub / Team CoFH / CoFH 52 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/element/ElementDirectoryButton.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.element; 2 | 3 | import cofh.lib.gui.element.ElementButton; 4 | import cofh.thermaldynamics.gui.client.DirectoryEntry; 5 | import cofh.thermaldynamics.gui.client.GuiTransport; 6 | 7 | import java.util.List; 8 | 9 | public class ElementDirectoryButton extends ElementButton { 10 | 11 | final int index; 12 | final GuiTransport gui; 13 | DirectoryEntry entry; 14 | 15 | public ElementDirectoryButton(int index, GuiTransport gui, int posX, int posY, int sizeX, int sizeY, int sheetX, int sheetY, int hoverX, int hoverY, String texture) { 16 | 17 | super(gui, posX, posY, sizeX, sizeY, sheetX, sheetY, hoverX, hoverY, texture); 18 | this.index = index; 19 | this.gui = gui; 20 | } 21 | 22 | public ElementDirectoryButton(int i, GuiTransport gui, int x0, int y0) { 23 | 24 | this(i, gui, x0, y0 + i * (GuiTransport.BUTTON_HEIGHT + GuiTransport.BUTTON_OFFSET), GuiTransport.BUTTON_WIDTH, GuiTransport.BUTTON_HEIGHT, GuiTransport.GUI_BUTTON_X0_BASE, GuiTransport.GUI_BUTTON_Y0_BASE, GuiTransport.GUI_BUTTON_X0_HOVER, GuiTransport.GUI_BUTTON_Y0_HOVER, GuiTransport.TEX_PATH); 25 | } 26 | 27 | public void setEntry(DirectoryEntry entry) { 28 | 29 | this.entry = entry; 30 | } 31 | 32 | @Override 33 | public boolean isVisible() { 34 | 35 | return super.isVisible() && entry != null; 36 | } 37 | 38 | @Override 39 | public void onClick() { 40 | 41 | if (entry != null) { 42 | gui.goToDest(entry); 43 | } 44 | } 45 | 46 | @Override 47 | public void drawBackground(int mouseX, int mouseY, float gameTicks) { 48 | 49 | super.drawBackground(mouseX, mouseY, gameTicks); 50 | } 51 | 52 | @Override 53 | public void drawForeground(int mouseX, int mouseY) { 54 | 55 | super.drawForeground(mouseX, mouseY); 56 | 57 | if (entry == null) { 58 | return; 59 | } 60 | 61 | String text = getFontRenderer().trimStringToWidth(entry.getName(), sizeX - sizeY - 4); 62 | 63 | getFontRenderer().drawStringWithShadow(text, posX + sizeY + 4, posY + (sizeY - 8) / 2, getTextColor(mouseX, mouseY)); 64 | 65 | if (entry.icon != null) { 66 | gui.drawItemStack(entry.icon, posX + 3, posY + 3, false, null); 67 | } 68 | } 69 | 70 | protected int getTextColor(int mouseX, int mouseY) { 71 | 72 | if (!isEnabled()) { 73 | return -6250336; 74 | } else if (intersectsWith(mouseX, mouseY)) { 75 | return 16777120; 76 | } else { 77 | return 14737632; 78 | } 79 | } 80 | 81 | public void setPosX(int x0) { 82 | 83 | posX = x0; 84 | } 85 | 86 | @Override 87 | public void addTooltip(List list) { 88 | 89 | list.add(entry.getName()); 90 | 91 | // list.add( 92 | // String.format("x=%d, y=%d, z=%d", entry.x, entry.y, entry.z) 93 | // ); 94 | list.add(String.format("x: %d", entry.x)); 95 | list.add(String.format("y: %d", entry.y)); 96 | list.add(String.format("z: %d", entry.z)); 97 | 98 | // Math.abs(entry.x - gui.container.directoryEntry.x) 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/multiblock/MultiBlockGridWithRoutes.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.multiblock; 2 | 3 | import net.minecraft.world.World; 4 | 5 | import java.util.HashMap; 6 | import java.util.LinkedList; 7 | 8 | public abstract class MultiBlockGridWithRoutes, G extends MultiBlockGridWithRoutes> extends MultiBlockGrid { 9 | 10 | public final LinkedList> calculatingRoutes = new LinkedList<>(); 11 | public HashMap> routeCacheMap = new HashMap<>(); 12 | 13 | public MultiBlockGridWithRoutes(World world) { 14 | 15 | super(world); 16 | } 17 | 18 | @Override 19 | public void doTickProcessing(long deadline) { 20 | 21 | for (int i = 0; !calculatingRoutes.isEmpty(); ++i) { 22 | RouteCache routeCache = calculatingRoutes.peek(); 23 | if (routeCache != null && !routeCache.processStep()) { 24 | calculatingRoutes.remove(routeCache); 25 | } 26 | if (i == 15) { 27 | if (System.nanoTime() > deadline) { 28 | return; 29 | } 30 | i = 0; 31 | } 32 | } 33 | } 34 | 35 | @Override 36 | public boolean isTickProcessing() { 37 | 38 | return !calculatingRoutes.isEmpty(); 39 | } 40 | 41 | @Override 42 | public void onMinorGridChange() { 43 | 44 | super.onMinorGridChange(); 45 | onMajorGridChange(); 46 | } 47 | 48 | @Override 49 | public void onMajorGridChange() { 50 | 51 | super.onMajorGridChange(); 52 | if (!routeCacheMap.isEmpty()) { 53 | for (RouteCache routeCache : routeCacheMap.values()) { 54 | routeCache.invalidate(); 55 | } 56 | routeCacheMap.clear(); 57 | } 58 | 59 | if (!calculatingRoutes.isEmpty()) { 60 | calculatingRoutes.clear(); 61 | } 62 | } 63 | 64 | public RouteCache getRoutesFromOutputNonUrgent(T start) { 65 | 66 | RouteCache cache; 67 | cache = routeCacheMap.get(start); 68 | if (cache != null) { 69 | return cache; 70 | } 71 | 72 | cache = new RouteCache(start); 73 | calculatingRoutes.add(cache); 74 | 75 | routeCacheMap.put(start, cache); 76 | return cache; 77 | } 78 | 79 | public RouteCache getRoutesFromOutputRange(T start, int maxRange) { 80 | 81 | RouteCache cache = routeCacheMap.get(start); 82 | if (cache == null) { 83 | cache = new RouteCache(start, maxRange); 84 | cache.generateCache(); 85 | routeCacheMap.put(start, cache); 86 | } else if (cache.maxPathLength < maxRange) { 87 | cache.maxPathLength = maxRange; 88 | cache.generateCache(); 89 | } 90 | 91 | return cache; 92 | } 93 | 94 | public RouteCache getRoutesFromOutput(T start) { 95 | 96 | RouteCache cache = routeCacheMap.get(start); 97 | if (cache == null) { 98 | cache = new RouteCache(start); 99 | cache.generateCache(); 100 | routeCacheMap.put(start, cache); 101 | } else if (!cache.isFinishedGenerating() || cache.maxPathLength < Integer.MAX_VALUE) { 102 | cache.maxPathLength = Integer.MAX_VALUE; 103 | cache.generateCache(); 104 | } 105 | 106 | return cache; 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .gradle/ 7 | .project 8 | .metadata 9 | bin/ 10 | eclipse/ 11 | tmp/ 12 | *.tmp 13 | *.bak 14 | *.swp 15 | *~.nib 16 | local.properties 17 | .classpath 18 | .settings/ 19 | .loadpath 20 | crash-reports/ 21 | logs/ 22 | mods/ 23 | resourcepacks/ 24 | saves/ 25 | /options.txt 26 | 27 | # External tool builders 28 | .externalToolBuilders/ 29 | 30 | # Locally stored "Eclipse launch configurations" 31 | *.launch 32 | 33 | # CDT-specific 34 | .cproject 35 | 36 | # PDT-specific 37 | .buildpath 38 | 39 | 40 | ################# 41 | ## Visual Studio 42 | ################# 43 | 44 | ## Ignore Visual Studio temporary files, build results, and 45 | ## files generated by popular Visual Studio add-ons. 46 | 47 | # User-specific files 48 | *.suo 49 | *.user 50 | *.sln.docstates 51 | 52 | # Build results 53 | [Dd]ebug/ 54 | [Rr]elease/ 55 | *_i.c 56 | *_p.c 57 | *.ilk 58 | *.meta 59 | *.pch 60 | *.pdb 61 | *.pgc 62 | *.pgd 63 | *.rsp 64 | *.sbr 65 | *.tlb 66 | *.tli 67 | *.tlh 68 | *.tmp 69 | *.vspscc 70 | .builds 71 | *.dotCover 72 | 73 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 74 | #packages/ 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opensdf 81 | *.sdf 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | 87 | # ReSharper is a .NET coding add-in 88 | _ReSharper* 89 | 90 | # Installshield output folder 91 | [Ee]xpress 92 | 93 | # DocProject is a documentation generator add-in 94 | DocProject/buildhelp/ 95 | DocProject/Help/*.HxT 96 | DocProject/Help/*.HxC 97 | DocProject/Help/*.hhc 98 | DocProject/Help/*.hhk 99 | DocProject/Help/*.hhp 100 | DocProject/Help/Html2 101 | DocProject/Help/html 102 | 103 | # Click-Once directory 104 | publish 105 | 106 | # Others 107 | [Bb]in 108 | [Oo]bj 109 | sql 110 | TestResults 111 | *.Cache 112 | ClientBin 113 | stylecop.* 114 | ~$* 115 | *.dbmdl 116 | Generated_Code #added for RIA/Silverlight projects 117 | 118 | # Backup & report files from converting an old project file to a newer 119 | # Visual Studio version. Backup files are not needed, because we have git ;-) 120 | _UpgradeReport_Files/ 121 | Backup*/ 122 | UpgradeLog*.XML 123 | 124 | 125 | 126 | ############ 127 | ## Windows 128 | ############ 129 | 130 | # Windows image file caches 131 | Thumbs.db 132 | 133 | # Folder config file 134 | Desktop.ini 135 | 136 | 137 | ############# 138 | ## Python 139 | ############# 140 | 141 | *.py[co] 142 | 143 | # Packages 144 | *.egg 145 | *.egg-info 146 | dist 147 | build 148 | eggs 149 | parts 150 | bin 151 | var 152 | sdist 153 | develop-eggs 154 | .installed.cfg 155 | 156 | # Installer logs 157 | pip-log.txt 158 | 159 | # Unit test / coverage reports 160 | .coverage 161 | .tox 162 | 163 | #Translations 164 | *.mo 165 | 166 | #Mr Developer 167 | .mr.developer.cfg 168 | 169 | # Mac crap 170 | .DS_Store 171 | 172 | ########### 173 | 174 | downloads 175 | screenshots 176 | techne 177 | 178 | ############# 179 | ## denoflions 180 | ############# 181 | 182 | MFR-Forestry 183 | nbproject 184 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/util/ListWrapper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.util; 2 | 3 | import cofh.lib.util.helpers.MathHelper; 4 | 5 | import java.util.Iterator; 6 | import java.util.LinkedList; 7 | import java.util.ListIterator; 8 | 9 | public class ListWrapper implements Iterable { 10 | 11 | LinkedList list; 12 | Object[] array; 13 | int cursor; 14 | public SortType type; 15 | 16 | public void setList(LinkedList list, SortType type) { 17 | 18 | this.list = list; 19 | array = null; 20 | this.type = type; 21 | cursor = 0; 22 | } 23 | 24 | @Override 25 | public Iterator iterator() { 26 | 27 | if (list.size() <= 1) { 28 | return list.listIterator(); 29 | } 30 | if (type == SortType.NORMAL) { 31 | return list.iterator(); 32 | } else if (type == SortType.REVERSE) { 33 | return list.descendingIterator(); 34 | } else if (type == SortType.ROUNDROBIN) { 35 | return new RRobinIter(); 36 | } else if (type == SortType.SHUFFLE) { 37 | if (array == null || list.size() != array.length) { 38 | array = list.toArray(); 39 | } 40 | return new ShuffleIter(); 41 | } 42 | 43 | return list.iterator(); 44 | } 45 | 46 | public void advanceCursor() { 47 | 48 | cursor++; 49 | if (cursor >= list.size()) { 50 | cursor = 0; 51 | } 52 | } 53 | 54 | public T peekRR() { 55 | 56 | if (cursor + 1 >= list.size()) { 57 | return list.get(0); 58 | } else { 59 | return list.get(cursor + 1); 60 | } 61 | } 62 | 63 | public int size() { 64 | 65 | return list.size(); 66 | } 67 | 68 | public class RRobinIter implements Iterator { 69 | 70 | public ListIterator tListIterator; 71 | final int stopCursor = cursor - 1; 72 | 73 | public RRobinIter() { 74 | 75 | tListIterator = list.listIterator(cursor); 76 | } 77 | 78 | @Override 79 | public boolean hasNext() { 80 | 81 | if (!tListIterator.hasNext()) { 82 | if (stopCursor < 0) { 83 | return false; 84 | } else { 85 | tListIterator = list.listIterator(0); 86 | } 87 | } 88 | 89 | return tListIterator.nextIndex() != stopCursor; 90 | } 91 | 92 | @Override 93 | public T next() { 94 | 95 | advanceCursor(); 96 | return tListIterator.next(); 97 | } 98 | 99 | @Override 100 | public void remove() { 101 | 102 | } 103 | } 104 | 105 | public enum SortType { 106 | NORMAL, REVERSE, SHUFFLE, ROUNDROBIN 107 | } 108 | 109 | private class ShuffleIter implements Iterator { 110 | 111 | int i; 112 | 113 | public ShuffleIter() { 114 | 115 | super(); 116 | } 117 | 118 | @Override 119 | public boolean hasNext() { 120 | 121 | return i < array.length; 122 | } 123 | 124 | @SuppressWarnings ("unchecked") 125 | @Override 126 | public T next() { 127 | 128 | Object t = array[i]; 129 | int j = MathHelper.RANDOM.nextInt(array.length - i) + i; 130 | array[i] = array[j]; 131 | array[j] = t; 132 | 133 | i++; 134 | return (T) t; 135 | } 136 | 137 | @Override 138 | public void remove() { 139 | 140 | throw new UnsupportedOperationException(); 141 | } 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/DuctUnitStructural.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | import cofh.thermaldynamics.block.BlockDuct; 4 | import cofh.thermaldynamics.duct.attachments.relay.Relay; 5 | import cofh.thermaldynamics.duct.tiles.DuctToken; 6 | import cofh.thermaldynamics.duct.tiles.DuctUnit; 7 | import cofh.thermaldynamics.duct.tiles.TileGrid; 8 | import cofh.thermaldynamics.duct.tiles.TileStructuralDuct; 9 | import net.minecraft.tileentity.TileEntity; 10 | 11 | import javax.annotation.Nonnull; 12 | import javax.annotation.Nullable; 13 | 14 | public class DuctUnitStructural extends DuctUnit { 15 | 16 | private static final Void[] VOIDS = new Void[6]; 17 | 18 | @Nullable 19 | private final DuctUnit mainDuct; 20 | ; 21 | 22 | public DuctUnitStructural(TileGrid parent, @Nonnull DuctUnit mainDuct) { 23 | 24 | super(parent, mainDuct.getDuctType()); 25 | this.mainDuct = mainDuct; 26 | } 27 | 28 | public DuctUnitStructural(TileStructuralDuct parent, Duct duct) { 29 | 30 | super(parent, duct); 31 | this.mainDuct = null; 32 | } 33 | 34 | @Override 35 | protected Void[] createTileCache() { 36 | 37 | return VOIDS; 38 | } 39 | 40 | @Override 41 | protected DuctUnitStructural[] createDuctCache() { 42 | 43 | return new DuctUnitStructural[6]; 44 | } 45 | 46 | @Nonnull 47 | @Override 48 | public DuctToken getToken() { 49 | 50 | return DuctToken.STRUCTURAL; 51 | } 52 | 53 | @Override 54 | public GridStructural createGrid() { 55 | 56 | return new GridStructural(world()); 57 | } 58 | 59 | @Override 60 | public Void cacheTile(@Nonnull TileEntity tile, byte side) { 61 | 62 | return null; 63 | } 64 | 65 | @SuppressWarnings ("unchecked") 66 | @Override 67 | public boolean canConnectToOtherDuct(DuctUnit adjDuct, byte side, byte oppositeSide) { 68 | 69 | if (this.mainDuct == null) { 70 | return true; 71 | } 72 | DuctUnit otherMainDuct = adjDuct.cast().mainDuct; 73 | if (otherMainDuct == null) { 74 | return true; 75 | } 76 | if (mainDuct.getToken() != otherMainDuct.getToken()) { 77 | return false; 78 | } 79 | return this.mainDuct.canConnectToOtherDuct(otherMainDuct, side, oppositeSide); 80 | } 81 | 82 | @Nonnull 83 | @Override 84 | protected BlockDuct.ConnectionType getConnectionTypeDuct(DuctUnitStructural duct, int side) { 85 | 86 | return BlockDuct.ConnectionType.STRUCTURE_CLEAN; 87 | } 88 | 89 | public void addRelays() { 90 | 91 | if (parent.attachmentData != null && grid != null) { 92 | for (Attachment attachment : parent.attachmentData.attachments) { 93 | if (attachment != null) { 94 | if (attachment.getId() == AttachmentRegistry.RELAY) { 95 | Relay signaller = (Relay) attachment; 96 | if (signaller.isInput()) { 97 | grid.addSignalInput(signaller); 98 | } else { 99 | grid.addSignalOutput(attachment); 100 | } 101 | } else if (attachment.respondsToSignalum()) { 102 | grid.addSignalOutput(attachment); 103 | } 104 | } 105 | } 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/gui/container/ContainerDuctConnection.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.gui.container; 2 | 3 | import cofh.lib.util.helpers.ItemHelper; 4 | import cofh.thermaldynamics.duct.attachments.ConnectionBase; 5 | import cofh.thermaldynamics.duct.attachments.filter.FilterLogic; 6 | import cofh.thermaldynamics.gui.slot.SlotFilter; 7 | import cofh.thermaldynamics.gui.slot.SlotFilterFluid; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | import net.minecraft.entity.player.InventoryPlayer; 10 | import net.minecraft.inventory.Slot; 11 | import net.minecraft.item.ItemStack; 12 | 13 | import java.util.LinkedList; 14 | 15 | public class ContainerDuctConnection extends ContainerAttachmentBase { 16 | 17 | private final ConnectionBase tile; 18 | public final FilterLogic filter; 19 | public LinkedList filterSlots = new LinkedList<>(); 20 | public final int gridWidth; 21 | public final int gridHeight; 22 | public final int gridX0; 23 | public final int gridY0; 24 | 25 | public ContainerDuctConnection(InventoryPlayer inventory, ConnectionBase tile) { 26 | 27 | super(inventory, tile); 28 | this.tile = tile; 29 | 30 | filter = tile.getFilter(); 31 | 32 | assert filter != null; 33 | 34 | int n = filter.getFilterStacks().length; 35 | gridWidth = filter.filterStackGridWidth(); 36 | gridHeight = n / gridWidth; 37 | 38 | gridX0 = 89 - gridWidth * 9; 39 | 40 | switch (gridHeight) { 41 | case 1: 42 | gridY0 = 38; 43 | break; 44 | case 2: 45 | gridY0 = 29; 46 | break; 47 | default: 48 | gridY0 = 20; 49 | break; 50 | } 51 | for (int i = 0; i < gridHeight; i++) { 52 | for (int j = 0; j < gridWidth; j++) { 53 | if (filter.isItem()) { 54 | filterSlots.add(((SlotFilter) addSlotToContainer(new SlotFilter(filter, j + i * gridWidth, gridX0 + j * 18, gridY0 + i * 18)))); 55 | } else { 56 | filterSlots.add(((SlotFilter) addSlotToContainer(new SlotFilterFluid(filter, j + i * gridWidth, gridX0 + j * 18, gridY0 + i * 18)))); 57 | } 58 | } 59 | } 60 | } 61 | 62 | @Override 63 | public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { 64 | 65 | Slot slot = inventorySlots.get(slotIndex); 66 | 67 | int invPlayer = 27; 68 | int invFull = invPlayer + 9; 69 | int invTile = invFull + filter.getFilterStacks().length; 70 | 71 | if (slot != null && slot.getHasStack()) { 72 | ItemStack stack = slot.getStack(); 73 | if (slotIndex < 0) { 74 | return null; 75 | } else if (slotIndex < invFull) { 76 | Slot k = null; 77 | for (int i = invFull; i < invTile; i++) { 78 | Slot slot1 = inventorySlots.get(i); 79 | if (!slot1.getHasStack()) { 80 | if (k == null) { 81 | k = slot1; 82 | } 83 | } else { 84 | if (ItemHelper.itemsEqualWithMetadata(slot1.getStack(), stack)) { 85 | return null; 86 | } 87 | } 88 | } 89 | if (k != null) { 90 | k.putStack(stack.copy()); 91 | } 92 | 93 | return null; 94 | } else { 95 | slot.putStack(null); 96 | slot.onSlotChanged(); 97 | 98 | } 99 | } 100 | return null; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileDuctFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.api.energy.IEnergyReceiver; 4 | import cofh.thermaldynamics.duct.Duct; 5 | import cofh.thermaldynamics.duct.TDDucts; 6 | import cofh.thermaldynamics.duct.energy.DuctUnitEnergy; 7 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluid; 8 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluidSuper; 9 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluidTemperate; 10 | 11 | public abstract class TileDuctFluid extends TileGridStructureBase { 12 | 13 | public static final int NODE_TRANSFER = 4000; 14 | 15 | public TileDuctFluid(Duct duct) { 16 | 17 | this(duct, true); 18 | } 19 | 20 | public TileDuctFluid(Duct duct, boolean addDefault) { 21 | 22 | if (addDefault) { 23 | addDuctUnits(DuctToken.FLUID, new DuctUnitFluid(this, duct)); 24 | } 25 | } 26 | 27 | @Override 28 | protected DuctToken getPrimaryDuctToken() { 29 | 30 | return DuctToken.FLUID; 31 | } 32 | 33 | public static class Basic extends TileDuctFluid { 34 | 35 | public Basic(Duct duct) { 36 | 37 | super(duct, false); 38 | addDuctUnits(DuctToken.FLUID, new DuctUnitFluidTemperate(this, duct)); 39 | } 40 | 41 | public static class Transparent extends Basic { 42 | 43 | public Transparent() { 44 | 45 | super(TDDucts.fluidBasic); 46 | } 47 | } 48 | 49 | public static class Opaque extends Basic { 50 | 51 | public Opaque() { 52 | 53 | super(TDDucts.fluidBasicOpaque); 54 | } 55 | } 56 | } 57 | 58 | public static class Hardened extends TileDuctFluid { 59 | 60 | public Hardened(Duct duct) { 61 | 62 | super(duct); 63 | } 64 | 65 | public static class Transparent extends Hardened { 66 | 67 | public Transparent() { 68 | 69 | super(TDDucts.fluidHardened); 70 | } 71 | } 72 | 73 | public static class Opaque extends Hardened { 74 | 75 | public Opaque() { 76 | 77 | super(TDDucts.fluidHardenedOpaque); 78 | } 79 | } 80 | } 81 | 82 | public static class Energy extends TileDuctFluid implements IEnergyReceiver { 83 | 84 | public Energy(Duct duct) { 85 | 86 | super(duct); 87 | addDuctUnits(DuctToken.ENERGY, new DuctUnitEnergy(this, duct, NODE_TRANSFER, NODE_TRANSFER * 5)); 88 | } 89 | 90 | public static class Transparent extends Energy { 91 | 92 | public Transparent() { 93 | 94 | super(TDDucts.fluidEnergy); 95 | } 96 | } 97 | 98 | public static class Opaque extends Energy { 99 | 100 | public Opaque() { 101 | 102 | super(TDDucts.fluidEnergyOpaque); 103 | } 104 | } 105 | } 106 | 107 | public static class Super extends TileDuctFluid { 108 | 109 | public Super(Duct duct) { 110 | 111 | super(duct, false); 112 | addDuctUnits(DuctToken.FLUID, new DuctUnitFluidSuper(this, duct)); 113 | } 114 | 115 | public static class Transparent extends Super { 116 | 117 | public Transparent() { 118 | 119 | super(TDDucts.fluidSuper); 120 | } 121 | } 122 | 123 | public static class Opaque extends Super { 124 | 125 | public Opaque() { 126 | 127 | super(TDDucts.fluidSuperOpaque); 128 | } 129 | } 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/tiles/TileGridStructureBase.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.tiles; 2 | 3 | import cofh.thermaldynamics.duct.Duct; 4 | import cofh.thermaldynamics.duct.DuctUnitStructural; 5 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 6 | import cofh.thermaldynamics.util.TickHandler; 7 | import com.google.common.collect.ImmutableSortedMap; 8 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 9 | 10 | import javax.annotation.Nullable; 11 | import javax.annotation.OverridingMethodsMustInvokeSuper; 12 | import java.util.Map; 13 | 14 | public abstract class TileGridStructureBase extends TileGrid { 15 | 16 | private Map ducts = null; 17 | 18 | public TileGridStructureBase() { 19 | 20 | } 21 | 22 | public T addDuctUnits(DuctToken token, DuctUnit unit) { 23 | 24 | ImmutableSortedMap.Builder builder = ImmutableSortedMap.naturalOrder(); 25 | if (ducts != null) { 26 | for (Map.Entry entry : ducts.entrySet()) { 27 | if (!entry.getKey().equals(token)) { 28 | builder.put(entry.getKey(), entry.getValue()); 29 | } 30 | } 31 | } 32 | builder.put(token, unit); 33 | this.ducts = builder.build(); 34 | return (T) this; 35 | } 36 | 37 | @SuppressWarnings ("unchecked") 38 | @Nullable 39 | @Override 40 | @OverridingMethodsMustInvokeSuper 41 | public , G extends MultiBlockGrid, C> T getDuct(DuctToken token) { 42 | 43 | DuctUnit ductUnit = ducts.get(token); 44 | if (ductUnit == null && token == DuctToken.STRUCTURAL) { 45 | ImmutableSortedMap.Builder builder = ImmutableSortedMap.naturalOrder(); 46 | builder.putAll(ducts); 47 | DuctUnitStructural structural; 48 | builder.put(DuctToken.STRUCTURAL, structural = new DuctUnitStructural(this, ducts.get(getPrimaryDuctToken()))); 49 | TickHandler.addMultiBlockToNextTickBatch(structural); 50 | ducts = builder.build(); 51 | return (T) structural; 52 | } 53 | return (T) ductUnit; 54 | } 55 | 56 | protected abstract DuctToken getPrimaryDuctToken(); 57 | 58 | public DuctUnit getPrimaryDuctUnit() { 59 | 60 | return getDuct(getPrimaryDuctToken()); 61 | } 62 | 63 | @Override 64 | public Iterable getDuctUnits() { 65 | 66 | return ducts.values(); 67 | } 68 | 69 | @Nullable 70 | public DuctUnitStructural getStructureUnitIfPresent() { 71 | 72 | return (DuctUnitStructural) ducts.get(DuctToken.STRUCTURAL); 73 | } 74 | 75 | @Override 76 | public boolean isPowered() { 77 | 78 | DuctUnitStructural ductUnit = (DuctUnitStructural) ducts.get(DuctToken.STRUCTURAL); 79 | if (ductUnit != null && ductUnit.grid != null && ductUnit.grid.rs != null) { 80 | if (ductUnit.grid.rs.redstoneLevel > 0) { 81 | return true; 82 | } 83 | } 84 | 85 | return super.isPowered(); 86 | } 87 | 88 | @Override 89 | public Duct getDuctType() { 90 | 91 | return getPrimaryDuctUnit().getDuctType(); 92 | } 93 | 94 | @Override 95 | public TextureAtlasSprite getBaseIcon() { 96 | 97 | return getPrimaryDuctUnit().getBaseIcon(); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/plugins/jei/CoverRecipeCategory.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.plugins.jei; 2 | 3 | import cofh.lib.util.helpers.StringHelper; 4 | import cofh.thermaldynamics.item.ItemCover; 5 | import mezz.jei.api.IGuiHelper; 6 | import mezz.jei.api.IJeiHelpers; 7 | import mezz.jei.api.IModRegistry; 8 | import mezz.jei.api.gui.*; 9 | import mezz.jei.api.ingredients.IIngredients; 10 | import mezz.jei.api.recipe.BlankRecipeCategory; 11 | import net.minecraft.init.Blocks; 12 | import net.minecraft.item.ItemStack; 13 | import net.minecraft.util.ResourceLocation; 14 | 15 | import java.util.LinkedList; 16 | import java.util.List; 17 | 18 | public class CoverRecipeCategory extends BlankRecipeCategory { 19 | 20 | private static final int craftOutputSlot = 0; 21 | private static final int craftInputSlot1 = 1; 22 | 23 | public static final int width = 116; 24 | public static final int height = 54; 25 | 26 | public static void initialize(IModRegistry registry) { 27 | 28 | IJeiHelpers jeiHelpers = registry.getJeiHelpers(); 29 | IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); 30 | 31 | registry.addRecipeCategories(new CoverRecipeCategory(guiHelper)); 32 | registry.addRecipeHandlers(new CoverRecipeHandler()); 33 | registry.addRecipes(getRecipes()); 34 | registry.addRecipeCategoryCraftingItem(new ItemStack(Blocks.CRAFTING_TABLE), RecipeUidsTD.COVER); 35 | } 36 | 37 | public static List getRecipes() { 38 | 39 | List recipes = new LinkedList<>(); 40 | 41 | for (ItemStack stack : ItemCover.getCoverList()) { 42 | recipes.add(new CoverRecipeWrapper(stack)); 43 | } 44 | return recipes; 45 | } 46 | 47 | private final IDrawableStatic background; 48 | private final String localizedName; 49 | private final ICraftingGridHelper craftingGridHelper; 50 | 51 | public CoverRecipeCategory(IGuiHelper guiHelper) { 52 | 53 | ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/crafting_table.png"); 54 | 55 | background = guiHelper.createDrawable(location, 29, 16, width, height); 56 | localizedName = StringHelper.localize("recipe.thermaldynamics.covers"); 57 | craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot); 58 | } 59 | 60 | @Override 61 | public String getUid() { 62 | 63 | return RecipeUidsTD.COVER; 64 | } 65 | 66 | @Override 67 | public String getTitle() { 68 | 69 | return localizedName; 70 | } 71 | 72 | @Override 73 | public IDrawable getBackground() { 74 | 75 | return background; 76 | } 77 | 78 | @Override 79 | public void setRecipe(IRecipeLayout recipeLayout, CoverRecipeWrapper recipeWrapper, IIngredients ingredients) { 80 | 81 | IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); 82 | guiItemStacks.init(craftOutputSlot, false, 94, 18); 83 | 84 | for (int y = 0; y < 3; ++y) { 85 | for (int x = 0; x < 3; ++x) { 86 | int index = craftInputSlot1 + x + (y * 3); 87 | guiItemStacks.init(index, true, x * 18, y * 18); 88 | } 89 | } 90 | craftingGridHelper.setInputStacks(guiItemStacks, ingredients.getInputs(ItemStack.class)); 91 | craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class)); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/attachments/servo/ServoFluid.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.attachments.servo; 2 | 3 | import cofh.thermaldynamics.duct.AttachmentRegistry; 4 | import cofh.thermaldynamics.duct.Duct; 5 | import cofh.thermaldynamics.duct.attachments.filter.FilterLogic; 6 | import cofh.thermaldynamics.duct.fluid.DuctUnitFluid; 7 | import cofh.thermaldynamics.duct.fluid.FluidTankGrid; 8 | import cofh.thermaldynamics.duct.tiles.DuctToken; 9 | import cofh.thermaldynamics.duct.tiles.TileGrid; 10 | import net.minecraft.tileentity.TileEntity; 11 | import net.minecraft.util.EnumFacing; 12 | import net.minecraftforge.fluids.FluidStack; 13 | import net.minecraftforge.fluids.capability.CapabilityFluidHandler; 14 | import net.minecraftforge.fluids.capability.IFluidHandler; 15 | 16 | public class ServoFluid extends ServoBase { 17 | 18 | public static float[] throttle = { 0.5F, 0.75F, 1F, 1.5F, 2F }; 19 | 20 | public DuctUnitFluid fluidDuct; 21 | 22 | @Override 23 | public int getId() { 24 | 25 | return AttachmentRegistry.SERVO_FLUID; 26 | } 27 | 28 | public ServoFluid(TileGrid tile, byte side) { 29 | 30 | super(tile, side); 31 | fluidDuct = tile.getDuct(DuctToken.FLUID); 32 | } 33 | 34 | public ServoFluid(TileGrid tile, byte side, int type) { 35 | 36 | super(tile, side, type); 37 | fluidDuct = tile.getDuct(DuctToken.FLUID); 38 | } 39 | 40 | @Override 41 | public DuctToken tickUnit() { 42 | 43 | return DuctToken.FLUID; 44 | } 45 | 46 | @Override 47 | public void clearCache() { 48 | 49 | myTile = null; 50 | } 51 | 52 | @Override 53 | public void cacheTile(TileEntity tile) { 54 | 55 | myTile = tile; 56 | } 57 | 58 | @Override 59 | public boolean isValidTile(TileEntity tile) { 60 | 61 | return tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.VALUES[side ^ 1]); 62 | } 63 | 64 | @Override 65 | public boolean canAddToTile(TileGrid tile) { 66 | 67 | return fluidDuct != null; 68 | } 69 | 70 | @Override 71 | public void tick(int pass) { 72 | 73 | super.tick(pass); 74 | 75 | if (pass != 1 || fluidDuct.getGrid() == null || !isPowered || !isValidInput) { 76 | return; 77 | } 78 | FluidTankGrid myTank = fluidDuct.getGrid().myTank; 79 | int maxInput = (int) Math.ceil(myTank.fluidThroughput * throttle[type]); 80 | IFluidHandler ductHandler = fluidDuct.getFluidCapability(EnumFacing.VALUES[side]); 81 | 82 | if (ductHandler == null) { 83 | return; 84 | } 85 | IFluidHandler tileHandler = getMyTile(); 86 | 87 | if (tileHandler == null) { 88 | return; 89 | } 90 | maxInput = myTank.fill(tileHandler.drain(maxInput, false), false); 91 | myTank.fill(tileHandler.drain(maxInput, true), true); 92 | } 93 | 94 | public boolean fluidPassesFiltering(FluidStack theFluid) { 95 | 96 | return theFluid != null && filter.allowFluid(theFluid); 97 | } 98 | 99 | @Override 100 | public FilterLogic createFilterLogic() { 101 | 102 | return new FilterLogic(type, Duct.Type.FLUID, this); 103 | } 104 | 105 | public IFluidHandler getMyTile() { 106 | 107 | if (myTile == null) { 108 | return null; 109 | } 110 | return myTile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.VALUES[side ^ 1]); 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/fluid/DuctUnitFluidSuper.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.fluid; 2 | 3 | import cofh.thermaldynamics.duct.Duct; 4 | import cofh.thermaldynamics.duct.TDDucts; 5 | import cofh.thermaldynamics.duct.tiles.DuctUnit; 6 | import cofh.thermaldynamics.duct.tiles.TileGrid; 7 | import net.minecraft.util.EnumFacing; 8 | import net.minecraftforge.fluids.FluidStack; 9 | import net.minecraftforge.fluids.capability.CapabilityFluidHandler; 10 | import net.minecraftforge.fluids.capability.FluidTankProperties; 11 | import net.minecraftforge.fluids.capability.IFluidHandler; 12 | import net.minecraftforge.fluids.capability.IFluidTankProperties; 13 | import net.minecraftforge.fluids.capability.templates.EmptyFluidHandler; 14 | 15 | import javax.annotation.Nullable; 16 | 17 | public class DuctUnitFluidSuper extends DuctUnitFluid { 18 | 19 | public DuctUnitFluidSuper(TileGrid parent, Duct duct) { 20 | 21 | super(parent, duct); 22 | } 23 | 24 | @Override 25 | public GridFluidSuper createGrid() { 26 | 27 | return new GridFluidSuper(world()); 28 | } 29 | 30 | @Override 31 | public boolean canConnectToOtherDuct(DuctUnit adjDuct, byte side, byte oppositeSide) { 32 | 33 | Duct ductType = adjDuct.getDuctType(); 34 | return (ductType == TDDucts.fluidSuper || ductType == TDDucts.fluidSuperOpaque) && super.canConnectToOtherDuct(adjDuct, side, oppositeSide); 35 | } 36 | 37 | @Override 38 | public IFluidHandler getFluidCapability(EnumFacing from) { 39 | 40 | GridFluidSuper gridFluidSuper = (GridFluidSuper) this.grid; 41 | 42 | if (gridFluidSuper == null) { 43 | return EmptyFluidHandler.INSTANCE; 44 | } 45 | return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(new IFluidHandler() { 46 | 47 | @Override 48 | public IFluidTankProperties[] getTankProperties() { 49 | 50 | FluidStack info = grid != null ? grid.myTank.getInfo().fluid : null; 51 | int capacity = grid != null ? grid.myTank.getInfo().capacity : 0; 52 | return new IFluidTankProperties[] { new FluidTankProperties(info, capacity, isOpen(from), isOpen(from)) }; 53 | } 54 | 55 | @Override 56 | public int fill(FluidStack resource, boolean doFill) { 57 | 58 | if (resource != null && isOpen(from) && matchesFilter(from, resource)) { 59 | return gridFluidSuper.sendFluid(resource, !doFill); 60 | } 61 | return 0; 62 | } 63 | 64 | @Nullable 65 | @Override 66 | public FluidStack drain(FluidStack resource, boolean doDrain) { 67 | 68 | if (isOpen(from)) { 69 | return grid.myTank.drain(resource, doDrain); 70 | } 71 | return null; 72 | } 73 | 74 | @Nullable 75 | @Override 76 | public FluidStack drain(int maxDrain, boolean doDrain) { 77 | 78 | if (isOpen(from)) { 79 | return grid.myTank.drain(maxDrain, doDrain); 80 | } 81 | return null; 82 | } 83 | }); 84 | } 85 | // 86 | // @Override 87 | // @SideOnly (Side.CLIENT) 88 | // public CoverHoleRender.ITransformer[] getHollowMask(byte side) { 89 | // 90 | // BlockDuct.ConnectionType connectionType = getRenderConnectionType(side); 91 | // if (connectionType == BlockDuct.ConnectionType.TILECONNECTION) { 92 | // return CoverHoleRender.hollowDuctTile; 93 | // } else if (connectionType == BlockDuct.ConnectionType.NONE) { 94 | // return null; 95 | // } else { 96 | // return CoverHoleRender.hollowDuctLarge; 97 | // } 98 | // } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/item/SimulatedInv.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.item; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraftforge.items.IItemHandler; 6 | import net.minecraftforge.items.ItemStackHandler; 7 | import net.minecraftforge.items.wrapper.InvWrapper; 8 | 9 | public class SimulatedInv implements IItemHandler { 10 | 11 | public static final int REBUILD_THRESHOLD = 128; 12 | public static SimulatedInv INSTANCE = new SimulatedInv(); 13 | IItemHandler originalLogic; 14 | IItemHandler slotHandler; 15 | ItemStack[] items; 16 | int size; 17 | 18 | public SimulatedInv() { 19 | 20 | } 21 | 22 | public SimulatedInv(IInventory target) { 23 | 24 | setTarget(new InvWrapper(target)); 25 | } 26 | 27 | public static SimulatedInv wrapHandler(IItemHandler handler) { 28 | 29 | return INSTANCE.setTarget(handler); 30 | } 31 | 32 | public static SimulatedInv wrapInv(IInventory inventory) { 33 | 34 | return INSTANCE.setTarget(new InvWrapper(inventory)); 35 | } 36 | 37 | public void clear() { 38 | 39 | this.originalLogic = null; 40 | } 41 | 42 | public SimulatedInv setTarget(IItemHandler target) { 43 | 44 | originalLogic = target; 45 | 46 | size = target.getSlots(); 47 | 48 | if (items == null || items.length < size || (size < REBUILD_THRESHOLD && items.length >= REBUILD_THRESHOLD)) { 49 | items = new ItemStack[target.getSlots()]; 50 | this.slotHandler = new ItemStackHandler(items); 51 | } 52 | ItemStack stackInSlot; 53 | for (int i = 0; i < size; i++) { 54 | stackInSlot = target.getStackInSlot(i); 55 | items[i] = stackInSlot != null ? stackInSlot.copy() : null; 56 | } 57 | return this; 58 | } 59 | 60 | @Override 61 | public int getSlots() { 62 | 63 | return size; 64 | } 65 | 66 | @Override 67 | public ItemStack getStackInSlot(int i) { 68 | 69 | return items[i]; 70 | } 71 | 72 | @Override 73 | public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { 74 | 75 | if (stack == null || stack.stackSize == 0) { 76 | return null; 77 | } 78 | 79 | int originalStackSize = stack.stackSize; 80 | ItemStack copy = stack.copy(); 81 | int maxStackSize = copy.getMaxStackSize(); 82 | copy.stackSize = maxStackSize; 83 | ItemStack insertItem = originalLogic.insertItem(slot, copy, true); 84 | 85 | // rejected 86 | if (insertItem == copy) { 87 | return stack; 88 | } 89 | 90 | int insertable = maxStackSize - (insertItem != null ? insertItem.stackSize : 0); 91 | 92 | if (insertable == 0) { 93 | return stack; // rejected 94 | } 95 | 96 | if (insertable >= originalStackSize) // whole stack would have been accepted 97 | { 98 | return slotHandler.insertItem(slot, stack, simulate); 99 | } 100 | 101 | // only partial stack would have been accepted 102 | copy.stackSize = insertable; 103 | 104 | int remainderStackSize = originalStackSize - insertable; 105 | 106 | ItemStack simInsertStack = slotHandler.insertItem(slot, copy, simulate); 107 | 108 | if (simInsertStack == null || simInsertStack.stackSize == 0) { 109 | copy.stackSize = remainderStackSize; 110 | } else { 111 | copy.stackSize = remainderStackSize + simInsertStack.stackSize; 112 | } 113 | return copy; 114 | } 115 | 116 | @Override 117 | public ItemStack extractItem(int slot, int amount, boolean simulate) { 118 | 119 | throw new UnsupportedOperationException(); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/GridStructural.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct; 2 | 3 | import cofh.thermaldynamics.duct.attachments.relay.Relay; 4 | import cofh.thermaldynamics.multiblock.IGridTile; 5 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 6 | import cofh.thermaldynamics.util.WorldGridList; 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.util.text.ITextComponent; 9 | import net.minecraft.world.World; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public class GridStructural extends MultiBlockGrid { 15 | 16 | public GridStructural(WorldGridList worldGrid) { 17 | 18 | super(worldGrid); 19 | } 20 | 21 | public GridStructural(World worldObj) { 22 | 23 | super(worldObj); 24 | } 25 | 26 | @Override 27 | public boolean canAddBlock(IGridTile aBlock) { 28 | 29 | return true; 30 | } 31 | 32 | public boolean signalsUpToDate; 33 | 34 | public RedstoneControl rs; 35 | 36 | public void tickGrid() { 37 | 38 | if (rs != null && rs.nextRedstoneLevel != -128) { 39 | rs.redstoneLevel = rs.nextRedstoneLevel; 40 | rs.nextRedstoneLevel = -128; 41 | 42 | ArrayList signallersOut = rs.relaysOut; 43 | if (signallersOut != null) { 44 | for (Attachment output : signallersOut) { 45 | output.checkSignal(); 46 | } 47 | } 48 | } 49 | 50 | if (signalsUpToDate) { 51 | return; 52 | } 53 | 54 | signalsUpToDate = true; 55 | 56 | if (rs == null || rs.relaysIn == null) { 57 | if (rs != null) { 58 | rs.relaysOut = null; 59 | } 60 | for (DuctUnitStructural multiBlock : nodeSet) { 61 | multiBlock.addRelays(); 62 | } 63 | for (DuctUnitStructural multiBlock : idleSet) { 64 | multiBlock.addRelays(); 65 | } 66 | } 67 | 68 | if (rs == null) { 69 | return; 70 | } 71 | 72 | if (rs.relaysIn == null) { 73 | if (rs.relaysOut == null) { 74 | rs = null; 75 | return; 76 | } else { 77 | rs.nextRedstoneLevel = 0; 78 | } 79 | return; 80 | } 81 | 82 | int powered = 0; 83 | for (Relay signaller : rs.relaysIn) { 84 | powered = Math.max(powered, signaller.getPowerLevel()); 85 | if (powered == 15) { 86 | break; 87 | } 88 | 89 | } 90 | 91 | rs.nextRedstoneLevel = (byte) powered; 92 | 93 | } 94 | 95 | public void addSignalInput(Relay signaller) { 96 | 97 | if (signaller.isInput()) { 98 | if (rs == null) { 99 | rs = new RedstoneControl(); 100 | } 101 | if (rs.relaysIn == null) { 102 | rs.relaysIn = new ArrayList<>(); 103 | } 104 | rs.relaysIn.add(signaller); 105 | } 106 | } 107 | 108 | public void addSignalOutput(Attachment attachment) { 109 | 110 | if (rs == null) { 111 | rs = new RedstoneControl(); 112 | } 113 | if (rs.relaysOut == null) { 114 | rs.relaysOut = new ArrayList<>(); 115 | } 116 | rs.relaysOut.add(attachment); 117 | } 118 | 119 | public void resetRelays() { 120 | 121 | if (rs != null) { 122 | rs.relaysIn = null; 123 | rs.relaysOut = null; 124 | } 125 | signalsUpToDate = false; 126 | } 127 | 128 | public void onMinorGridChange() { 129 | 130 | resetRelays(); 131 | } 132 | 133 | public void onMajorGridChange() { 134 | 135 | resetRelays(); 136 | } 137 | 138 | @Override 139 | public void addInfo(List info, EntityPlayer player, boolean debug) { 140 | 141 | if (rs != null) { 142 | int r = rs.redstoneLevel; 143 | if (rs.nextRedstoneLevel != -128) { 144 | r = rs.nextRedstoneLevel; 145 | } 146 | addInfo(info, "redstone", r); 147 | } 148 | super.addInfo(info, player, debug); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/render/TextureTransparent.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.render; 2 | 3 | import codechicken.lib.texture.CustomIResource; 4 | import cofh.thermaldynamics.ThermalDynamics; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.renderer.texture.PngSizeInfo; 7 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 8 | import net.minecraft.client.renderer.texture.TextureMap; 9 | import net.minecraft.client.resources.IResource; 10 | import net.minecraft.client.resources.IResourceManager; 11 | import net.minecraft.client.resources.data.AnimationMetadataSection; 12 | import net.minecraft.client.settings.GameSettings; 13 | import net.minecraft.util.ResourceLocation; 14 | 15 | import javax.imageio.ImageIO; 16 | import java.awt.image.BufferedImage; 17 | import java.io.IOException; 18 | 19 | public class TextureTransparent extends TextureAtlasSprite { 20 | 21 | byte transparency; 22 | ResourceLocation location; 23 | 24 | public static TextureAtlasSprite registerTransparentIcon(TextureMap textureMap, String name, byte transparency) { 25 | 26 | if (transparency == (byte) 255) { 27 | return textureMap.registerSprite(new ResourceLocation(name)); 28 | } 29 | 30 | TextureAtlasSprite icon = textureMap.getTextureExtry(transformedName(name, transparency)); 31 | if (icon == null) { 32 | icon = new TextureTransparent(name, transparency); 33 | textureMap.setTextureEntry(icon); 34 | } 35 | return icon; 36 | } 37 | 38 | protected TextureTransparent(String icon, byte transparency) { 39 | 40 | super(transformedName(icon, transparency)); 41 | this.transparency = transparency; 42 | 43 | String s1 = "minecraft"; 44 | String s2 = icon; 45 | int i = icon.indexOf(58); 46 | 47 | if (i >= 0) { 48 | s2 = icon.substring(i + 1, icon.length()); 49 | if (i > 1) { 50 | s1 = icon.substring(0, i); 51 | } 52 | } 53 | 54 | this.location = new ResourceLocation(s1, "textures/" + s2 + ".png"); 55 | } 56 | 57 | private static String transformedName(String icon, byte transparency) { 58 | 59 | return icon + "_trans_" + transparency; 60 | } 61 | 62 | @Override 63 | public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { 64 | 65 | return true; 66 | } 67 | 68 | @Override 69 | public boolean load(IResourceManager p_110571_1_, ResourceLocation location) { 70 | 71 | GameSettings settings = Minecraft.getMinecraft().gameSettings; 72 | try { 73 | IResource iresource = p_110571_1_.getResource(this.location); 74 | 75 | BufferedImage image = ImageIO.read(iresource.getInputStream()); 76 | 77 | int data[] = new int[image.getWidth() * image.getHeight()]; 78 | image.getRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, image.getWidth()); 79 | 80 | for (int i = 0; i < data.length; i++) { 81 | if ((data[i] & 0xFF000000) != 0) { 82 | data[i] = (data[i] & 0x00FFFFFF) | (transparency << 24); 83 | } 84 | } 85 | 86 | image.setRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, image.getWidth()); 87 | 88 | AnimationMetadataSection metadataSection = iresource.getMetadata("animation"); 89 | 90 | PngSizeInfo sizeInfo = PngSizeInfo.makeFromResource(new CustomIResource(this.location, image, iresource)); 91 | CustomIResource resource = new CustomIResource(this.location, image, iresource); 92 | 93 | loadSprite(sizeInfo, metadataSection != null); 94 | loadSpriteFrames(resource, settings.mipmapLevels + 1); 95 | 96 | } catch (IOException ioexception1) { 97 | ThermalDynamics.LOG.error("Using missing texture, unable to load " + this.location, ioexception1); 98 | return true; 99 | } 100 | 101 | return false; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/util/WorldGridList.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.util; 2 | 3 | import cofh.thermaldynamics.multiblock.IGridTile; 4 | import cofh.thermaldynamics.multiblock.IOccasionalTick; 5 | import cofh.thermaldynamics.multiblock.ISingleTick; 6 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 7 | import net.minecraft.world.World; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Iterator; 11 | import java.util.LinkedHashSet; 12 | 13 | public class WorldGridList { 14 | 15 | public LinkedHashSet tickingGrids = new LinkedHashSet<>(); 16 | public LinkedHashSet tickingBlocks = new LinkedHashSet<>(); 17 | public ArrayList> occasionalTickingBlocks = new ArrayList<>(); 18 | 19 | public LinkedHashSet gridsToRecreate = new LinkedHashSet<>(); 20 | public LinkedHashSet newGrids = new LinkedHashSet<>(); 21 | public LinkedHashSet oldGrids = new LinkedHashSet<>(); 22 | 23 | public World worldObj; 24 | 25 | public WorldGridList(World world) { 26 | 27 | this.worldObj = world; 28 | } 29 | 30 | public void tickStart() { 31 | 32 | if (!newGrids.isEmpty()) { 33 | tickingGrids.addAll(newGrids); 34 | newGrids.clear(); 35 | } 36 | if (!oldGrids.isEmpty()) { 37 | tickingGrids.removeAll(oldGrids); 38 | oldGrids.clear(); 39 | } 40 | } 41 | 42 | public void tickEnd() { 43 | 44 | if (!gridsToRecreate.isEmpty()) { 45 | tickingGrids.removeAll(gridsToRecreate); 46 | for (MultiBlockGrid grid : gridsToRecreate) { 47 | for (IGridTile multiBlock : grid.idleSet) { 48 | tickingBlocks.add(multiBlock); 49 | grid.destroyNode(multiBlock); 50 | } 51 | 52 | for (IGridTile multiBlock : grid.nodeSet) { 53 | tickingBlocks.add(multiBlock); 54 | grid.destroyNode(multiBlock); 55 | } 56 | } 57 | gridsToRecreate.clear(); 58 | } 59 | ArrayList mtickinggrids = new ArrayList<>(); 60 | 61 | for (MultiBlockGrid grid : tickingGrids) { 62 | grid.tickGrid(); 63 | if (grid.isTickProcessing()) { 64 | mtickinggrids.add(grid); 65 | } 66 | } 67 | if (!mtickinggrids.isEmpty()) { 68 | long deadline = System.nanoTime() + 100000L; 69 | for (int i = 0, e = mtickinggrids.size(), c = 0; i < e; ++i) { 70 | mtickinggrids.get(i).doTickProcessing(deadline); 71 | if (c++ == 7) { 72 | if (System.nanoTime() > deadline) { 73 | break; 74 | } 75 | c = 0; 76 | } 77 | } 78 | } 79 | if (!tickingBlocks.isEmpty()) { 80 | Iterator iter = tickingBlocks.iterator(); 81 | while (iter.hasNext()) { 82 | ISingleTick block = iter.next(); 83 | if (block.existsYet()) { 84 | block.singleTick(); 85 | iter.remove(); 86 | } else if (block.isOutdated()) { 87 | iter.remove(); 88 | } 89 | } 90 | } 91 | 92 | int lastNonEmptyList = -1; 93 | for (int i = 0; i < occasionalTickingBlocks.size(); i++) { 94 | LinkedHashSet list = occasionalTickingBlocks.get(i); 95 | for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { 96 | IOccasionalTick iOccasionalTick = iterator.next(); 97 | if (!iOccasionalTick.occasionalTick(i)) { 98 | iterator.remove(); 99 | } 100 | } 101 | if (!list.isEmpty()) { 102 | lastNonEmptyList = i; 103 | } 104 | } 105 | if (lastNonEmptyList == -1) { 106 | occasionalTickingBlocks.clear(); 107 | } else if ((lastNonEmptyList + 1) < occasionalTickingBlocks.size()) { 108 | for (int i = occasionalTickingBlocks.size() - 1; i >= lastNonEmptyList + 1; i--) { 109 | occasionalTickingBlocks.remove(i); 110 | } 111 | } 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/render/item/RenderItemCover.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.render.item; 2 | 3 | import codechicken.lib.render.CCRenderState; 4 | import codechicken.lib.render.item.IItemRenderer; 5 | import codechicken.lib.util.TransformUtils; 6 | import codechicken.lib.vec.Cuboid6; 7 | import cofh.thermaldynamics.duct.attachments.cover.Cover; 8 | import cofh.thermaldynamics.duct.attachments.cover.CoverHelper; 9 | import cofh.thermaldynamics.duct.attachments.cover.CoverRenderer; 10 | import net.minecraft.block.Block; 11 | import net.minecraft.block.state.IBlockState; 12 | import net.minecraft.client.renderer.block.model.BakedQuad; 13 | import net.minecraft.client.renderer.block.model.IBakedModel; 14 | import net.minecraft.client.renderer.block.model.ItemCameraTransforms; 15 | import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; 16 | import net.minecraft.client.renderer.block.model.ItemOverrideList; 17 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 18 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 19 | import net.minecraft.init.Blocks; 20 | import net.minecraft.item.ItemStack; 21 | import net.minecraft.nbt.NBTTagCompound; 22 | import net.minecraft.util.EnumFacing; 23 | import net.minecraftforge.client.model.IPerspectiveAwareModel; 24 | import org.apache.commons.lang3.tuple.Pair; 25 | import org.lwjgl.opengl.GL11; 26 | 27 | import javax.annotation.Nullable; 28 | import javax.vecmath.Matrix4f; 29 | import java.util.ArrayList; 30 | import java.util.List; 31 | 32 | public class RenderItemCover implements IItemRenderer, IPerspectiveAwareModel { 33 | 34 | public static IItemRenderer instance = new RenderItemCover(); 35 | 36 | @Override 37 | public void renderItem(ItemStack stack) { 38 | 39 | NBTTagCompound nbt = stack.getTagCompound(); 40 | if (nbt == null || !nbt.hasKey("Meta", 1) || !nbt.hasKey("Block", 8)) { 41 | return; 42 | } 43 | int meta = nbt.getByte("Meta"); 44 | Block block = Block.getBlockFromName(nbt.getString("Block")); 45 | 46 | if (block == Blocks.AIR || meta < 0 || meta >= 16 || !CoverHelper.isValid(block, meta)) { 47 | nbt.removeTag("Meta"); 48 | nbt.removeTag("Block"); 49 | if (nbt.hasNoTags()) { 50 | stack.setTagCompound(null); 51 | } 52 | } 53 | 54 | EnumFacing side = EnumFacing.NORTH; 55 | CCRenderState ccrs = CCRenderState.instance(); 56 | ccrs.reset(); 57 | ccrs.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM); 58 | Cuboid6 bounds = Cover.bounds[side.ordinal()]; 59 | CoverRenderer.renderItemCover(ccrs, side.ordinal(), block.getStateFromMeta(meta), bounds); 60 | ccrs.draw(); 61 | 62 | } 63 | 64 | @Override 65 | public Pair handlePerspective(TransformType cameraTransformType) { 66 | 67 | return MapWrapper.handlePerspective(this, TransformUtils.DEFAULT_BLOCK.getTransforms(), cameraTransformType); 68 | } 69 | 70 | @Override 71 | public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { 72 | 73 | return new ArrayList<>(); 74 | } 75 | 76 | @Override 77 | public boolean isAmbientOcclusion() { 78 | 79 | return false; 80 | } 81 | 82 | @Override 83 | public boolean isGui3d() { 84 | 85 | return false; 86 | } 87 | 88 | @Override 89 | public boolean isBuiltInRenderer() { 90 | 91 | return true; 92 | } 93 | 94 | @Override 95 | public TextureAtlasSprite getParticleTexture() { 96 | 97 | return null; 98 | } 99 | 100 | @Override 101 | public ItemCameraTransforms getItemCameraTransforms() { 102 | 103 | return ItemCameraTransforms.DEFAULT; 104 | } 105 | 106 | @Override 107 | public ItemOverrideList getOverrides() { 108 | 109 | return ItemOverrideList.NONE; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/cofh/thermaldynamics/duct/light/GridLight.java: -------------------------------------------------------------------------------- 1 | package cofh.thermaldynamics.duct.light; 2 | 3 | import cofh.core.network.PacketCoFHBase; 4 | import cofh.core.network.PacketHandler; 5 | import cofh.lib.util.ChunkCoord; 6 | import cofh.thermaldynamics.multiblock.IGridTile; 7 | import cofh.thermaldynamics.multiblock.MultiBlockGrid; 8 | import cofh.thermaldynamics.util.WorldGridList; 9 | import com.google.common.collect.Iterables; 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.entity.player.EntityPlayerMP; 12 | import net.minecraft.server.management.PlayerChunkMap; 13 | import net.minecraft.server.management.PlayerChunkMapEntry; 14 | import net.minecraft.world.World; 15 | import net.minecraft.world.WorldServer; 16 | 17 | import java.util.HashSet; 18 | 19 | public class GridLight extends MultiBlockGrid { 20 | 21 | public HashSet chunks; 22 | public boolean upToDate = false; 23 | 24 | public GridLight(WorldGridList worldGrid) { 25 | 26 | super(worldGrid); 27 | } 28 | 29 | public GridLight(World worldObj) { 30 | 31 | super(worldObj); 32 | } 33 | 34 | @Override 35 | public boolean canAddBlock(IGridTile aBlock) { 36 | 37 | return aBlock instanceof DuctUnitLight; 38 | } 39 | 40 | @Override 41 | public void onMajorGridChange() { 42 | 43 | super.onMajorGridChange(); 44 | upToDate = false; 45 | chunks = null; 46 | } 47 | 48 | @Override 49 | public void onMinorGridChange() { 50 | 51 | super.onMinorGridChange(); 52 | upToDate = false; 53 | } 54 | 55 | @Override 56 | public void tickGrid() { 57 | 58 | super.tickGrid(); 59 | 60 | // TODO: Fix 61 | RedstoneControl rs = null; 62 | 63 | if (upToDate && worldGrid.worldObj.getTotalWorldTime() % 160 != 0) { 64 | if (rs != null && rs.nextRedstoneLevel != -128) { 65 | upToDate = false; 66 | } 67 | return; 68 | } 69 | 70 | upToDate = rs == null || rs.nextRedstoneLevel == -128; 71 | 72 | boolean shouldBeLit; 73 | 74 | if (rs != null) { 75 | if (rs.nextRedstoneLevel != -128) { 76 | shouldBeLit = rs.nextRedstoneLevel > 0; 77 | } else { 78 | shouldBeLit = rs.redstoneLevel > 0; 79 | } 80 | } else { 81 | shouldBeLit = false; 82 | } 83 | 84 | if (!shouldBeLit) { 85 | for (Object object : Iterables.concat(nodeSet, idleSet)) { 86 | DuctUnitLight lamp = (DuctUnitLight) object; 87 | if (lamp.lit) { 88 | shouldBeLit = true; 89 | break; 90 | } 91 | } 92 | } 93 | 94 | if (lit != shouldBeLit) { 95 | setLight(shouldBeLit); 96 | } 97 | } 98 | 99 | boolean lit = false; 100 | 101 | @SuppressWarnings ("SuspiciousMethodCalls") 102 | public void setLight(boolean lit) { 103 | 104 | this.lit = lit; 105 | 106 | if (chunks == null) { 107 | buildMap(); 108 | } 109 | 110 | if (worldGrid.worldObj instanceof WorldServer) { 111 | PacketCoFHBase packet = new PacketLight(lit, this); 112 | WorldServer dimension = (WorldServer) worldGrid.worldObj; 113 | PlayerChunkMap manger = dimension.getPlayerChunkMap(); 114 | for (EntityPlayer player : dimension.playerEntities) { 115 | for (ChunkCoord chunk : chunks) { 116 | 117 | PlayerChunkMapEntry inst = manger.getEntry(chunk.chunkX, chunk.chunkZ); 118 | if (inst != null && inst.containsPlayer((EntityPlayerMP) player)) { 119 | PacketHandler.sendTo(packet, player); 120 | break; 121 | } 122 | } 123 | } 124 | 125 | for (DuctUnitLight block : Iterables.concat(nodeSet, idleSet)) { 126 | block.checkLight(); 127 | } 128 | } 129 | } 130 | 131 | public void buildMap() { 132 | 133 | chunks = new HashSet<>(); 134 | for (DuctUnitLight iGridTile : Iterables.concat(nodeSet, idleSet)) { 135 | buildMapEntry(iGridTile); 136 | } 137 | } 138 | 139 | private void buildMapEntry(DuctUnitLight iGridTile) { 140 | 141 | chunks.add(new ChunkCoord(iGridTile.x() >> 4, iGridTile.z() >> 4)); 142 | } 143 | 144 | } 145 | --------------------------------------------------------------------------------