Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
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 @@ -101,17 +101,18 @@ 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" };

/**
* 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 @@ -167,7 +167,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 @@ -193,7 +193,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 @@ -16,14 +16,17 @@
import gregtech.api.util.GTUtility;
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 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.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
Expand Down Expand Up @@ -177,7 +180,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation,
}

private 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 @@ -339,6 +342,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);
}
}

private 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 @@ -445,4 +449,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 @@ -31,7 +31,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 @@ -102,10 +102,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 @@ -49,7 +49,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 @@ -15,13 +14,16 @@
import gregtech.api.metatileentity.multiblock.MultiblockAbility;
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.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
Expand Down Expand Up @@ -54,7 +56,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 @@ -209,4 +211,27 @@ protected ModularUI createUI(EntityPlayer entityPlayer) {
builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12);
return builder.build(getHolder(), entityPlayer);
}

@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