Skip to content

Commit

Permalink
Fix LSC voiding energy on placement in some cases (GTNewHorizons#3078)
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Sep 6, 2024
1 parent 20ab170 commit c817cc5
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import gregtech.api.util.IGTHatchAdder;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.common.misc.WirelessNetworkManager;
import gregtech.common.misc.spaceprojects.SpaceProjectManager;
import kekztech.client.gui.KTUITextures;
import kekztech.common.Blocks;
import kekztech.common.itemBlocks.ItemBlockLapotronicEnergyUnit;
Expand All @@ -93,7 +94,6 @@ private enum TopState {

private boolean canUseWireless = false;
private boolean wireless_mode = false;
private boolean not_processed_lsc = true;
private int counter = 1;
private boolean balanced = false;

Expand Down Expand Up @@ -511,19 +511,13 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
private UUID global_energy_user_uuid;

@Override
public void onPreTick(IGregTechTileEntity tileEntity, long aTick) {
super.onPreTick(tileEntity, aTick);
public void onFirstTick(IGregTechTileEntity tileEntity) {
super.onFirstTick(tileEntity);

// On first tick (aTick restarts from 0 upon world reload).
if (not_processed_lsc && tileEntity.isServerSide()) {
// Add user to wireless network.
WirelessNetworkManager.strongCheckOrAddUser(tileEntity.getOwnerUuid());
if (!tileEntity.isServerSide()) return;

// Get team UUID.
global_energy_user_uuid = tileEntity.getOwnerUuid();

not_processed_lsc = false;
}
global_energy_user_uuid = tileEntity.getOwnerUuid();
SpaceProjectManager.checkOrCreateTeam(global_energy_user_uuid);
}

@Override
Expand All @@ -542,8 +536,6 @@ public boolean checkRecipe(ItemStack stack) {

@Override
public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) {
WirelessNetworkManager.strongCheckOrAddUser(thisController.getOwnerUuid());

// Reset capacitor counts
Arrays.fill(capacitors, 0);
// Clear TT hatches
Expand Down

0 comments on commit c817cc5

Please sign in to comment.