Skip to content

Commit

Permalink
Merge branch 'nuclear-fission' into fission-fuels
Browse files Browse the repository at this point in the history
  • Loading branch information
planetme committed Jan 1, 2024
2 parents d7c4bad + 6f6f7ce commit 3ab49c7
Show file tree
Hide file tree
Showing 32 changed files with 404 additions and 65 deletions.
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;
}
}
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
Expand Up @@ -80,7 +80,7 @@ public class MultiblockAbility<T> {
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<IFluidTank> EXPORT_COOLANT = new MultiblockAbility<>("export_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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public double criticalCoolantFlow() {
return this.power / this.coolingFactor;
}

protected void prepareThermalProperties() {
public void prepareThermalProperties() {
int idRod = 0, idControl = 0, idChannel = 0;

for (int i = 0; i < reactorLayout.length; i++) {
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/gregtech/api/unification/Elements.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,19 @@ private Elements() {}
public static final Element U = add(92, 146, -1, null, "Uranium", "U", false);
public static final Element U238 = add(92, 146, -1, null, "Uranium-238", "U-238", false);
public static final Element U235 = add(92, 143, -1, null, "Uranium-235", "U-235", true);
public static final Element U239 = add(92, 147, -1, null, "Uranium-239", "U-239", true);
public static final Element Np = add(93, 144, -1, null, "Neptunium", "Np", false);
public static final Element Np235 = add(93, 142, -1, null, "Neptunium-235", "Np-235", true);
public static final Element Np236 = add(93, 143, -1, null, "Neptunium-236", "Np-236", true);
public static final Element Np237 = add(93, 144, -1, null, "Neptunium-237", "Np-237", true);
public static final Element Np239 = add(93, 146, -1, null, "Neptunium-239", "Np-239", true);
public static final Element Pu = add(94, 152, -1, null, "Plutonium", "Pu", false);
public static final Element Pu239 = add(94, 145, -1, null, "Plutonium-239", "Pu-239", false);
public static final Element Pu241 = add(94, 149, -1, null, "Plutonium-241", "Pu-241", true);
public static final Element Pu238 = add(94, 144, -1, null, "Plutonium-238", "Pu-238", true);
public static final Element Pu239 = add(94, 145, -1, null, "Plutonium-239", "Pu-239", true);
public static final Element Pu240 = add(94, 146, -1, null, "Plutonium-240", "Pu-240", true);
public static final Element Pu241 = add(94, 147, -1, null, "Plutonium-241", "Pu-241", true);
public static final Element Pu242 = add(94, 148, -1, null, "Plutonium-242", "Pu-242", true);
public static final Element Pu244 = add(94, 150, -1, null, "Plutonium-244", "Pu-244", true);
public static final Element Am = add(95, 150, -1, null, "Americium", "Am", false);
public static final Element Cm = add(96, 153, -1, null, "Curium", "Cm", false);
public static final Element Bk = add(97, 152, -1, null, "Berkelium", "Bk", false);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/unification/material/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,12 @@ public Builder fissionFuelProperties(int maxTemperature, int duration, double sl
return this;
}

public Builder coolantProperty(Material hotCoolant, Material hotHPCoolant, double moderatorFactor, double coolingFactor, double boilingPoint, double absorption, double pressure) {
properties.ensureSet(PropertyKey.FLUID);
properties.setProperty(PropertyKey.COOLANT, new CoolantProperty(hotCoolant, hotHPCoolant, moderatorFactor, coolingFactor, boilingPoint, absorption, pressure));
return this;
}

// TODO Clean this up post 2.5 release
@Deprecated
public Builder addDefaultEnchant(Enchantment enchant, int level) {
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/gregtech/api/unification/material/Materials.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ public static void register() {
public static Material Neodymium;
public static Material Neon;
public static Material Neptunium;
public static Material Neptunium235;
public static Material Neptunium236;
public static Material Neptunium237;
public static Material Neptunium239;
public static Material Nickel;
public static Material Nihonium;
public static Material Niobium;
Expand All @@ -212,8 +216,12 @@ public static void register() {
public static Material Phosphorus;
public static Material Polonium;
public static Material Platinum;
public static Material Plutonium238;
public static Material Plutonium239;
public static Material Plutonium240;
public static Material Plutonium241;
public static Material Plutonium242;
public static Material Plutonium244;
public static Material Potassium;
public static Material Praseodymium;
public static Material Promethium;
Expand Down Expand Up @@ -247,8 +255,10 @@ public static void register() {
public static Material Titanium;
public static Material Tritium;
public static Material Tungsten;
public static Material Uranium238;
public static Material Uranium;
public static Material Uranium235;
public static Material Uranium238;
public static Material Uranium239;
public static Material Vanadium;
public static Material Xenon;
public static Material Ytterbium;
Expand Down Expand Up @@ -479,6 +489,10 @@ public static void register() {
public static Material Zircaloy;
public static Material Inconel;
public static Material RTMAlloy;
public static Material EnrichedUraniumDioxide;
public static Material DepletedUraniumDioxide;
public static Material HighPressureSteam;
public static Material Plutonium239Dioxide;

/**
* Organic chemistry
Expand Down Expand Up @@ -694,6 +708,7 @@ public static void register() {
public static Material Lapotron;
public static Material UUMatter;
public static Material PCBCoolant;
public static Material Corium;

/**
* Second Degree Compounds
Expand Down Expand Up @@ -752,6 +767,10 @@ public static void register() {
public static Material Clay;
public static Material Redstone;
public static Material ThoriumFLiBe;
public static Material LEU235;
public static Material HEU235;
public static Material LowGradeMOX;
public static Material HighGradeMOX;

/**
* Third Degree Materials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public class MaterialIconType {

public static final MaterialIconType turbineBlade = new MaterialIconType("turbineBlade");

public static final MaterialIconType fuelRod = new MaterialIconType("fuelRod");
public static final MaterialIconType fuelRodDepleted = new MaterialIconType("fuelRodDepleted");
public static final MaterialIconType fuelRodHotDepleted = new MaterialIconType("fuelRodHotDepleted");

// BLOCK TEXTURES
public static final MaterialIconType liquid = new MaterialIconType("liquid");
public static final MaterialIconType gas = new MaterialIconType("gas");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,12 +864,12 @@ public static void register() {
.vacuumStats(VA[HV], 300))
.build();

Uranium238 = new Material.Builder(116, gregtechId("uranium"))
Uranium = new Material.Builder(116, gregtechId("uranium"))
.ingot(3)
.liquid(new FluidBuilder().temperature(1405))
.color(0x32F032).iconSet(METALLIC)
.flags(EXT_METAL)
.element(Elements.U238)
.element(Elements.U)
.fluidTemp(1405)
.fissionFuelProperties(400, 40, 0.1, 0.1, 0.1, 0.1)
.build();
Expand Down Expand Up @@ -1009,5 +1009,69 @@ public static void register() {
.blastStats(VA[LuV], 1500)
.vacuumStats(VA[IV], 300))
.build();

Uranium238 = new Material.Builder(131, gregtechId("uranium_238"))
.ingot(3)
.liquid(new FluidBuilder().temperature(1405))
.color(0x46FA46).iconSet(SHINY)
.flags(EXT_METAL)
.element(Elements.U238)
.build();

Uranium239 = new Material.Builder(132, gregtechId("uranium_239"))
.ingot(3)
.liquid(new FluidBuilder().temperature(1405))
.color(0x46FA46).iconSet(SHINY)
.flags(EXT_METAL)
.element(Elements.U239)
.build();

Neptunium235 = new Material.Builder(133, gregtechId("neptunium_235"))
.color(0x284D7B).iconSet(METALLIC)
.element(Elements.Np235)
.build();

Neptunium236 = new Material.Builder(134, gregtechId("neptunium_236"))
.color(0x284D7B).iconSet(METALLIC)
.element(Elements.Np236)
.build();

Neptunium237 = new Material.Builder(135, gregtechId("neptunium_237"))
.color(0x284D7B).iconSet(METALLIC)
.element(Elements.Np237)
.build();

Neptunium239 = new Material.Builder(136, gregtechId("neptunium_239"))
.color(0x284D7B).iconSet(METALLIC)
.element(Elements.Np239)
.build();

Plutonium238 = new Material.Builder(137, gregtechId("plutonium_238"))
.ingot(3)
.liquid(new FluidBuilder().temperature(913))
.color(0xF03232).iconSet(METALLIC)
.element(Elements.Pu238)
.build();

Plutonium240 = new Material.Builder(138, gregtechId("plutonium_240"))
.ingot(3)
.liquid(new FluidBuilder().temperature(913))
.color(0xF03232).iconSet(METALLIC)
.element(Elements.Pu240)
.build();

Plutonium242 = new Material.Builder(139, gregtechId("plutonium_242"))
.ingot(3)
.liquid(new FluidBuilder().temperature(913))
.color(0xF03232).iconSet(METALLIC)
.element(Elements.Pu242)
.build();

Plutonium244 = new Material.Builder(140, gregtechId("plutonium_244"))
.ingot(3)
.liquid(new FluidBuilder().temperature(913))
.color(0xF03232).iconSet(METALLIC)
.element(Elements.Pu244)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import gregtech.api.fluids.FluidState;
import gregtech.api.fluids.attribute.FluidAttributes;
import gregtech.api.fluids.store.FluidStorageKeys;
import gregtech.api.nuclear.fission.FissionReactor;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.properties.BlastProperty.GasTier;
import gregtech.api.unification.material.properties.PropertyKey;
Expand Down Expand Up @@ -675,7 +676,7 @@ public static void register() {
.dust(3).ore(true)
.color(0x232323).iconSet(METALLIC)
.flags(DISABLE_DECOMPOSITION)
.components(Uranium238, 1, Oxygen, 2)
.components(Uranium, 1, Oxygen, 2)
.build()
.setFormula("UO2", true);

Expand Down Expand Up @@ -1214,7 +1215,7 @@ public static void register() {
.gas()
.color(0x42D126)
.flags(DISABLE_DECOMPOSITION)
.components(Uranium238, 1, Fluorine, 6)
.components(Uranium, 1, Fluorine, 6)
.build()
.setFormula("UF6", true);

Expand All @@ -1230,7 +1231,7 @@ public static void register() {
.gas()
.color(0x74BA66)
.flags(DISABLE_DECOMPOSITION)
.components(Uranium238, 1, Fluorine, 6)
.components(Uranium, 1, Fluorine, 6)
.build()
.setFormula("UF6", true);

Expand Down Expand Up @@ -1285,6 +1286,7 @@ public static void register() {
.liquid(new FluidBuilder().alternativeName("fluidDistWater"))
.color(0x4A94FF)
.flags(DISABLE_DECOMPOSITION)
.coolantProperty(Steam, HighPressureSteam, 1., 1., 373, 10., FissionReactor.standardPressure)
.components(Hydrogen, 2, Oxygen, 1)
.build();

Expand Down Expand Up @@ -1347,7 +1349,7 @@ public static void register() {
.liquid(new FluidBuilder().temperature(1882))
.color(0x008700).iconSet(SHINY)
.flags(DECOMPOSITION_BY_CENTRIFUGING)
.components(Uranium238, 1, Platinum, 3)
.components(Uranium, 1, Platinum, 3)
.cableProperties(GTValues.V[GTValues.EV], 6, 0, true, 30)
.blast(b -> b
.temp(4400, GasTier.MID)
Expand Down Expand Up @@ -1387,7 +1389,7 @@ public static void register() {
.liquid(new FluidBuilder().temperature(3410))
.color(0x0A0A0A)
.flags(DECOMPOSITION_BY_CENTRIFUGING, GENERATE_FINE_WIRE)
.components(Uranium238, 1, Rhodium, 1, Naquadah, 2)
.components(Uranium, 1, Rhodium, 1, Naquadah, 2)
.cableProperties(GTValues.V[GTValues.ZPM], 8, 0, true, 5)
.blast(b -> b
.temp(9000, GasTier.HIGH)
Expand Down Expand Up @@ -1638,5 +1640,22 @@ public static void register() {
.blastTemp(1610, GasTier.MID, GTValues.VA[EV], 200)
.build()
.setFormula("Ni50Cr20Fe20Ni5Mo3", true);

HighPressureSteam = new Material.Builder(463, gregtechId("high_pressure_steam"))
.gas(new FluidBuilder()
.temperature(500)
.customStill())
.color(0xC4C4C4)
.flags(DISABLE_DECOMPOSITION)
.components(Hydrogen, 2, Oxygen, 1)
.build();

Plutonium239Dioxide = new Material.Builder(464, gregtechId("plutonium_239_dioxide"))
.dust(3)
.color(0xF03232).iconSet(DULL)
.flags(DISABLE_DECOMPOSITION)
.components(Uranium235, 1, Oxygen, 2)
.build()
.setFormula("PuO2", true);
}
}
Loading

0 comments on commit 3ab49c7

Please sign in to comment.