Skip to content

Commit

Permalink
pollution fixes (#1417)
Browse files Browse the repository at this point in the history
  • Loading branch information
screret authored Jun 19, 2024
1 parent 0977e77 commit cb7d336
Show file tree
Hide file tree
Showing 70 changed files with 1,101 additions and 406 deletions.
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ dependencies {
include(forge.configuration)

// Shimmer
modImplementation(forge.shimmer.forge) { transitive = false }
modImplementation("maven.modrinth:embeddium:0.2.10+mc1.20.1")
modImplementation("maven.modrinth:oculus:1.20.1-1.6.9")
modCompileOnly(forge.shimmer.forge) { transitive = false }
modImplementation("maven.modrinth:embeddium:0.3.19+mc1.20.1")
modImplementation("maven.modrinth:oculus:1.20.1-1.7.0")

// Runtime only testing mods
//modRuntimeOnly(forge.worldStripper)
Expand Down
13 changes: 11 additions & 2 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"behavior.portable_scanner.environmental_hazard": "ɯdd %s - ɹ§%s :ʞunɥƆ uI pɹɐzɐH ןɐʇuǝɯuoɹıʌuƎ",
"behavior.portable_scanner.environmental_hazard.nothing": "ɹ§buıɥʇoN9§ :ʞunɥƆ uI pɹɐzɐH ןɐʇuǝɯuoɹıʌuƎ",
"behavior.portable_scanner.eu_per_sec": "ʇ/∩Ǝ %s :)puoɔǝs ʇsɐן( ǝbɐɹǝʌⱯ",
"behavior.portable_scanner.local_hazard": "ɯdd %s - ɹ§%s :ʞunɥƆ uI pɹɐzɐH ןɐɔoꞀ",
"behavior.portable_scanner.local_hazard.nothing": "ɹ§buıɥʇoN9§ :ʞunɥƆ uI pɹɐzɐH ןɐɔoꞀ",
"behavior.portable_scanner.local_hazard": "ɯdd %s - ɹ§%s :ɐǝɹⱯ uI pɹɐzɐH ןɐɔoꞀ",
"behavior.portable_scanner.local_hazard.nothing": "ɹ§buıɥʇoN9§ :ɐǝɹⱯ uI pɹɐzɐH ןɐɔoꞀ",
"behavior.portable_scanner.machine_disabled": "˙pǝןqɐsıᗡ",
"behavior.portable_scanner.machine_front_facing": "%s :buıɔɐℲ ʇuoɹℲ",
"behavior.portable_scanner.machine_power_loss": "˙ssoן ɹǝʍod oʇ ǝnp uʍop ʇnɥS",
Expand Down Expand Up @@ -2062,6 +2062,7 @@
"config.gtceu.option.energy": "ʎbɹǝuǝ",
"config.gtceu.option.energyConsumption": "uoıʇdɯnsuoƆʎbɹǝuǝ",
"config.gtceu.option.energyUsageMultiplier": "ɹǝıןdıʇןnWǝbɐs∩ʎbɹǝuǝ",
"config.gtceu.option.environmentalHazardDecayRate": "ǝʇɐᴚʎɐɔǝᗡpɹɐzɐHןɐʇuǝɯuoɹıʌuǝ",
"config.gtceu.option.environmentalHazards": "spɹɐzɐHןɐʇuǝɯuoɹıʌuǝ",
"config.gtceu.option.euToPlatformRatio": "oıʇɐᴚɯɹoɟʇɐןԀo⟘nǝ",
"config.gtceu.option.flintAndSteelRequireSteel": "ןǝǝʇSǝɹınbǝᴚןǝǝʇSpuⱯʇuıןɟ",
Expand Down Expand Up @@ -2458,6 +2459,7 @@
"gtceu.debug.f3_h.enabled": "ǝɹoɯ ǝǝs oʇ ǝןıɟ bıɟuoɔ ɥɔǝ⟘bǝɹ⅁ ǝɥʇ uı uoıʇdo bıɟuoɔ bnqǝp:ɔsıɯ ǝɥʇ ǝןqɐuǝ :sɹǝdoןǝʌǝᗡ ɹoℲ ¡oɟuı bnqǝp ǝɥʇ pǝıɟıpoɯ sɐɥ ɥɔǝ⟘bǝɹ⅁",
"gtceu.distillation_tower": "ɹǝʍo⟘ uoıʇɐןןıʇsıᗡ",
"gtceu.distillery": "ʎɹǝןןıʇsıᗡ",
"gtceu.duct_pipe.transfer_rate": "%s :ǝʇɐɹ ɹǝɟsuɐɹʇ ɹıⱯq§",
"gtceu.electric_blast_furnace": "ǝɔɐuɹnℲ ʇsɐןᗺ ɔıɹʇɔǝןƎ",
"gtceu.electric_furnace": "ǝɔɐuɹnℲ ɔıɹʇɔǝןƎ",
"gtceu.electrolyzer": "ɹǝzʎןoɹʇɔǝןƎ",
Expand Down Expand Up @@ -2583,6 +2585,12 @@
"gtceu.gui.title_bar.page_switcher": "sǝbɐԀ",
"gtceu.gui.toggle_view.disabled": ")spınןℲ( ʍǝıΛ ǝןbbo⟘",
"gtceu.gui.toggle_view.enabled": ")sɯǝʇI( ʍǝıΛ ǝןbbo⟘",
"gtceu.hazard_trigger.any": "ʇɔɐʇuoɔ ʎuⱯ",
"gtceu.hazard_trigger.description": ":ʎq pǝsnɐƆ",
"gtceu.hazard_trigger.inhalation": "uoıʇɐןɐɥuI",
"gtceu.hazard_trigger.none": "buıɥʇoN",
"gtceu.hazard_trigger.protection.description": ":ɯoɹɟ sʇɔǝʇoɹԀ",
"gtceu.hazard_trigger.skin_contact": "ʇɔɐʇuoɔ uıʞS",
"gtceu.implosion_compressor": "ɹossǝɹdɯoƆ uoısoןdɯI",
"gtceu.io.both": "ɥʇoᗺ",
"gtceu.io.export": "ʇɹodxƎ",
Expand All @@ -2592,6 +2600,7 @@
"gtceu.item_filter.footer": "ǝpıɹɹǝʌo oʇ ɯǝʇı ɥʇıʍ ʞɔıןƆǝ§",
"gtceu.item_list.item_stored": "%d :pǝɹoʇSㄥ§",
"gtceu.item_pipe.priority": "%dɟ§ :ʎʇıɹoıɹԀ6§",
"gtceu.jade.cleaned_this_second": "s/%s :pɹɐzɐɥ pǝuɐǝןƆ",
"gtceu.jade.energy_stored": "∩Ǝ %d / %d",
"gtceu.jade.progress_computation": "%s / %s :uoıʇɐʇndɯoƆ",
"gtceu.jade.progress_sec": "s %s / %s",
Expand Down
13 changes: 11 additions & 2 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"behavior.portable_scanner.environmental_hazard": "Environmental Hazard In Chunk: %s§r - %s ppm",
"behavior.portable_scanner.environmental_hazard.nothing": "Environmental Hazard In Chunk: §6Nothing§r",
"behavior.portable_scanner.eu_per_sec": "Average (last second): %s EU/t",
"behavior.portable_scanner.local_hazard": "Local Hazard In Chunk: %s§r - %s ppm",
"behavior.portable_scanner.local_hazard.nothing": "Local Hazard In Chunk: §6Nothing§r",
"behavior.portable_scanner.local_hazard": "Local Hazard In Area: %s§r - %s ppm",
"behavior.portable_scanner.local_hazard.nothing": "Local Hazard In Area: §6Nothing§r",
"behavior.portable_scanner.machine_disabled": "Disabled.",
"behavior.portable_scanner.machine_front_facing": "Front Facing: %s",
"behavior.portable_scanner.machine_power_loss": "Shut down due to power loss.",
Expand Down Expand Up @@ -2062,6 +2062,7 @@
"config.gtceu.option.energy": "energy",
"config.gtceu.option.energyConsumption": "energyConsumption",
"config.gtceu.option.energyUsageMultiplier": "energyUsageMultiplier",
"config.gtceu.option.environmentalHazardDecayRate": "environmentalHazardDecayRate",
"config.gtceu.option.environmentalHazards": "environmentalHazards",
"config.gtceu.option.euToPlatformRatio": "euToPlatformRatio",
"config.gtceu.option.flintAndSteelRequireSteel": "flintAndSteelRequireSteel",
Expand Down Expand Up @@ -2458,6 +2459,7 @@
"gtceu.debug.f3_h.enabled": "GregTech has modified the debug info! For Developers: enable the misc:debug config option in the GregTech config file to see more",
"gtceu.distillation_tower": "Distillation Tower",
"gtceu.distillery": "Distillery",
"gtceu.duct_pipe.transfer_rate": "§bAir transfer rate: %s",
"gtceu.electric_blast_furnace": "Electric Blast Furnace",
"gtceu.electric_furnace": "Electric Furnace",
"gtceu.electrolyzer": "Electrolyzer",
Expand Down Expand Up @@ -2583,6 +2585,12 @@
"gtceu.gui.title_bar.page_switcher": "Pages",
"gtceu.gui.toggle_view.disabled": "Toggle View (Fluids)",
"gtceu.gui.toggle_view.enabled": "Toggle View (Items)",
"gtceu.hazard_trigger.any": "Any contact",
"gtceu.hazard_trigger.description": "Caused by:",
"gtceu.hazard_trigger.inhalation": "Inhalation",
"gtceu.hazard_trigger.none": "Nothing",
"gtceu.hazard_trigger.protection.description": "Protects from:",
"gtceu.hazard_trigger.skin_contact": "Skin contact",
"gtceu.implosion_compressor": "Implosion Compressor",
"gtceu.io.both": "Both",
"gtceu.io.export": "Export",
Expand All @@ -2592,6 +2600,7 @@
"gtceu.item_filter.footer": "§eClick with item to override",
"gtceu.item_list.item_stored": "§7Stored: %d",
"gtceu.item_pipe.priority": "§9Priority: §f%d",
"gtceu.jade.cleaned_this_second": "Cleaned hazard: %s/s",
"gtceu.jade.energy_stored": "%d / %d EU",
"gtceu.jade.progress_computation": "Computation: %s / %s",
"gtceu.jade.progress_sec": "%s / %s s",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/arsenicosis",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/asbestosis",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/berylliosis",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/carbon_monoxide_poisoning",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/carcinogen",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/chemical_burns",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/irritant",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/methanol_poisoning",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/nausea",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/none",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/poison",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/silicosis",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "gtceu.medical_condition/weak_poison",
"scaling": "always"
"scaling": "never"
}
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public int getLayerARGB(int layerIndex) {
if (layerIndex < -100) {
layerIndex = (Math.abs(layerIndex) % 100) / 10;
}
if (layerIndex > materialInfo.colors.size() - 1) return -1;
if (layerIndex > materialInfo.colors.size() - 1 || layerIndex < 0) return -1;
int layerColor = getMaterialARGB(layerIndex);
if (layerColor != -1 || layerIndex == 0) return layerColor;
else return getMaterialARGB(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

import com.gregtechceu.gtceu.api.data.damagesource.DamageTypeData;
import com.gregtechceu.gtceu.common.capability.MedicalConditionTracker;
import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder;
import com.gregtechceu.gtceu.data.recipe.misc.AirScrubberRecipes;

import net.minecraft.tags.DamageTypeTags;
import net.minecraft.world.damagesource.DamageScaling;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.level.Level;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;

import java.util.*;
import java.util.function.Consumer;

@Accessors(chain = true)
public class MedicalCondition {

public static final Map<String, MedicalCondition> CONDITIONS = new HashMap<>();
Expand All @@ -22,6 +31,13 @@ public class MedicalCondition {
public final IdleProgressionType idleProgressionType;
public final float idleProgressionRate;
public final boolean canBePermanent;
/**
* This should mirror the {@link AirScrubberRecipes} recipe's outputs for this condition.
*/
@Getter
@Setter
@NotNull
public Consumer<GTRecipeBuilder> recipeModifier = builder -> {};

public MedicalCondition(String name, int color, int maxProgression, IdleProgressionType idleProgressionType,
float idleProgressionRate, boolean canBePermanent, Symptom.ConfiguredSymptom... symptoms) {
Expand All @@ -30,7 +46,7 @@ public MedicalCondition(String name, int color, int maxProgression, IdleProgress
this.maxProgression = maxProgression;
this.damageTypeData = new DamageTypeData.Builder()
.simpleId("medical_condition/" + name)
.scaling(DamageScaling.ALWAYS)
.scaling(DamageScaling.NEVER)
.tag(DamageTypeTags.BYPASSES_ARMOR)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Symptom {
((medicalConditionTracker, condition, configuredSymptom, baseSymptom, modifier) -> {
if (modifier > 0) {
Player player = medicalConditionTracker.getPlayer();
player.hurt(condition.getDamageSource(medicalConditionTracker), player.getHealth());
player.hurt(condition.getDamageSource(medicalConditionTracker), Float.MAX_VALUE);
}
}));
public static final Symptom RANDOM_DAMAGE = new Symptom(defaultKey("random_damage"), 10, 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.recipe.*;
import com.gregtechceu.gtceu.api.gui.editor.EditableMachineUI;
import com.gregtechceu.gtceu.api.machine.feature.IEnvironmentalHazardEmitter;
import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine;
import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer;
import com.gregtechceu.gtceu.api.recipe.GTRecipe;
Expand All @@ -22,6 +23,7 @@
import com.google.common.collect.Tables;
import com.mojang.blaze3d.MethodsReturnNonnullByDefault;
import it.unimi.dsi.fastutil.ints.Int2LongFunction;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -39,13 +41,23 @@
*/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class SimpleGeneratorMachine extends WorkableTieredMachine implements IFancyUIMachine {
public class SimpleGeneratorMachine extends WorkableTieredMachine
implements IFancyUIMachine, IEnvironmentalHazardEmitter {

public SimpleGeneratorMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction,
@Getter
private final float hazardStrengthPerOperation;

public SimpleGeneratorMachine(IMachineBlockEntity holder, int tier,
float hazardStrengthPerOperation, Int2LongFunction tankScalingFunction,
Object... args) {
super(holder, tier, tankScalingFunction, args);
this.hazardStrengthPerOperation = hazardStrengthPerOperation;
}

public SimpleGeneratorMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction,
Object... args) {
this(holder, tier, 0.25f, tankScalingFunction, args);
}
//////////////////////////////////////
// ***** Initialization ******//
//////////////////////////////////////
Expand Down Expand Up @@ -102,6 +114,12 @@ public boolean canVoidRecipeOutputs(RecipeCapability<?> capability) {
return capability != EURecipeCapability.CAP;
}

@Override
public void afterWorking() {
super.afterWorking();
spreadEnvironmentalHazard();
}

//////////////////////////////////////
// *********** GUI ***********//
//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.gregtechceu.gtceu.api.machine.feature;

import com.gregtechceu.gtceu.api.data.medicalcondition.MedicalCondition;

public interface IEnvironmentalHazardCleaner extends IMachineFeature {

float getRemovedLastSecond();

void cleanHazard(MedicalCondition condition, float amount);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.gregtechceu.gtceu.api.data.medicalcondition.MedicalCondition;
import com.gregtechceu.gtceu.common.capability.EnvironmentalHazardSavedData;
import com.gregtechceu.gtceu.common.data.GTMedicalConditions;
import com.gregtechceu.gtceu.config.ConfigHolder;

import net.minecraft.server.level.ServerLevel;

Expand All @@ -26,19 +27,24 @@ default MedicalCondition getConditionToEmit() {
/**
* @return the starting strength of the hazard zone.
*/
int hazardStrengthPerOperation();
float getHazardStrengthPerOperation();

default void spreadEnvironmentalHazard() {
if (!ConfigHolder.INSTANCE.gameplay.environmentalHazards) {
return;
}

if (self().getLevel() instanceof ServerLevel serverLevel) {
IHazardParticleContainer container = GTCapabilityHelper.getHazardContainer(serverLevel,
self().getPos().relative(self().getFrontFacing()), self().getFrontFacing().getOpposite());
if (container != null) {
container.addHazard(getConditionToEmit(), hazardStrengthPerOperation());
if (container != null &&
container.getHazardCanBeInserted(getConditionToEmit()) > getHazardStrengthPerOperation()) {
container.addHazard(getConditionToEmit(), getHazardStrengthPerOperation());
return;
}

var savedData = EnvironmentalHazardSavedData.getOrCreate(serverLevel);
savedData.addZone(self().getPos(), hazardStrengthPerOperation(), true,
savedData.addZone(self().getPos(), getHazardStrengthPerOperation(), true,
HazardProperty.HazardTrigger.INHALATION, getConditionToEmit());
}
}
Expand Down
Loading

0 comments on commit cb7d336

Please sign in to comment.