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

Fission fuel recipes #2134

Closed
wants to merge 129 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
f07fa2f
Start of work on nuclear fission
Zalgo239 Apr 7, 2023
8c6b032
Start implementation of reactor states
Zalgo239 Apr 7, 2023
6ac58bf
Smoother transitions and better logic
Zalgo239 Apr 11, 2023
63a546f
More reactor states
Zalgo239 Apr 16, 2023
1716fe4
Reorganising packages
Zalgo239 Apr 19, 2023
7f5508f
Other nuclear components
Zalgo239 Apr 19, 2023
70d6087
New material properties
Zalgo239 Apr 19, 2023
b72e12f
Basic stats for nuclear properties
Zalgo239 Apr 19, 2023
e06679f
Keys for the new properties
Zalgo239 Apr 19, 2023
040bd53
Large amount of reactor calculations
Zalgo239 Apr 24, 2023
bbb82de
Significantly improved and simplified logic
Zalgo239 May 2, 2023
ba03956
Reactor stats calculation cleanup
Zalgo239 May 5, 2023
514ad22
Fission Reactor meta tile entity
Zalgo239 May 5, 2023
8cf0bc2
Fission reactor rebase
Zalgo239 May 10, 2023
b9d3b20
Start of work on reactor multiblock structure logic
Zalgo239 May 11, 2023
35d3c6e
Proper handling of minimum and maximum dimensions
Zalgo239 May 11, 2023
ee0eb05
More reactor structure logic
Zalgo239 May 12, 2023
8a60616
Fixed height calculation and extra tricorder info
Zalgo239 May 12, 2023
6627f51
Reactor dimensions NBT saving
Zalgo239 May 14, 2023
4b22672
Extra structure pattern checks
Zalgo239 May 14, 2023
d9be750
Rebase and fixes due to changes to IMaterialProperty
Zalgo239 May 29, 2023
6b63114
Start work on custom hatches for fission reactor
Zalgo239 May 31, 2023
b7092e9
Added UI for the fuel rod hatch
Zalgo239 Jun 1, 2023
7b44bc0
Added fuel rod output hatch
Zalgo239 Jun 6, 2023
bf6794f
API fixes and fuel rod hatch rendering
Zalgo239 Jun 6, 2023
04b8fa0
Fix fuel rod hatches orientations
Zalgo239 Jun 13, 2023
0a179e0
Add coolant hatches and control rod port
Zalgo239 Jun 13, 2023
0c862d1
Fission reactor component names localisation
Zalgo239 Jun 13, 2023
76f94a8
Add hatches to the fission reactor's structure
bruberu Jun 19, 2023
f0794e0
Fuel rod hatch, coolant hatch, and control rod hatch checks put in place
bruberu Jun 20, 2023
38604ee
Allow coolant import and fuel rod import hatches to be locked
bruberu Jun 20, 2023
8d9eae4
Basic work on actually constructing the reactor (doesn't compile)
bruberu Jun 21, 2023
399d14c
Complete nuclear reactor checks (but apparently locking needs to be c…
bruberu Jun 25, 2023
9c1ea7e
Proper server-to-client locking sync
bruberu Jun 28, 2023
fe081a3
Start thinking about how to actually update the fission reactor
bruberu Jul 5, 2023
6aee10d
Reactor state update order
Zalgo239 Jul 13, 2023
2569ed9
Reactor failiure checks
Zalgo239 Jul 13, 2023
2b7c254
Merge branch 'master' into nuclear-fission
bruberu Jul 18, 2023
aa229ee
Fix MTE ID conflicts
Zalgo239 Aug 16, 2023
34c01a7
Refactor logic to remove coolant headaches
Zalgo239 Aug 16, 2023
51a1116
Coolant consumption logic
Zalgo239 Aug 17, 2023
cbe20cf
Remove unecessary variable
Zalgo239 Aug 17, 2023
5f2a1ca
Make reactor consume the fuel
Zalgo239 Aug 31, 2023
ef497a3
Add components for gas centrifuges and spent fuel pool
Zalgo239 Aug 31, 2023
19ad215
Added spent fuel pool multiblock
Zalgo239 Sep 2, 2023
9655e89
Added totally original and not copied from susycore heat exchanger code
Zalgo239 Sep 3, 2023
f52f0c2
New epic paneling for spent fuel pools and other decor
Zalgo239 Sep 4, 2023
5438298
Spent fuel pool structure changes and light on spent fuel casings
Zalgo239 Sep 7, 2023
b933193
Blocks cleanup
Zalgo239 Sep 7, 2023
ef7e64f
Structure fixes
Zalgo239 Sep 7, 2023
7a64aa1
Remove unused import
Zalgo239 Sep 7, 2023
2248b80
Textures for the empty fuel casings variant
Zalgo239 Sep 15, 2023
a43a858
Remove light from nuclear casings
Zalgo239 Sep 16, 2023
2624650
Fix inactive variant being emissive
Zalgo239 Sep 16, 2023
e232d8a
Remove unused defaults
Zalgo239 Sep 16, 2023
4b84466
Added gas centrifuge multiblock
Zalgo239 Sep 16, 2023
250e802
Thorium
planetme Oct 21, 2023
e0814ac
Uranium
planetme Oct 29, 2023
22bc3c4
fix fuel rods
planetme Oct 30, 2023
f3358da
add natural uranium pellets for HWRs
planetme Oct 30, 2023
8a473cd
Start of work on nuclear fission
Zalgo239 Apr 7, 2023
b490d71
Start implementation of reactor states
Zalgo239 Apr 7, 2023
ed0dc91
Smoother transitions and better logic
Zalgo239 Apr 11, 2023
fd22c45
More reactor states
Zalgo239 Apr 16, 2023
601436e
Reorganising packages
Zalgo239 Apr 19, 2023
9edccb3
Other nuclear components
Zalgo239 Apr 19, 2023
14b854a
New material properties
Zalgo239 Apr 19, 2023
51fde73
Basic stats for nuclear properties
Zalgo239 Apr 19, 2023
a88e2ff
Keys for the new properties
Zalgo239 Apr 19, 2023
1e875bc
Large amount of reactor calculations
Zalgo239 Apr 24, 2023
253a4f9
Significantly improved and simplified logic
Zalgo239 May 2, 2023
b0d5268
Reactor stats calculation cleanup
Zalgo239 May 5, 2023
8f78bd2
Fission Reactor meta tile entity
Zalgo239 May 5, 2023
1830bca
Fission reactor rebase
Zalgo239 May 10, 2023
7c9cc8d
Start of work on reactor multiblock structure logic
Zalgo239 May 11, 2023
514da0a
Proper handling of minimum and maximum dimensions
Zalgo239 May 11, 2023
0b9cec8
More reactor structure logic
Zalgo239 May 12, 2023
c4b765f
Fixed height calculation and extra tricorder info
Zalgo239 May 12, 2023
8425498
Reactor dimensions NBT saving
Zalgo239 May 14, 2023
daa2bd9
Extra structure pattern checks
Zalgo239 May 14, 2023
12908bd
Rebase and fixes due to changes to IMaterialProperty
Zalgo239 May 29, 2023
64bb03b
Start work on custom hatches for fission reactor
Zalgo239 May 31, 2023
f564121
Added UI for the fuel rod hatch
Zalgo239 Jun 1, 2023
c495bfe
Added fuel rod output hatch
Zalgo239 Jun 6, 2023
be33b9c
API fixes and fuel rod hatch rendering
Zalgo239 Jun 6, 2023
f6b7e89
Fix fuel rod hatches orientations
Zalgo239 Jun 13, 2023
e1bd07c
Add coolant hatches and control rod port
Zalgo239 Jun 13, 2023
ed8a300
Fission reactor component names localisation
Zalgo239 Jun 13, 2023
d0ee769
Add hatches to the fission reactor's structure
bruberu Jun 19, 2023
69b38f7
Fuel rod hatch, coolant hatch, and control rod hatch checks put in place
bruberu Jun 20, 2023
17357a3
Allow coolant import and fuel rod import hatches to be locked
bruberu Jun 20, 2023
73928f8
Basic work on actually constructing the reactor (doesn't compile)
bruberu Jun 21, 2023
607b76b
Complete nuclear reactor checks (but apparently locking needs to be c…
bruberu Jun 25, 2023
bd664f3
Proper server-to-client locking sync
bruberu Jun 28, 2023
4d26450
Start thinking about how to actually update the fission reactor
bruberu Jul 5, 2023
63196e3
Reactor state update order
Zalgo239 Jul 13, 2023
b059cdd
Reactor failiure checks
Zalgo239 Jul 13, 2023
d299a1f
Fix MTE ID conflicts
Zalgo239 Aug 16, 2023
712a546
Refactor logic to remove coolant headaches
Zalgo239 Aug 16, 2023
f3f690c
Coolant consumption logic
Zalgo239 Aug 17, 2023
4c1287f
Remove unecessary variable
Zalgo239 Aug 17, 2023
fb28068
Make reactor consume the fuel
Zalgo239 Aug 31, 2023
4bbb47a
Add components for gas centrifuges and spent fuel pool
Zalgo239 Aug 31, 2023
266fdb5
Added spent fuel pool multiblock
Zalgo239 Sep 2, 2023
33bc1ba
Added totally original and not copied from susycore heat exchanger code
Zalgo239 Sep 3, 2023
bc4d077
New epic paneling for spent fuel pools and other decor
Zalgo239 Sep 4, 2023
2dc93b7
Spent fuel pool structure changes and light on spent fuel casings
Zalgo239 Sep 7, 2023
c4d35c5
Blocks cleanup
Zalgo239 Sep 7, 2023
3127492
Structure fixes
Zalgo239 Sep 7, 2023
b926f1f
Remove unused import
Zalgo239 Sep 7, 2023
c06ff16
Textures for the empty fuel casings variant
Zalgo239 Sep 15, 2023
82e680e
Remove light from nuclear casings
Zalgo239 Sep 16, 2023
518160c
Fix inactive variant being emissive
Zalgo239 Sep 16, 2023
b56ae31
Remove unused defaults
Zalgo239 Sep 16, 2023
dcefad5
Added gas centrifuge multiblock
Zalgo239 Sep 16, 2023
1dc4c1c
fixes
serenibyss Dec 7, 2023
39be480
spotless
serenibyss Dec 7, 2023
aa31104
a couple spotless cleanups
serenibyss Dec 7, 2023
0f54353
some textures & materials
planetme Dec 7, 2023
d7c4bad
Merge branch 'nuclear-fission' into fission-fuels
planetme Dec 7, 2023
77ec16d
Added consequences for failures
Zalgo239 Dec 23, 2023
c9300f6
Hot coolant output logic
Zalgo239 Dec 28, 2023
7471f5d
Radiation damage from items and fuel rods
Zalgo239 Dec 28, 2023
68ecc7f
Add item models and textures
Zalgo239 Dec 30, 2023
671f3b3
Add coolant properties to material builder
Zalgo239 Dec 30, 2023
0023817
Fix reactor not outputting the correct coolant
Zalgo239 Dec 31, 2023
c885d19
Fix U238 being used as natural uranium
Zalgo239 Dec 31, 2023
6f6f7ce
Added more nuclear materials
Zalgo239 Dec 31, 2023
3ab49c7
Merge branch 'nuclear-fission' into fission-fuels
planetme Jan 1, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,17 @@ public static int assignId() {
// Detector Covers
public static final int UPDATE_INVERTED = assignId();

// Fission Hatches
public static final int LOCK_UPDATE = 17;

// HPCA / Research Station
public static final int DAMAGE_STATE = assignId();
public static final int LOCK_OBJECT_HOLDER = assignId();
public static final int CACHED_CWU = assignId();

// Fission Hatches
public static final int LOCK_UPDATE = 17;

// NBT Keys

// From MetaTileEntityHolder
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/gregtech/api/capability/ICoolantHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gregtech.api.capability;

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

public interface ICoolantHandler extends ILockableHandler {

Material getCoolant();

void setCoolant(Material material);

LockableFluidTank getFluidTank();
}
13 changes: 13 additions & 0 deletions src/main/java/gregtech/api/capability/IFuelRodHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gregtech.api.capability;

import gregtech.api.items.itemhandlers.LockableItemStackHandler;
import gregtech.api.unification.material.Material;

public interface IFuelRodHandler extends ILockableHandler {

Material getFuel();

void setFuel(Material material);

LockableItemStackHandler getStackHandler();
}
8 changes: 8 additions & 0 deletions src/main/java/gregtech/api/capability/ILockableHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package gregtech.api.capability;

public interface ILockableHandler {

void setLock(boolean isLocked);

boolean isLocked();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package gregtech.api.capability.impl;

import gregtech.api.capability.ILockableHandler;
import gregtech.api.metatileentity.MetaTileEntity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;

public class LockableFluidTank extends NotifiableFluidTank implements ILockableHandler {
boolean locked;
Fluid lockedFluid;

public LockableFluidTank(int capacity, MetaTileEntity entityToNotify, boolean isExport) {
super(capacity, entityToNotify, isExport);
}

@Override
public void setLock(boolean isLocked) {
locked = isLocked;
if (isLocked) {
if (this.getFluid() == null)
lockedFluid = null;
else
lockedFluid = this.getFluid().getFluid();
}
}

@Override
public boolean isLocked() {
return locked;
}

@Override
public boolean canFillFluidType(FluidStack fluid) {
if (locked && fluid.getFluid() != lockedFluid) {
return false;
}
return super.canFillFluidType(fluid);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package gregtech.api.capability.impl;

import gregtech.api.GTValues;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.recipes.logic.OverclockingLogic;
import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage;

import org.jetbrains.annotations.NotNull;

public class NoEnergyMultiblockRecipeLogic extends MultiblockRecipeLogic {

public NoEnergyMultiblockRecipeLogic(RecipeMapMultiblockController tileEntity) {
super(tileEntity);
}

protected long getEnergyInputPerSecond() {
return 2147483647L;
}

protected long getEnergyStored() {
return 0L;
}

protected long getEnergyCapacity() {
return 2147483647L;
}

protected boolean drawEnergy(int recipeEUt, boolean simulate) {
return true;
}

public long getMaxVoltage() {
return 1L;
}

protected int[] runOverclockingLogic(@NotNull IRecipePropertyStorage propertyStorage, int recipeEUt,
long maxVoltage, int recipeDuration, int amountOC) {
return OverclockingLogic.standardOverclockingLogic(1, this.getMaxVoltage(), recipeDuration, amountOC,
this.getOverclockingDurationDivisor(), this.getOverclockingVoltageMultiplier());
}

public long getMaximumOverclockVoltage() {
return GTValues.V[1];
}

public void invalidate() {
this.previousRecipe = null;
this.progressTime = 0;
this.maxProgressTime = 0;
this.recipeEUt = 0;
this.fluidOutputs = null;
this.itemOutputs = null;
this.setActive(false);
}
}
8 changes: 8 additions & 0 deletions src/main/java/gregtech/api/items/armor/IArmorLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,12 @@ default ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemSt
default float getHeatResistance() {
return 1.0f;
}

/**
*
* @return the value to multiply radiation damage by
*/
default float getRadiationResistance() {
return 1.0f;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package gregtech.api.items.itemhandlers;

import gregtech.api.capability.ILockableHandler;
import gregtech.api.capability.impl.NotifiableItemStackHandler;
import gregtech.api.metatileentity.MetaTileEntity;

import net.minecraft.item.ItemStack;

import org.jetbrains.annotations.NotNull;

// TODO This class can be removed
public class LockableItemStackHandler extends NotifiableItemStackHandler implements ILockableHandler {

protected boolean locked;
protected ItemStack lockedItemStack;

public LockableItemStackHandler(MetaTileEntity entityToNotify, boolean isExport) {
super(entityToNotify, 1, entityToNotify, isExport);
}

@Override
public void setLock(boolean isLocked) {
this.locked = isLocked;
if (isLocked)
lockedItemStack = this.getStackInSlot(0).copy();
}

public boolean isLocked() {
return this.locked;
}

@NotNull
@Override
public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) {
if (this.locked) {
if (!this.lockedItemStack.isItemEqual(stack)) {
return stack;
}
}
return super.insertItem(slot, stack, simulate);
}
}
58 changes: 42 additions & 16 deletions src/main/java/gregtech/api/items/materialitem/MetaPrefixItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ private static void registerSpecialOreDict(ItemStack item, Material material, Or

if (material == Materials.Plutonium239) {
OreDictUnifier.registerOre(item, prefix.name() + material.toCamelCaseString() + "239");
} else if (material == Materials.Uranium238) {
OreDictUnifier.registerOre(item, prefix.name() + material.toCamelCaseString() + "238");
} else if (material == Materials.Uranium) {
OreDictUnifier.registerOre(item, prefix.name() + material.toCamelCaseString());
} else if (material == Materials.Saltpeter) {
OreDictUnifier.registerOre(item, prefix.name() + material.toCamelCaseString());
}
Expand Down Expand Up @@ -157,23 +157,49 @@ public void onUpdate(@NotNull ItemStack itemStack, @NotNull World worldIn, @NotN
super.onUpdate(itemStack, worldIn, entityIn, itemSlot, isSelected);
if (metaItems.containsKey((short) itemStack.getItemDamage()) && entityIn instanceof EntityLivingBase entity) {
if (entityIn.ticksExisted % 20 == 0) {
if (prefix.heatDamageFunction == null) return;

Material material = getMaterial(itemStack);
if (material == null || !material.hasProperty(PropertyKey.BLAST)) return;

float heatDamage = prefix.heatDamageFunction.apply(material.getBlastTemperature());
ItemStack armor = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem<?>) {
ArmorMetaItem<?>.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem<?>) armor.getItem())
.getItem(armor);
if (metaValueItem != null) heatDamage *= metaValueItem.getArmorLogic().getHeatResistance();
//Handle heat damage
if (prefix.heatDamageFunction != null) {
Material material = getMaterial(itemStack);
if (material != null) {
float heatDamage = 0.f;
if (material.hasProperty(PropertyKey.BLAST)) {
heatDamage = prefix.heatDamageFunction.apply(material.getBlastTemperature());
} else if (material.hasProperty(PropertyKey.FISSION_FUEL)) {
heatDamage = prefix.heatDamageFunction.apply(0);
}
ItemStack armor = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem<?>) {
ArmorMetaItem<?>.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem<?>) armor.getItem())
.getItem(armor);
if (metaValueItem != null) heatDamage *= metaValueItem.getArmorLogic().getHeatResistance();
}
if (heatDamage > 0.0) {
entity.attackEntityFrom(DamageSources.getHeatDamage().setDamageBypassesArmor(), heatDamage);
} else if (heatDamage < 0.0) {
entity.attackEntityFrom(DamageSources.getFrostDamage().setDamageBypassesArmor(),
-heatDamage);
}
}
}

if (heatDamage > 0.0) {
entity.attackEntityFrom(DamageSources.getHeatDamage().setDamageBypassesArmor(), heatDamage);
} else if (heatDamage < 0.0) {
entity.attackEntityFrom(DamageSources.getFrostDamage().setDamageBypassesArmor(), -heatDamage);
//Handle radiation damage
if (prefix.radiationDamageFunction != null) {
Material material = getMaterial(itemStack);
if (material != null) {
float radiationDamage = prefix.radiationDamageFunction.apply(material.getNeutrons());
ItemStack armor = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (!armor.isEmpty() && armor.getItem() instanceof ArmorMetaItem<?>) {
ArmorMetaItem<?>.ArmorMetaValueItem metaValueItem = ((ArmorMetaItem<?>) armor.getItem())
.getItem(armor);
if (metaValueItem != null) {
radiationDamage *= metaValueItem.getArmorLogic().getRadiationResistance();
}
}
if (radiationDamage > 0.0) {
entity.attackEntityFrom(DamageSources.getRadioactiveDamage().setDamageBypassesArmor(), radiationDamage);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package gregtech.api.metatileentity.multiblock;

public interface IControlRodPort {
byte getInsertionAmount();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package gregtech.api.metatileentity.multiblock;

public interface IFissionReactorHatch {

/**
*
* @param depth The depth of the reactor that needs checking
* @return If the channel directly below the hatch is valid or not
*/
boolean checkValidity(int depth);

boolean isValid();

void setValid(boolean valid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ public class MultiblockAbility<T> {
"hpca_component");
public static final MultiblockAbility<IObjectHolder> OBJECT_HOLDER = new MultiblockAbility<>("object_holder");

public static final MultiblockAbility<IFuelRodHandler> IMPORT_FUEL_ROD = new MultiblockAbility<>("import_fuel_rod");
public static final MultiblockAbility<IItemHandlerModifiable> EXPORT_FUEL_ROD = new MultiblockAbility<>(
"export_fuel_rod");
public static final MultiblockAbility<ICoolantHandler> IMPORT_COOLANT = new MultiblockAbility<>("import_coolant");
public static final MultiblockAbility<ICoolantHandler> EXPORT_COOLANT = new MultiblockAbility<>("export_coolant");
public static final MultiblockAbility<IControlRodPort> CONTROL_ROD_PORT = new MultiblockAbility<>(
"control_rod_port");

public static void registerMultiblockAbility(MultiblockAbility<?> ability, MetaTileEntity part) {
if (!REGISTRY.containsKey(ability)) {
REGISTRY.put(ability, new ArrayList<>());
Expand Down
Loading