Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Dec 24, 2024
2 parents b845e03 + 28ff96e commit f3b258d
Show file tree
Hide file tree
Showing 22 changed files with 187 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 25 additions & 1 deletion src/main/java/gregtech/api/enums/ItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
95 changes: 95 additions & 0 deletions src/main/java/gregtech/common/covers/CoverEnergyWireless.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
14 changes: 14 additions & 0 deletions src/main/java/gregtech/common/items/IDMetaItem01.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/gregtech/common/items/MetaGeneratedItem01.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f3b258d

Please sign in to comment.