Skip to content

Commit

Permalink
feat: primitive multiblocks plan C plus homogenousmore
Browse files Browse the repository at this point in the history
  • Loading branch information
bruberu committed Jul 21, 2024
1 parent bb01459 commit 259db88
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 72 deletions.
2 changes: 0 additions & 2 deletions src/main/java/gregtech/api/capability/ICoolantHandler.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package gregtech.api.capability;

import gregtech.api.capability.impl.LockableFluidTank;
import gregtech.api.unification.material.Material;

import gregtech.api.unification.material.properties.CoolantProperty;

import net.minecraft.util.EnumFacing;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/gregtech/api/capability/IFuelRodHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import gregtech.api.items.itemhandlers.LockableItemStackHandler;
import gregtech.api.nuclear.fission.components.FuelRod;
import gregtech.api.unification.material.Material;

import gregtech.api.unification.material.properties.FissionFuelProperty;

import net.minecraft.item.ItemStack;
Expand All @@ -18,6 +16,7 @@ public interface IFuelRodHandler extends ILockableHandler<ItemStack> {

/**
* Set the fuel type that's currently being processed by this specific handler.
*
* @param prop The new fuel type.
* @return true if the partial fuel changed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import gregtech.api.GTValues;
import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.metatileentity.multiblock.RecipeMapPrimitiveMultiblockController;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

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;
Expand All @@ -20,12 +19,10 @@
import java.util.ArrayList;
import java.util.List;

public abstract class RecipeMapPrimitiveMultiblockController extends MultiblockWithDisplayBase {

protected PrimitiveRecipeLogic recipeMapWorkable;
public abstract class RecipeMapPrimitiveMultiblockController extends RecipeMapMultiblockController {

public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId, RecipeMap<?> recipeMap) {
super(metaTileEntityId);
super(metaTileEntityId, recipeMap);
this.recipeMapWorkable = new PrimitiveRecipeLogic(this, recipeMap);
initializeAbilities();
}
Expand Down Expand Up @@ -62,32 +59,11 @@ public <T> T getCapability(Capability<T> capability, EnumFacing side) {
return super.getCapability(capability, side);
}

@Override
protected void updateFormedValid() {
recipeMapWorkable.update();
}

@Override
public boolean isActive() {
return super.isActive() && this.recipeMapWorkable.isWorkingEnabled() && this.recipeMapWorkable.isActive();
}

@Override
public void invalidateStructure() {
super.invalidateStructure();
recipeMapWorkable.invalidate();
}

@Override
protected boolean shouldUpdate(MTETrait trait) {
return !(trait instanceof PrimitiveRecipeLogic);
}

@Override
public SoundEvent getSound() {
return recipeMapWorkable.getRecipeMap().getSound();
}

@Override
protected boolean openGUIOnRightClick() {
return isStructureFormed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.common.ConfigHolder;

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

public class FissionReactor {

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/gregtech/api/nuclear/fission/ICoolantStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface ICoolantStats {

/**
* @return A factor relating to the neutron moderation properties; the higher the factor, the fewer neutrons pass
* through.
* through.
*/
double getModeratorFactor();

Expand All @@ -31,9 +31,8 @@ public interface ICoolantStats {
double getBoilingPoint();

/**
* @return If the coolant reacts with zirconium cladding at high temperatures. This is true for mostly water-based coolants.
* @return If the coolant reacts with zirconium cladding at high temperatures. This is true for mostly water-based
* coolants.
*/
boolean accumulatesHydrogen();


}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ public interface IFissionFuelStats {

/**
* Used internally to get the depleted fuel the first time; do not call this yourself!
*
* @return The depleted fuel to be put into the fuel registry.
*/
@NotNull
ItemStack getDepletedFuel();


}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public void addFuelRodPair() {
relatedFuelRodPairs++;
}


public void increaseWeight() {
weight++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public void addFuelRodPair() {
relatedFuelRodPairs++;
}


public double getWeight() {
return weight;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gregtech/api/unification/material/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,8 @@ public Builder fissionFuelProperties(int maxTemperature, int duration, double sl
}

public Builder coolant(Material hotHPCoolant, double moderatorFactor, double coolingFactor,
double boilingPoint,
double heatOfVaporization, double specificHeatCapacity) {
double boilingPoint,
double heatOfVaporization, double specificHeatCapacity) {
properties.ensureSet(PropertyKey.FLUID);
properties.setProperty(PropertyKey.COOLANT,
new CoolantProperty(hotHPCoolant, properties.getProperty(PropertyKey.FLUID).getPrimaryKey(),
Expand All @@ -1110,8 +1110,8 @@ public Builder coolant(Material hotHPCoolant, double moderatorFactor, double coo
}

public Builder coolant(Material hotHPCoolant, FluidStorageKey key, double moderatorFactor,
double coolingFactor, double boilingPoint,
double heatOfVaporization, double specificHeatCapacity) {
double coolingFactor, double boilingPoint,
double heatOfVaporization, double specificHeatCapacity) {
properties.ensureSet(PropertyKey.FLUID);
properties.setProperty(PropertyKey.COOLANT,
new CoolantProperty(hotHPCoolant, key, moderatorFactor, coolingFactor, boilingPoint,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/unification/ore/OrePrefix.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public class OrePrefix {
// 2 Plates combined in one Item
public static final OrePrefix plateDouble = new OrePrefix("plateDouble", M * 2, null, MaterialIconType.plateDouble,
ENABLE_UNIFICATION, hasIngotProperty
.and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING)));
.and(mat -> mat.hasFlags(GENERATE_PLATE, GENERATE_DOUBLE_PLATE) && !mat.hasFlag(NO_SMASHING)));
// Regular Plate made of one Ingot/Dust. Introduced by Calclavia
public static final OrePrefix plate = new OrePrefix("plate", M, null, MaterialIconType.plate, ENABLE_UNIFICATION,
mat -> mat.hasFlag(GENERATE_PLATE));
Expand Down Expand Up @@ -221,7 +221,7 @@ public class OrePrefix {
// made of 5 Ingots.
public static final OrePrefix turbineBlade = new OrePrefix("turbineBlade", M * 10, null,
MaterialIconType.turbineBlade, ENABLE_UNIFICATION, hasRotorProperty
.and(m -> m.hasFlags(GENERATE_BOLT_SCREW, GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM)));
.and(m -> m.hasFlags(GENERATE_BOLT_SCREW, GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM)));

public static final OrePrefix paneGlass = new OrePrefix("paneGlass", -1, MarkerMaterials.Color.Colorless, null,
SELF_REFERENCING, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import gregtech.common.metatileentities.MetaTileEntities;
import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityControlRodPort;
import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityCoolantExportHatch;
import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityFuelRodImportBus;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
Expand Down Expand Up @@ -375,26 +374,28 @@ public void updateFormedValid() {
canWork = false;
this.lockingState = LockingState.MISSING_FUEL;
break;
} /* TODO else if (!((MetaTileEntityFuelRodImportBus) fuelImport).getExportHatch(this.height - 1)
.getExportItems().insertItem(0,
OreDictUnifier.get(OrePrefix.fuelRodHotDepleted, fuelImport.getFuel()), true)
.isEmpty()) {
// We still need to know if the output is blocked, even if the recipe doesn't start
// yet
canWork = false;
this.lockingState = LockingState.FUEL_CLOGGED;
break;
}
*/
} /*
* TODO else if (!((MetaTileEntityFuelRodImportBus) fuelImport).getExportHatch(this.height -
* 1)
* .getExportItems().insertItem(0,
* OreDictUnifier.get(OrePrefix.fuelRodHotDepleted, fuelImport.getFuel()), true)
* .isEmpty()) {
* // We still need to know if the output is blocked, even if the recipe doesn't start
* // yet
* canWork = false;
* this.lockingState = LockingState.FUEL_CLOGGED;
* break;
* }
*/
}

for (IFuelRodHandler fuelImport : this.getAbilities(MultiblockAbility.IMPORT_FUEL_ROD)) {
if (fissionReactor.needsOutput) {
// TODO ((MetaTileEntityFuelRodImportBus) fuelImport).getExportHatch(this.height - 1)
// .getExportItems().insertItem(0,
// OreDictUnifier.get(OrePrefix.fuelRodHotDepleted,
// fuelImport.getPartialFuel()),
// false);
// TODO ((MetaTileEntityFuelRodImportBus) fuelImport).getExportHatch(this.height - 1)
// .getExportItems().insertItem(0,
// OreDictUnifier.get(OrePrefix.fuelRodHotDepleted,
// fuelImport.getPartialFuel()),
// false);
this.fissionReactor.fuelMass -= 60;
}
if (canWork) {
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.GregTechAPI;
import gregtech.api.capability.IControllable;
import gregtech.api.capability.IFuelRodHandler;
import gregtech.api.gui.GuiTextures;
Expand All @@ -12,12 +11,8 @@
import gregtech.api.metatileentity.multiblock.IFissionReactorHatch;
import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart;
import gregtech.api.metatileentity.multiblock.MultiblockAbility;
import gregtech.api.nuclear.fission.FissionFuelRegistry;
import gregtech.api.nuclear.fission.components.FuelRod;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.properties.CoolantProperty;
import gregtech.api.unification.material.properties.FissionFuelProperty;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.client.renderer.texture.Textures;
import gregtech.common.blocks.BlockFissionCasing;
import gregtech.common.blocks.MetaBlocks;
Expand Down Expand Up @@ -212,7 +207,6 @@ public FissionFuelProperty getPartialFuel() {

@Override
public boolean setPartialFuel(FissionFuelProperty prop) {

this.partialFuel = prop;
if (this.internalFuelRod != null) {
this.internalFuelRod.setFuel(prop);
Expand Down

0 comments on commit 259db88

Please sign in to comment.