Skip to content

Commit

Permalink
feat: revert the en-enterprisation
Browse files Browse the repository at this point in the history
  • Loading branch information
bruberu committed Jul 21, 2024
1 parent f2f18dc commit b2f41c2
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
Expand Down Expand Up @@ -214,6 +215,9 @@ public void addInformation(@NotNull ItemStack itemStack, @Nullable World worldIn
Material material = getMaterial(itemStack);
if (prefix == null || material == null) return;
addMaterialTooltip(lines, itemStack);
if (material.isRadioactive()) {
lines.add(I18n.format("metaitem.info.radioactive"));
}
}

/**
Expand Down
92 changes: 14 additions & 78 deletions src/main/java/gregtech/api/nuclear/fission/FissionReactor.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class FissionReactor {
/**
* Integers used on variables with direct player control for easier adjustments (normalize this to 0,1)
*/
private double controlRodInsertion;
public double controlRodInsertion;
private int reactorDepth;
private double reactorRadius;

Expand All @@ -61,13 +61,13 @@ public class FissionReactor {
/**
* Megawatts
*/
private double power;
public double power;

/**
* Temperature of the reactor
*/
private double temperature = roomTemperature;
private double pressure = standardPressure;
public double temperature = roomTemperature;
public double pressure = standardPressure;
private double exteriorPressure = standardPressure;
/**
* Temperature of boiling point in kelvin at standard pressure Determined by a weighted sum of the individual
Expand All @@ -92,19 +92,19 @@ public class FissionReactor {
* {@link FissionReactor#prepareInitialConditions()}
*/
private double coolantBaseTemperature;
private double maxFuelDepletion = 1;
private double fuelDepletion = -1;
public double maxFuelDepletion = 1;
public double fuelDepletion = -1;
private double neutronPoisonAmount; // can kill reactor if power is lowered and this value is high
private double decayProductsAmount;
private double envTemperature = roomTemperature; // maybe gotten from config per dim
private double accumulatedHydrogen;
public double accumulatedHydrogen;
private double weightedGenerationTime = 2; // The mean generation time in seconds, accounting for delayed neutrons

private double maxTemperature = 2000;
public double maxTemperature = 2000;
// Pascals
private double maxPressure = 15000000;
public double maxPressure = 15000000;
// In MW apparently
private double maxPower = 3; // determined by the amount of fuel in reactor and neutron matricies
public double maxPower = 3; // determined by the amount of fuel in reactor and neutron matricies
public static double zircaloyHydrogenReactionTemperature = 1500;

private double surfaceArea;
Expand All @@ -124,11 +124,11 @@ public class FissionReactor {
// very much changed here for balance purposes

private double coolantMass;
private double fuelMass;
public double fuelMass;
private double structuralMass;
private boolean needsOutput;
private boolean controlRodRegulationOn = true;
private boolean isOn = false;
public boolean needsOutput;
public boolean controlRodRegulationOn = true;
protected boolean isOn = false;

protected static double responseFunction(double target, double current, double criticalRate) {
if (current < 0) {
Expand Down Expand Up @@ -714,68 +714,4 @@ public void turnOff() {
effectiveControlRods.clear();
effectiveCoolantChannels.clear();
}

public double getTemperature() {
return temperature;
}

public double getMaxTemperature() {
return maxTemperature;
}

public double getkEff() {
return kEff;
}

public double getControlRodInsertion() {
return controlRodInsertion;
}

public double getPressure() {
return pressure;
}

public double getMaxPressure() {
return maxPressure;
}

public double getPower() {
return power;
}

public double getMaxPower() {
return maxPower;
}

public double getFuelDepletion() {
return fuelDepletion;
}

public double getMaxFuelDepletion() {
return maxFuelDepletion;
}

public double getAccumulatedHydrogen() {
return accumulatedHydrogen;
}

public void changeFuelMass(double amount) {
fuelMass += amount;
}

public boolean needsOutput() {
return needsOutput;
}

public void setNeedsOutput(boolean needsOutput) {
this.needsOutput = needsOutput;
}

public boolean isControlRodRegulationOn() {
return controlRodRegulationOn;
}

public void setControlRodRegulationOn(boolean controlRodRegulationOn) {
this.controlRodRegulationOn = controlRodRegulationOn;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package gregtech.api.unification.material.properties;

public class RadioactiveProperty implements IMaterialProperty {

@Override
public void verifyProperty(MaterialProperties properties) {
properties.ensureSet(PropertyKey.DUST, true);
}
}
2 changes: 1 addition & 1 deletion src/main/java/gregtech/client/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static void addNBTClearingTooltip(ItemTooltipEvent event) {
}
}

@SuppressWarnings("deprecation") // we need the deprecated I18n to match EnderCore in all cases
@SuppressWarnings("deprecation") // we need the deprecated I18n to match EnderCore in all cases
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void cleanupDebugTooltips(ItemTooltipEvent event) {
ItemStack stack = event.getItemStack();
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/gregtech/common/items/armor/QuarkTechSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,9 @@ public void addInfo(ItemStack itemStack, List<String> lines) {
lines.add(I18n.format("metaarmor.tooltip.jump"));
}
}

@Override
public float getRadiationResistance() {
return 0.25f;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ public double getFillPercentage(int index) {
*/
public void toggleControlRodRegulation(boolean b) {
if (fissionReactor != null) {
this.fissionReactor.setControlRodRegulationOn(b);
this.fissionReactor.controlRodRegulationOn = b;
}
}

public boolean areControlRodsRegulated() {
return fissionReactor != null && this.fissionReactor.isControlRodRegulationOn();
return fissionReactor != null && this.fissionReactor.controlRodRegulationOn;
}

@Override
Expand Down Expand Up @@ -395,21 +395,21 @@ public void updateFormedValid() {
}

for (IFuelRodHandler fuelImport : this.getAbilities(MultiblockAbility.IMPORT_FUEL_ROD)) {
if (fissionReactor.needsOutput()) {
if (fissionReactor.needsOutput) {
((MetaTileEntityFuelRodImportBus) fuelImport).getExportHatch(this.height - 1)
.getExportItems().insertItem(0,
FissionFuelRegistry.getDepletedFuel(fuelImport.getPartialFuel()),
false);
this.fissionReactor.changeFuelMass(-60);
this.fissionReactor.fuelMass -= 60;
}
if (canWork) {
fuelImport.getStackHandler().extractItem(0, 1, false);
needsReset |= fuelImport.setPartialFuel(fuelImport.getFuel());
this.fissionReactor.changeFuelMass(60);
this.fissionReactor.fuelMass += 60;
}
}
if (canWork) {
fissionReactor.setNeedsOutput(true);
fissionReactor.needsOutput = true;
this.fissionReactor.resetFuelDepletion();

if (needsReset) {
Expand All @@ -427,7 +427,7 @@ public void updateFormedValid() {

boolean melts = this.fissionReactor.checkForMeltdown();
boolean explodes = this.fissionReactor.checkForExplosion();
double hydrogen = this.fissionReactor.getAccumulatedHydrogen();
double hydrogen = this.fissionReactor.accumulatedHydrogen;
if (melts) {
this.performMeltdownEffects();
}
Expand Down Expand Up @@ -756,16 +756,16 @@ public void receiveInitialSyncData(PacketBuffer buf) {
}

public void syncReactorStats() {
this.temperature = this.fissionReactor.getTemperature();
this.maxTemperature = this.fissionReactor.getMaxTemperature();
this.pressure = this.fissionReactor.getPressure();
this.maxPressure = this.fissionReactor.getMaxPressure();
this.power = this.fissionReactor.getPower();
this.maxPower = this.fissionReactor.getMaxPower();
this.kEff = this.fissionReactor.getkEff();
this.controlRodInsertionValue = this.fissionReactor.getControlRodInsertion();
this.fuelDepletionPercent = Math.max(0, this.fissionReactor.getFuelDepletion()) /
this.fissionReactor.getMaxFuelDepletion();
this.temperature = this.fissionReactor.temperature;
this.maxTemperature = this.fissionReactor.maxTemperature;
this.pressure = this.fissionReactor.pressure;
this.maxPressure = this.fissionReactor.maxPressure;
this.power = this.fissionReactor.power;
this.maxPower = this.fissionReactor.maxPower;
this.kEff = this.fissionReactor.kEff;
this.controlRodInsertionValue = this.fissionReactor.controlRodInsertion;
this.fuelDepletionPercent = Math.max(0, this.fissionReactor.fuelDepletion) /
this.fissionReactor.maxFuelDepletion;
writeCustomData(GregtechDataCodes.SYNC_REACTOR_STATS, (packetBuffer -> {
packetBuffer.writeDouble(this.temperature);
packetBuffer.writeDouble(this.maxTemperature);
Expand Down Expand Up @@ -872,7 +872,7 @@ private void lockAndPrepareReactor() {
FuelRod component;
fuelIn.setFuel(stats);
foundFuel = true;
if (fissionReactor.getFuelDepletion() == 0 || fuelIn.getPartialFuel() == null) {
if (fissionReactor.fuelDepletion == 0 || fuelIn.getPartialFuel() == null) {
fuelIn.setPartialFuel(stats);
component = new FuelRod(stats.getMaxTemperature(), 1, stats, 650);
fuelIn.setInternalFuelRod(component);
Expand Down

0 comments on commit b2f41c2

Please sign in to comment.