Skip to content

Commit

Permalink
Merge branch 'GregTechCEu:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iouter authored May 2, 2024
2 parents c5bfba1 + 0003296 commit 57387cf
Show file tree
Hide file tree
Showing 27 changed files with 120 additions and 68 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
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public Builder addMufflerObstructedLine(boolean isObstructed) {
* Added if structure is formed, the machine is active, and the passed fuelName parameter is not null.
*/
public Builder addFuelNeededLine(String fuelName, int previousRecipeDuration) {
if (!isStructureFormed || !isActive) return this;
if (!isStructureFormed || !isActive || fuelName == null) return this;
ITextComponent fuelNeeded = TextComponentUtil.stringWithColor(TextFormatting.RED, fuelName);
ITextComponent numTicks = TextComponentUtil.stringWithColor(TextFormatting.AQUA,
TextFormattingUtil.formatNumbers(previousRecipeDuration));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package gregtech.api.metatileentity.multiblock;

import gregtech.api.capability.impl.*;
import gregtech.api.capability.impl.FluidHandlerProxy;
import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.capability.impl.ItemHandlerProxy;
import gregtech.api.capability.impl.NotifiableFluidTank;
import gregtech.api.capability.impl.NotifiableItemStackHandler;
import gregtech.api.capability.impl.PrimitiveRecipeLogic;
import gregtech.api.metatileentity.MTETrait;
import gregtech.api.recipes.RecipeMap;

import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -44,6 +53,15 @@ private List<FluidTank> makeFluidTanks(int length, boolean isExport) {
return fluidTankList;
}

@Override
public <T> T getCapability(Capability<T> capability, EnumFacing side) {
if ((capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ||
capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) && side != null) {
return null;
}
return super.getCapability(capability, side);
}

@Override
protected void updateFormedValid() {
recipeMapWorkable.update();
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 @@ -25,6 +25,7 @@
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fml.relauncher.Side;
Expand Down Expand Up @@ -139,8 +140,14 @@ public static void renderChestStack(double x, double y, double z, MetaTileEntity
public static void renderTankFluid(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline,
FluidTank tank, IBlockAccess world, BlockPos pos, EnumFacing frontFacing) {
FluidStack stack = tank.getFluid();
if (stack == null || stack.amount == 0 || !ConfigHolder.client.enableFancyChestRender)
if (stack == null || stack.amount == 0 || !ConfigHolder.client.enableFancyChestRender) {
return;
}

Fluid fluid = stack.getFluid();
if (fluid == null) {
return;
}

if (world != null) {
renderState.setBrightness(world, pos);
Expand All @@ -150,15 +157,15 @@ public static void renderTankFluid(CCRenderState renderState, Matrix4 translatio
14.9375 / 16.0, 14.9375 / 16.0);

double fillFraction = (double) stack.amount / tank.getCapacity();
boolean gas = stack.getFluid().isGaseous();
boolean gas = fluid.isGaseous(stack);
if (gas) {
partialFluidBox.min.y = Math.max(13.9375 - (11.875 * fillFraction), 2.0) / 16.0;
} else {
partialFluidBox.max.y = Math.min((11.875 * fillFraction) + 2.0625, 14.0) / 16.0;
}

renderState.setFluidColour(stack);
ResourceLocation fluidStill = stack.getFluid().getStill(stack);
ResourceLocation fluidStill = fluid.getStill(stack);
TextureAtlasSprite fluidStillSprite = Minecraft.getMinecraft().getTextureMapBlocks()
.getAtlasSprite(fluidStill.toString());

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
Loading

0 comments on commit 57387cf

Please sign in to comment.