Skip to content

Commit

Permalink
High-tier fixes (GregTechCEu#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Feb 3, 2025
1 parent 32d2c2d commit ae65dfe
Show file tree
Hide file tree
Showing 25 changed files with 220 additions and 56 deletions.
13 changes: 7 additions & 6 deletions src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ public class GTValues {
* The short names for the voltages, formatted for text
*/
public static final String[] VNF = new String[] {
DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV",
GOLD + "HV", DARK_PURPLE + "EV", DARK_BLUE + "IV",
LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV",
DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV",
YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX" };
RED + "ULV", GRAY + "LV", GOLD + "MV",
YELLOW + "HV", DARK_GRAY + "EV", WHITE + "IV",
LIGHT_PURPLE + "LuV", AQUA + "ZPM", DARK_GREEN + "UV",
DARK_RED + "UHV", DARK_BLUE + "UEV", DARK_GREEN.toString() + BOLD + "UIV",
DARK_PURPLE.toString() + BOLD + "UXV", DARK_RED.toString() + BOLD + "OpV",
RED.toString() + BOLD + "MAX" };

/**
* The short names for the voltages, up to max Long, formatted for text
Expand All @@ -146,7 +147,7 @@ public class GTValues {
* Color values for the voltages
*/
public static final int[] VC = new int[] { 0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797,
0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 };
0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x488748, 0x914E91, 0x8C0000, 0x2828F5 };

/**
* The long names for the voltages
Expand Down
105 changes: 65 additions & 40 deletions src/main/java/gregtech/common/metatileentities/MetaTileEntities.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public boolean canRenderFrontFaceX() {
@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
// override here is gross, but keeps things in order despite
// IDs being out of order, due to EV 4A hatches being added later
// IDs being out of order, due to EV 4A and UEV+ 4A+ hatches being added later
if (this == MetaTileEntities.ENERGY_INPUT_HATCH[0]) {
for (MetaTileEntityEnergyHatch hatch : MetaTileEntities.ENERGY_INPUT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
Expand All @@ -203,7 +203,11 @@ public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItem
for (MetaTileEntityEnergyHatch hatch : MetaTileEntities.SUBSTATION_ENERGY_OUTPUT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
}
} else if (this.getClass() != MetaTileEntityEnergyHatch.class &&
this.getClass() != MetaTileEntitySubstationEnergyHatch.class) {
// let subclasses fall through this override
super.getSubItems(creativeTab, subItems);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
import gregtech.api.mui.GTGuis;
import gregtech.client.renderer.texture.Textures;
import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer;
import gregtech.common.metatileentities.MetaTileEntities;
import gregtech.common.metatileentities.storage.MetaTileEntityQuantumTank;
import gregtech.common.mui.widget.GTFluidSlot;

import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
Expand Down Expand Up @@ -185,7 +188,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation,
}

protected int getInventorySize() {
return INITIAL_INVENTORY_SIZE * (1 << Math.min(9, getTier()));
return INITIAL_INVENTORY_SIZE * Math.min(Integer.MAX_VALUE, 1 << getTier());
}

@Override
Expand Down Expand Up @@ -338,6 +341,21 @@ private void setLocked(boolean locked) {
fluidTank.onContentsChanged();
}

@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
if (this == MetaTileEntities.FLUID_IMPORT_HATCH[0]) {
for (var hatch : MetaTileEntities.FLUID_IMPORT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
for (var hatch : MetaTileEntities.FLUID_EXPORT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
} else if (this.getClass() != MetaTileEntityFluidHatch.class) {
// let subclasses fall through this override
super.getSubItems(creativeTab, subItems);
}
}

protected class HatchFluidTank extends NotifiableFluidTank implements IFilteredFluidContainer, IFilter<FluidStack> {

public HatchFluidTank(int capacity, MetaTileEntity entityToNotify, boolean isExport) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gregtech.common.metatileentities.multi.multiblockpart;

import gregtech.api.GTValues;
import gregtech.api.capability.*;
import gregtech.api.capability.impl.GhostCircuitItemStackHandler;
import gregtech.api.capability.impl.ItemHandlerList;
Expand All @@ -16,14 +17,17 @@
import gregtech.api.util.GTHashMaps;
import gregtech.client.renderer.texture.Textures;
import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer;
import gregtech.common.metatileentities.MetaTileEntities;

import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
Expand Down Expand Up @@ -180,7 +184,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation,
}

private int getInventorySize() {
int sizeRoot = 1 + Math.min(9, getTier());
int sizeRoot = 1 + Math.min(GTValues.UHV, getTier());
return sizeRoot * sizeRoot;
}

Expand Down Expand Up @@ -453,4 +457,21 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List<String> t
tooltip.add(I18n.format("gregtech.tool_action.wrench.set_facing"));
super.addToolUsages(stack, world, tooltip, advanced);
}

@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
// override here is gross, but keeps things in order despite
// IDs being out of order, due to UEV+ being added later
if (this == MetaTileEntities.ITEM_IMPORT_BUS[0]) {
for (var hatch : MetaTileEntities.ITEM_IMPORT_BUS) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
for (var hatch : MetaTileEntities.ITEM_EXPORT_BUS) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
} else if (this.getClass() != MetaTileEntityItemBus.class) {
// let subclasses fall through this override
super.getSubItems(creativeTab, subItems);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.List;

import static gregtech.api.GTValues.V;
import static gregtech.api.GTValues.VN;
import static gregtech.api.GTValues.VNF;

public class MetaTileEntityLaserHatch extends MetaTileEntityMultiblockPart
implements IMultiblockAbilityPart<ILaserContainer>, IDataInfoProvider {
Expand Down Expand Up @@ -95,10 +95,10 @@ public void addInformation(ItemStack stack, @Nullable World world, @NotNull List
tooltip.add(I18n.format("gregtech.machine.laser_hatch.tooltip2"));

if (isOutput) {
tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", V[tier], VN[tier]));
tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", V[tier], VNF[tier]));
tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_out_till", amperage));
} else {
tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", V[tier], VN[tier]));
tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", V[tier], VNF[tier]));
tooltip.add(I18n.format("gregtech.universal.tooltip.amperage_in_till", amperage));
}
tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", buffer.getEnergyCapacity()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class MetaTileEntityMufflerHatch extends MetaTileEntityMultiblockPart imp

public MetaTileEntityMufflerHatch(ResourceLocation metaTileEntityId, int tier) {
super(metaTileEntityId, tier);
this.recoveryChance = Math.max(1, tier * 10);
this.recoveryChance = (int) Math.ceil((tier - 1.0f) / 8 * 100);
this.inventory = new GTItemStackHandler(this, (int) Math.pow(tier + 1, 2));
this.frontFaceFree = false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gregtech.common.metatileentities.multi.multiblockpart;

import gregtech.api.GTValues;
import gregtech.api.capability.GregtechDataCodes;
import gregtech.api.capability.GregtechTileCapabilities;
import gregtech.api.capability.IControllable;
Expand All @@ -13,13 +12,16 @@
import gregtech.api.mui.GTGuis;
import gregtech.client.renderer.texture.Textures;
import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer;
import gregtech.common.metatileentities.MetaTileEntities;
import gregtech.common.mui.widget.GTFluidSlot;

import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
Expand Down Expand Up @@ -59,7 +61,7 @@ public MetaTileEntityMultiFluidHatch(ResourceLocation metaTileEntityId, int tier
this.numSlots = numSlots;
// Quadruple: 1/4th the capacity of a fluid hatch of this tier
// Nonuple: 1/8th the capacity of a fluid hatch of this tier
this.tankSize = (BASE_TANK_SIZE * (1 << Math.min(GTValues.UHV, tier))) / (numSlots == 4 ? 4 : 8);
this.tankSize = BASE_TANK_SIZE * (1 << tier) / (numSlots == 4 ? 4 : 8);
FluidTank[] fluidsHandlers = new FluidTank[numSlots];
for (int i = 0; i < fluidsHandlers.length; i++) {
fluidsHandlers[i] = new NotifiableFluidTank(tankSize, this, isExportHatch);
Expand Down Expand Up @@ -227,4 +229,27 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
.coverChildren())
.bindPlayerInventory();
}

@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
// override here is gross, but keeps things in order despite
// IDs being out of order, due to IV+ hatches being added later
if (this == MetaTileEntities.QUADRUPLE_IMPORT_HATCH[0]) {
for (var hatch : MetaTileEntities.QUADRUPLE_IMPORT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
for (var hatch : MetaTileEntities.QUADRUPLE_EXPORT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
for (var hatch : MetaTileEntities.NONUPLE_IMPORT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
for (var hatch : MetaTileEntities.NONUPLE_EXPORT_HATCH) {
if (hatch != null) subItems.add(hatch.getStackForm());
}
} else if (this.getClass() != MetaTileEntityMultiFluidHatch.class) {
// let subclasses fall through this override
super.getSubItems(creativeTab, subItems);
}
}
}
Loading

0 comments on commit ae65dfe

Please sign in to comment.