Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Fluid Cells having hard coded(and wrong) fluid properties #2927

Open
wants to merge 3 commits into
base: 1.20.1
Choose a base branch
from
Open
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
93 changes: 30 additions & 63 deletions src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,69 +401,16 @@ public Component getItemName(ItemStack stack) {
ThermalFluidStats.create(FluidType.BUCKET_VOLUME, 1800, true, false, false, false, true),
new ItemFluidContainer()))
.register();
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_STEEL = REGISTRATE
.item("steel_fluid_cell", ComponentItem::create)
.lang("%s Steel Cell")
.color(() -> GTItems::cellColor)
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
.onRegister(attach(cellName(),
ThermalFluidStats.create(FluidType.BUCKET_VOLUME * 8,
GTMaterials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false,
false, false, true),
new ItemFluidContainer()))
.onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4))))
.register();
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_ALUMINIUM = REGISTRATE
.item("aluminium_fluid_cell", ComponentItem::create)
.lang("%s Aluminium Cell")
.color(() -> GTItems::cellColor)
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
.onRegister(attach(cellName(),
ThermalFluidStats.create(FluidType.BUCKET_VOLUME * 32,
GTMaterials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true,
false, false, false, true),
new ItemFluidContainer()))
.onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Aluminium, GTValues.M * 4))))
.register();
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_STAINLESS_STEEL = REGISTRATE
.item("stainless_steel_fluid_cell", ComponentItem::create)
.lang("%s Stainless Steel Cell")
.color(() -> GTItems::cellColor)
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
.onRegister(attach(cellName(),
ThermalFluidStats.create(FluidType.BUCKET_VOLUME * 64,
GTMaterials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(),
true, false, false, false, true),
new ItemFluidContainer()))
.onRegister(
materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.StainlessSteel, GTValues.M * 6))))
.register();
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_TITANIUM = REGISTRATE
.item("titanium_fluid_cell", ComponentItem::create)
.lang("%s Titanium Cell")
.color(() -> GTItems::cellColor)
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
.onRegister(attach(cellName(),
ThermalFluidStats.create(FluidType.BUCKET_VOLUME * 128,
GTMaterials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true,
false, false, false, true),
new ItemFluidContainer()))
.onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Titanium, GTValues.M * 6))))
.register();
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_TUNGSTEN_STEEL = REGISTRATE
.item("tungstensteel_fluid_cell", ComponentItem::create)
.lang("%s Tungstensteel Cell")
.color(() -> GTItems::cellColor)
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
.properties(p -> p.stacksTo(32))
.onRegister(attach(cellName(),
ThermalFluidStats.create(FluidType.BUCKET_VOLUME * 512,
GTMaterials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(),
true, false, false, false, true),
new ItemFluidContainer()))
.onRegister(
materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.TungstenSteel, GTValues.M * 8))))
.register();
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_STEEL = createFluidCell(GTMaterials.Steel, 8, 4, 64);
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_ALUMINIUM = createFluidCell(GTMaterials.Aluminium, 32, 4,
64);
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_STAINLESS_STEEL = createFluidCell(
GTMaterials.StainlessSteel, 64, 6, 64);
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_TITANIUM = createFluidCell(GTMaterials.Titanium, 128, 6,
64);
public static ItemEntry<ComponentItem> FLUID_CELL_LARGE_TUNGSTEN_STEEL = createFluidCell(GTMaterials.TungstenSteel,
512, 8, 32);

public static ItemEntry<ComponentItem> FLUID_CELL_GLASS_VIAL = REGISTRATE.item("glass_vial", ComponentItem::create)
.lang("%s Glass Vial")
.color(() -> GTItems::cellColor)
Expand All @@ -476,6 +423,26 @@ public Component getItemName(ItemStack stack) {
.onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, GTValues.M / 4))))
.register();

public static ItemEntry<ComponentItem> createFluidCell(Material mat, int capacity, int matSize, int stackSize) {
String name = "%s " + mat.getLocalizedName() + " Cell";
var prop = mat.getProperty(PropertyKey.FLUID_PIPE);
if (prop == null) prop = GTMaterials.Wood.getProperty(PropertyKey.FLUID_PIPE);
return REGISTRATE
.item("%s_fluid_cell".formatted(mat.getName()), ComponentItem::create)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please ensure that this doesn't result in missing IDs

.lang(name)
.color(() -> GTItems::cellColor)
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
.properties(p -> p.stacksTo(stackSize))
.onRegister(attach(cellName(),
ThermalFluidStats.create(FluidType.BUCKET_VOLUME * capacity,
prop.getMaxFluidTemperature(),
prop.isGasProof(), prop.isAcidProof(), prop.isCryoProof(), prop.isPlasmaProof(), true),
new ItemFluidContainer()))
.onRegister(
materialInfo(new ItemMaterialInfo(new MaterialStack(mat, GTValues.M * matSize))))
.register();
}

public static ItemEntry<ComponentItem> TOOL_MATCHES = REGISTRATE.item("matches", ComponentItem::create)
.lang("Matches")
.setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop())
Expand Down