Skip to content

Commit

Permalink
Waila/Hwyla Provider Fixes (GregTechCEu#2451)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 authored Apr 14, 2024
1 parent a8a0dda commit e927e2d
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;

@Mod(modid = GTValues.MODID,
name = "GregTech",
name = GTValues.MOD_NAME,
acceptedMinecraftVersions = "[1.12.2,1.13)",
version = GTInternalTags.VERSION,
dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" +
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public class GTValues {
*/
public static final String MODID = "gregtech";

/**
* GregTech Mod Name
*/
public static final String MOD_NAME = "GregTech";

/** @deprecated Use {@link gregtech.api.util.Mods} instead */
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.9")
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/gregtech/api/util/GTLog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gregtech.api.util;

import gregtech.api.GTValues;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -9,7 +11,7 @@
*/
public class GTLog {

public static Logger logger = LogManager.getLogger("GregTech");
public static Logger logger = LogManager.getLogger(GTValues.MOD_NAME);

private GTLog() {}
}
5 changes: 3 additions & 2 deletions src/main/java/gregtech/api/util/input/KeyBind.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gregtech.api.util.input;

import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.util.GTLog;
import gregtech.core.network.packets.PacketKeysPressed;
Expand Down Expand Up @@ -99,14 +100,14 @@ public static boolean scrollingDown() {

KeyBind(String langKey, int button) {
if (FMLCommonHandler.instance().getSide().isClient()) {
this.keybinding = new KeyBinding(langKey, button, "GregTech");
this.keybinding = new KeyBinding(langKey, button, GTValues.MOD_NAME);
ClientRegistry.registerKeyBinding(this.keybinding);
}
}

KeyBind(String langKey, IKeyConflictContext ctx, int button) {
if (FMLCommonHandler.instance().getSide().isClient()) {
this.keybinding = new KeyBinding(langKey, ctx, button, "GregTech");
this.keybinding = new KeyBinding(langKey, ctx, button, GTValues.MOD_NAME);
ClientRegistry.registerKeyBinding(this.keybinding);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
import net.minecraftforge.fml.common.Optional;

import appeng.core.Api;
import forestry.api.apiculture.*;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeMutationBuilder;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.IAllele;
Expand Down Expand Up @@ -1206,7 +1211,7 @@ public enum GTBeeDefinition implements IBeeDefinition {
String name = "for.bees.species." + lowercaseName;

this.branch = branch;
this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, "GregTech", description, dominant,
this.species = new GTAlleleBeeSpecies(GTValues.MODID, uid, name, GTValues.MOD_NAME, description, dominant,
branch.getBranch(), binomial, primary, secondary);
this.generationCondition = generationCondition;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static void loadMetaItemBracketHandler() {

@Override
public @NotNull String getContainerName() {
return "GregTech";
return GTValues.MOD_NAME;
}

@Optional.Method(modid = Mods.Names.GROOVY_SCRIPT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;

import mcp.mobius.waila.api.*;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import org.jetbrains.annotations.NotNull;

import java.util.List;
Expand All @@ -19,7 +22,7 @@ public class BlockOreDataProvider implements IWailaDataProvider {

public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, BlockOre.class);
registrar.addConfig(GTValues.MODID, "gregtech.block_ore");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.block_ore");
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ControllableDataProvider extends CapabilityDataProvider<IControllab
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.controllable");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.controllable");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ConverterDataProvider extends CapabilityDataProvider<ConverterTrait
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.converter");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.converter");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class DiodeDataProvider extends ElectricContainerDataProvider {
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.diode");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.diode");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ElectricContainerDataProvider extends CapabilityDataProvider<IEnerg
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.energy");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.energy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class LampDataProvider implements IWailaDataProvider {

public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, BlockLamp.class);
registrar.addConfig(GTValues.MODID, "gregtech.block_lamp");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.block_lamp");
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MaintenanceDataProvider extends CapabilityDataProvider<IMaintenance
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.maintenance");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.maintenance");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MultiRecipeMapDataProvider extends CapabilityDataProvider<IMultiple
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.multi_recipemap");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.multi_recipemap");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MultiblockDataProvider extends CapabilityDataProvider<IMultiblockCo
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.multiblock");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.multiblock");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class PrimitivePumpDataProvider implements IWailaDataProvider {
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, IGregTechTileEntity.class);
registrar.registerNBTProvider(this, IGregTechTileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.primitive_pump");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.primitive_pump");
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import gregtech.api.GTValues;
import gregtech.api.capability.GregtechTileCapabilities;
import gregtech.api.capability.impl.AbstractRecipeLogic;
import gregtech.api.capability.impl.PrimitiveRecipeLogic;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.SteamMetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
Expand Down Expand Up @@ -34,7 +35,7 @@ public class RecipeLogicDataProvider extends CapabilityDataProvider<AbstractReci
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.recipe_logic");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.recipe_logic");
}

@Override
Expand All @@ -46,7 +47,7 @@ public void register(@NotNull IWailaRegistrar registrar) {
protected NBTTagCompound getNBTData(AbstractRecipeLogic capability, NBTTagCompound tag) {
NBTTagCompound subTag = new NBTTagCompound();
subTag.setBoolean("Working", capability.isWorking());
if (capability.isWorking()) {
if (capability.isWorking() && !(capability instanceof PrimitiveRecipeLogic)) {
subTag.setInteger("RecipeEUt", capability.getInfoProviderEUt());
}
tag.setTag("gregtech.AbstractRecipeLogic", subTag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SteamBoilerDataProvider implements IWailaDataProvider {
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, IGregTechTileEntity.class);
registrar.registerNBTProvider(this, IGregTechTileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.steam_boiler");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.steam_boiler");
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class TransformerDataProvider extends ElectricContainerDataProvider {
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.transformer");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.transformer");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class WorkableDataProvider extends CapabilityDataProvider<IWorkable> {
public void register(@NotNull IWailaRegistrar registrar) {
registrar.registerBodyProvider(this, TileEntity.class);
registrar.registerNBTProvider(this, TileEntity.class);
registrar.addConfig(GTValues.MODID, "gregtech.workable");
registrar.addConfig(GTValues.MOD_NAME, "gregtech.workable");
}

@Override
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ gregtech.top.ld_pipe_output=Output
gregtech.top.ld_pipe_input_endpoint=Input Endpoint:
gregtech.top.ld_pipe_output_endpoint=Output Endpoint:

option.gregtech.block_ore=Ore Blocks
option.gregtech.controllable=Controllable Machines
option.gregtech.converter=Energy Converters
option.gregtech.diode=Diodes
option.gregtech.energy=Energy Containers
option.gregtech.block_lamp=Lamp Blocks
option.gregtech.maintenance=Maintenance Problems
option.gregtech.multi_recipemap=Machine Modes
option.gregtech.multiblock=Multiblocks
option.gregtech.primitive_pump=Primitive Pump
option.gregtech.recipe_logic=Recipes
option.gregtech.steam_boiler=Steam Boilers
option.gregtech.transformer=Transformers
option.gregtech.workable=Workable Machines

gregtech.waila.energy_stored=Energy: %d EU / %d EU
gregtech.waila.progress_idle=Idle
gregtech.waila.progress_tick=Progress: %d t / %d t
Expand Down

0 comments on commit e927e2d

Please sign in to comment.