Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Use wireless network manager and hopefully fix npe #82

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Add your dependencies here

dependencies {
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev')
api('com.github.GTNewHorizons:bartworks:0.9.4:dev')
api('com.github.GTNewHorizons:ThaumicTinkerer:2.9.0:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.100:dev')
api('com.github.GTNewHorizons:bartworks:0.9.17:dev')
api('com.github.GTNewHorizons:ThaumicTinkerer:2.9.2:dev')
}
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
Expand Down Expand Up @@ -61,6 +61,9 @@ gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =

# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -123,7 +126,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +190,3 @@ curseForgeRelations =
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName =
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.17'
}


Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;

import net.minecraft.block.Block;
Expand Down Expand Up @@ -75,7 +76,6 @@
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.IGlobalWirelessEnergy;
import gregtech.api.interfaces.IHatchElement;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
Expand All @@ -89,10 +89,11 @@
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.IGT_HatchAdder;
import gregtech.common.misc.WirelessNetworkManager;
import gregtech.common.misc.spaceprojects.SpaceProjectManager;

public class GTMTE_LapotronicSuperCapacitor
extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_LapotronicSuperCapacitor>
implements IGlobalWirelessEnergy, ISurvivalConstructable {
public class GTMTE_LapotronicSuperCapacitor extends
GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_LapotronicSuperCapacitor> implements ISurvivalConstructable {

private enum TopState {
MayBeTop,
Expand Down Expand Up @@ -521,7 +522,7 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
return sTexture;
}

private String global_energy_user_uuid;
private UUID global_energy_user_uuid;

@Override
public void onPreTick(IGregTechTileEntity tileEntity, long aTick) {
Expand All @@ -530,10 +531,10 @@ public void onPreTick(IGregTechTileEntity tileEntity, long aTick) {
// On first tick (aTick restarts from 0 upon world reload).
if (not_processed_lsc && tileEntity.isServerSide()) {
// Add user to wireless network.
strongCheckOrAddUser(tileEntity.getOwnerUuid(), tileEntity.getOwnerName());
WirelessNetworkManager.strongCheckOrAddUser(tileEntity.getOwnerUuid());

// Get team UUID.
global_energy_user_uuid = getUUIDFromUsername(tileEntity.getOwnerName());
global_energy_user_uuid = SpaceProjectManager.getPlayerUUIDFromName(tileEntity.getOwnerName());

not_processed_lsc = false;
}
Expand All @@ -555,7 +556,7 @@ public boolean checkRecipe(ItemStack stack) {

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

// Reset capacitor counts
Arrays.fill(capacitors, 0);
Expand Down Expand Up @@ -784,7 +785,7 @@ public boolean onRunningTick(ItemStack stack) {
}

// If that difference can be added then do so.
if (addEUToGlobalEnergyMap(global_energy_user_uuid, transferred_eu)) {
if (WirelessNetworkManager.addEUToGlobalEnergyMap(global_energy_user_uuid, transferred_eu)) {
// If it succeeds there was sufficient energy so set the internal capacity as such.
stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())).add(
UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount()))
Expand Down Expand Up @@ -940,7 +941,7 @@ public String[] getInfoData() {
+ getUMVCapacitorCount());
ll.add(
"Total wireless EU: " + EnumChatFormatting.RED
+ GT_Utility.formatNumbers(getUserEU(global_energy_user_uuid)));
+ GT_Utility.formatNumbers(WirelessNetworkManager.getUserEU(global_energy_user_uuid)));
ll.add("---------------------------------------------");

final String[] a = new String[ll.size()];
Expand Down