diff --git a/dependencies.gradle b/dependencies.gradle index f0bf47ee14a..98adf9529e6 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -42,7 +42,7 @@ dependencies { api("com.github.GTNewHorizons:ModularUI:1.2.17:dev") api("com.github.GTNewHorizons:ModularUI2:2.1.16-1.7.10:dev") api("com.github.GTNewHorizons:waila:1.8.2:dev") - api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-504-GTNH:dev") + api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-507-GTNH:dev") api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.0-gtnh:dev") api('com.github.GTNewHorizons:Yamcl:0.6.0:dev') api("com.github.GTNewHorizons:Postea:1.0.13:dev") @@ -70,7 +70,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:ThaumicBases:1.8.0:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:EnderCore:0.4.6:dev") { transitive = false } compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.28:dev') { transitive = false } - compileOnly("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.100-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.104-GTNH:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:Galacticraft:3.2.8-GTNH:dev") { transitive = false } implementation("com.github.GTNewHorizons:TinkersConstruct:1.13.0-GTNH:dev") diff --git a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/MTENeutronAccelerator.java b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/MTENeutronAccelerator.java index fb63e673020..e06c51c6d13 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/MTENeutronAccelerator.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/MTENeutronAccelerator.java @@ -42,8 +42,8 @@ public String[] getDescription() { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - if (aBaseMetaTileEntity.getStoredEU() >= getMaxEUConsume() && aBaseMetaTileEntity.isAllowedToWork()) { - setEUVar(aBaseMetaTileEntity.getStoredEU() - getMaxEUConsume()); + if (getEUVar() >= getMaxEUConsume() && aBaseMetaTileEntity.isAllowedToWork()) { + setEUVar(getEUVar() - getMaxEUConsume()); aBaseMetaTileEntity.setActive(true); } else { aBaseMetaTileEntity.setActive(false); diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index a06e47973b7..f3ed791eb21 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -1026,6 +1026,21 @@ public enum ItemList implements IItemContainer { Wireless_Dynamo_Energy_UXV, Wireless_Dynamo_Energy_MAX, + Cover_Wireless_Energy_LV, + Cover_Wireless_Energy_MV, + Cover_Wireless_Energy_HV, + Cover_Wireless_Energy_EV, + Cover_Wireless_Energy_IV, + Cover_Wireless_Energy_LuV, + Cover_Wireless_Energy_ZPM, + Cover_Wireless_Energy_UV, + Cover_Wireless_Energy_UHV, + Cover_Wireless_Energy_UEV, + Cover_Wireless_Energy_UIV, + Cover_Wireless_Energy_UMV, + Cover_Wireless_Energy_UXV, + Cover_Wireless_Energy_MAX, + Hatch_Input_ULV, Hatch_Input_LV, Hatch_Input_MV, @@ -2609,7 +2624,16 @@ public enum ItemList implements IItemContainer { Hatch_Output_Bus_EV, Hatch_Output_Bus_IV, Hatch_Output_Bus_LuV, Hatch_Output_Bus_ZPM, Hatch_Output_Bus_UV, Hatch_Output_Bus_MAX }, HATCHES_MUFFLER = { Hatch_Muffler_LV, Hatch_Muffler_LV, Hatch_Muffler_MV, Hatch_Muffler_HV, Hatch_Muffler_EV, - Hatch_Muffler_IV, Hatch_Muffler_LuV, Hatch_Muffler_ZPM, Hatch_Muffler_UV, Hatch_Muffler_MAX }; + Hatch_Muffler_IV, Hatch_Muffler_LuV, Hatch_Muffler_ZPM, Hatch_Muffler_UV, Hatch_Muffler_MAX }, + WIRELESS_ENERGY_HATCHES = { Wireless_Hatch_Energy_ULV, Wireless_Hatch_Energy_LV, Wireless_Hatch_Energy_MV, + Wireless_Hatch_Energy_HV, Wireless_Hatch_Energy_EV, Wireless_Hatch_Energy_IV, Wireless_Hatch_Energy_LuV, + Wireless_Hatch_Energy_ZPM, Wireless_Hatch_Energy_UV, Wireless_Hatch_Energy_UHV, Wireless_Hatch_Energy_UEV, + Wireless_Hatch_Energy_UIV, Wireless_Hatch_Energy_UMV, Wireless_Hatch_Energy_UXV, + Wireless_Hatch_Energy_MAX }, + WIRELESS_ENERGY_COVERS = { Cover_Wireless_Energy_LV, Cover_Wireless_Energy_MV, Cover_Wireless_Energy_HV, + Cover_Wireless_Energy_EV, Cover_Wireless_Energy_IV, Cover_Wireless_Energy_LuV, Cover_Wireless_Energy_ZPM, + Cover_Wireless_Energy_UV, Cover_Wireless_Energy_UHV, Cover_Wireless_Energy_UEV, Cover_Wireless_Energy_UIV, + Cover_Wireless_Energy_UMV, Cover_Wireless_Energy_UXV, Cover_Wireless_Energy_MAX }; public static Fluid sOilExtraHeavy, sEpichlorhydrin, sDrillingFluid, sBlueVitriol, sNickelSulfate, sGreenVitriol, sToluene, sNitrationMixture, sRocketFuel, sHydricSulfur, sIndiumConcentrate, sLeadZincSolution, sHydrochloricAcid; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 8755e57da1b..79cb8cccff3 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -2226,6 +2226,10 @@ public int getMaxEnergyOutput() { return getOutput(); } + public long getStoredEUuncapped() { + return mMetaTileEntity.getEUVar(); + } + public int getOutput() { return (int) Math.min(Integer.MAX_VALUE, oOutput); } diff --git a/src/main/java/gregtech/common/covers/CoverEnergyWireless.java b/src/main/java/gregtech/common/covers/CoverEnergyWireless.java new file mode 100644 index 00000000000..46e8288ae2b --- /dev/null +++ b/src/main/java/gregtech/common/covers/CoverEnergyWireless.java @@ -0,0 +1,95 @@ +package gregtech.common.covers; + +import static gregtech.common.misc.WirelessNetworkManager.addEUToGlobalEnergyMap; +import static java.lang.Long.min; + +import java.util.UUID; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IWirelessEnergyHatchInformation; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.util.CoverBehavior; +import gregtech.api.util.ISerializableObject; + +public class CoverEnergyWireless extends CoverBehavior implements IWirelessEnergyHatchInformation { + + private final long transferred_energy_per_operation; + + public CoverEnergyWireless(int voltage) { + this.transferred_energy_per_operation = 2 * voltage * ticks_between_energy_addition; + } + + @Override + public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + long aTimer) { + return false; + } + + @Override + public boolean allowsCopyPasteTool() { + return false; + } + + @Override + public boolean allowsTickRateAddition() { + return false; + } + + @Override + public boolean hasCoverGUI() { + return false; + } + + @Override + public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity, long aTimer) { + if (aCoverVariable == 0 || aTimer % ticks_between_energy_addition == 0) { + tryFetchingEnergy(aTileEntity); + } + return 1; + } + + private static UUID getOwner(Object te) { + if (te instanceof BaseMetaTileEntity igte) { + return igte.getOwnerUuid(); + } else { + return null; + } + } + + private void tryFetchingEnergy(ICoverable tileEntity) { + if (tileEntity instanceof BaseMetaTileEntity bmte) { + long currentEU = bmte.getStoredEUuncapped(); + long euToTransfer = min(transferred_energy_per_operation - currentEU, transferred_energy_per_operation); + if (euToTransfer <= 0) return; // nothing to transfer + if (!addEUToGlobalEnergyMap(getOwner(tileEntity), -euToTransfer)) return; + bmte.increaseStoredEnergyUnits(euToTransfer, true); + } + } + + @Override + protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, + float aY, float aZ) { + return false; + } + + @Override + protected boolean isGUIClickableImpl(ForgeDirection side, int aCoverID, + ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) { + return false; + } + + @Override + public boolean alwaysLookConnected(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return true; + } + + @Override + public int getTickRate(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return 20; + } +} diff --git a/src/main/java/gregtech/common/items/IDMetaItem01.java b/src/main/java/gregtech/common/items/IDMetaItem01.java index 88d3dcb5dd6..f8eee1df58b 100644 --- a/src/main/java/gregtech/common/items/IDMetaItem01.java +++ b/src/main/java/gregtech/common/items/IDMetaItem01.java @@ -139,6 +139,20 @@ public enum IDMetaItem01 { Cover_Chest_Basic(380), Cover_Chest_Good(381), Cover_Chest_Advanced(382), + Cover_Wireless_Energy_LV(383), + Cover_Wireless_Energy_MV(384), + Cover_Wireless_Energy_HV(385), + Cover_Wireless_Energy_EV(386), + Cover_Wireless_Energy_IV(387), + Cover_Wireless_Energy_LuV(388), + Cover_Wireless_Energy_ZPM(389), + Cover_Wireless_Energy_UV(390), + Cover_Wireless_Energy_UHV(391), + Cover_Wireless_Energy_UEV(392), + Cover_Wireless_Energy_UIV(393), + Cover_Wireless_Energy_UMV(394), + Cover_Wireless_Energy_UXV(395), + Cover_Wireless_Energy_MAX(396), Shape_Slicer_Flat(398), Shape_Slicer_Stripes(399), Fuel_Can_Plastic_Empty(400), diff --git a/src/main/java/gregtech/common/items/MetaGeneratedItem01.java b/src/main/java/gregtech/common/items/MetaGeneratedItem01.java index 0b96caea028..c6950fb8871 100644 --- a/src/main/java/gregtech/common/items/MetaGeneratedItem01.java +++ b/src/main/java/gregtech/common/items/MetaGeneratedItem01.java @@ -160,6 +160,7 @@ import static gregtech.common.items.IDMetaItem01.Cover_SolarPanel_MV; import static gregtech.common.items.IDMetaItem01.Cover_SolarPanel_UV; import static gregtech.common.items.IDMetaItem01.Cover_SolarPanel_ZPM; +import static gregtech.common.items.IDMetaItem01.Cover_Wireless_Energy_LV; import static gregtech.common.items.IDMetaItem01.Crate_Empty; import static gregtech.common.items.IDMetaItem01.Duct_Tape; import static gregtech.common.items.IDMetaItem01.Electric_Motor_EV; @@ -508,6 +509,7 @@ import gregtech.common.covers.CoverDoesWork; import gregtech.common.covers.CoverDrain; import gregtech.common.covers.CoverEUMeter; +import gregtech.common.covers.CoverEnergyWireless; import gregtech.common.covers.CoverFluidLimiter; import gregtech.common.covers.CoverFluidRegulator; import gregtech.common.covers.CoverFluidStorageMonitor; @@ -2948,6 +2950,26 @@ public MetaGeneratedItem01() { "Holds 15 item for use within machine GUI (as Cover)", new TCAspects.TC_AspectStack(TCAspects.VACUOS, 2L))); + for (int i = 1; i < 15; i++) { + ItemList.WIRELESS_ENERGY_COVERS[i - 1].set( + addItem( + Cover_Wireless_Energy_LV.ID + i - 1, + GTValues.VN[i] + " Wireless Energy Cover", + String.join( + "/n ", + "Stores energy globally in a network, up to 2^(2^31) EU.", + "Does not connect to wires. This cover withdraws EU from the network.", + "Ignores voltage limitations (no explosions).", + "Amperage: " + EnumChatFormatting.YELLOW + "2" + EnumChatFormatting.GRAY, + "Voltage IN: " + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(GTValues.V[i]) + + " (" + + GTUtility.getColoredTierNameFromTier((byte) (i)) + + EnumChatFormatting.GREEN + + ")"), + new TCAspects.TC_AspectStack(TCAspects.VACUOS, 2L))); + } + ItemList.Cover_Screen.set( addItem( Cover_Screen.ID, @@ -3954,6 +3976,14 @@ private void registerCovers() { TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_MAINTENANCE_DETECTOR)), new CoverNeedMaintainance(TextureFactory.of(OVERLAY_MAINTENANCE_DETECTOR))); + for (int i = 0; i < 14; i++) { + GregTechAPI.registerCover( + ItemList.WIRELESS_ENERGY_COVERS[i].get(1), + TextureFactory + .of(MACHINE_CASINGS[i + 1][0], Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI_WIRELESS_ON[0]), + new CoverEnergyWireless((int) GTValues.V[i + 1])); + } + } private void removeRecipes() { diff --git a/src/main/java/gregtech/loaders/postload/recipes/AssemblerRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/AssemblerRecipes.java index 04616669f23..06ac7f0692b 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/AssemblerRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/AssemblerRecipes.java @@ -50,6 +50,7 @@ import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTUtility; import gtPlusPlus.core.material.MaterialsAlloy; +import tectech.thing.CustomItemList; public class AssemblerRecipes implements Runnable { @@ -541,6 +542,20 @@ public void run() { .duration(60 * SECONDS) .eut(TierEU.RECIPE_UHV) .addTo(assemblerRecipes); + + for (int i = 0; i < ItemList.WIRELESS_ENERGY_COVERS.length; i++) { + GTValues.RA.stdBuilder() + .itemInputs( + GTOreDictUnificator.get(OrePrefixes.plateDense, MaterialsUEVplus.TranscendentMetal, 4L), + CustomItemList.Machine_Multi_Transformer.get(1), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.Infinity, 2L), + ItemList.WIRELESS_ENERGY_HATCHES[i + 1].get(1)) + .itemOutputs(ItemList.WIRELESS_ENERGY_COVERS[i].get(1L)) + .fluidInputs(MaterialsUEVplus.ExcitedDTEC.getFluid(32_000L)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_UMV) + .addTo(assemblerRecipes); + } } // If Cleanroom is enabled, add an assembler recipe diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/383.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/383.png new file mode 100644 index 00000000000..391703daf74 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/383.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/384.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/384.png new file mode 100644 index 00000000000..b345d5ae6e4 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/384.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/385.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/385.png new file mode 100644 index 00000000000..0f792bf037e Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/385.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/386.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/386.png new file mode 100644 index 00000000000..a661a3e590c Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/386.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/387.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/387.png new file mode 100644 index 00000000000..eb28331a7a4 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/387.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/388.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/388.png new file mode 100644 index 00000000000..89ea33d8f9a Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/388.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/389.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/389.png new file mode 100644 index 00000000000..3b7609a6a4b Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/389.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/390.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/390.png new file mode 100644 index 00000000000..9520550ab63 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/390.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/391.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/391.png new file mode 100644 index 00000000000..947be181928 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/391.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/392.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/392.png new file mode 100644 index 00000000000..b75b61e7c12 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/392.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/393.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/393.png new file mode 100644 index 00000000000..40156812014 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/393.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/394.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/394.png new file mode 100644 index 00000000000..468ef1b7265 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/394.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/395.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/395.png new file mode 100644 index 00000000000..d62201e246f Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/395.png differ diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/396.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/396.png new file mode 100644 index 00000000000..88449a995cf Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/396.png differ