more stuff

This commit is contained in:
illuc 2026-02-22 16:38:32 +02:00
parent c8a67a5a1f
commit 6a717093b2
13 changed files with 242 additions and 27 deletions

View file

@ -16,10 +16,22 @@ public class MedicalEffects {
};
public static final MedicalEffect WEAK_ALCOHOL = new MedicalEffect() {
@Override
public void applyOnSkin(ServerPlayer player, float ml, Limb limb) {
player.getCapability(PlayerHealthProvider.PLAYER_HEALTH_DATA).ifPresent(h->{
h.setLimbPain(limb, h.getLimbPain(limb)+0.2f*ml);
h.setLimbDesinfected(limb,Math.max(h.getLimbDesinfected(limb),100*ml));
});
}
};
public static final MedicalEffect ETHANOL = new MedicalEffect() {
@Override
public void applyOnSkin(ServerPlayer player, float ml, Limb limb) {
player.getCapability(PlayerHealthProvider.PLAYER_HEALTH_DATA).ifPresent(h->{
h.setLimbPain(limb, h.getLimbPain(limb)+0.2f*ml);
h.setLimbDesinfected(limb,Math.max(h.getLimbDesinfected(limb),700*ml));
});
}
};
}

View file

@ -7,13 +7,14 @@ import net.adinvas.prototype_pain.fluid_system.MultiTankHelper;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.fluids.FluidStack;
import xyz.illuc.neuralgiacore.registers.RegisterMedicalFluids;
//TODO make it expire
public class BloodBagItem extends SyringeItem {
@Override
public int getCapacity() {

View file

@ -6,6 +6,7 @@ import net.adinvas.prototype_pain.item.multi_tank.MultiTankFluidItem;
import net.adinvas.prototype_pain.limbs.Limb;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
@ -13,6 +14,14 @@ import org.jetbrains.annotations.Nullable;
public class SyringeItem extends MultiTankFluidItem implements IMedicalMinigameUsable {
public SyringeItem(Properties properties) {
super(properties);
}
public SyringeItem() {
super(new Properties());
}
@Override
public int getCapacity() {
return 250;

View file

@ -0,0 +1,30 @@
package xyz.illuc.neuralgiacore.mixin.PrototypePain;
import com.llamalad7.mixinextras.sugar.Local;
import net.adinvas.prototype_pain.limbs.PlayerHealthData;
import net.dries007.tfc.common.capabilities.food.TFCFoodData;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.food.FoodData;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xyz.illuc.neuralgiacore.interfaces.IPlayerHealthDataAccessor;
@Mixin(PlayerHealthData.class)
public abstract class MixinDehydration {
@Shadow public abstract void setOxygenCap(float value);
@Shadow public abstract float getOxygenCap();
@Inject(method = "tickUpdate", at = @At(value = "INVOKE", target = "Ljava/lang/Math;max(FF)F", ordinal = 5, shift = At.Shift.AFTER), remap = false)
private void modifyConsciousnessWithThirst(ServerPlayer player, CallbackInfo ci) {
FoodData nutrition = player.getFoodData();
assert nutrition instanceof TFCFoodData;
this.setOxygenCap((float) (this.getOxygenCap() - (100-((TFCFoodData) nutrition).getThirst())/2));
}
}

View file

@ -28,11 +28,8 @@ public class MixinModdedMedicalFluids {
default -> {
Stream<TagKey<Fluid>> tags = fs.defaultFluidState().getTags();
if (tags.anyMatch(n -> {
System.out.println(n.toString());
return n.toString().equals("TagKey[minecraft:fluid / tfc:alcohols]");
})) {
yield RegisterMedicalFluids.WEAK_ALCOHOL.get();
}
})) { yield RegisterMedicalFluids.WEAK_ALCOHOL.get(); }
yield ModMedicalFluids.VANILLA_WATER.get();
}
};

View file

@ -0,0 +1,49 @@
package xyz.illuc.neuralgiacore.mixin.PrototypePain;
import com.llamalad7.mixinextras.sugar.Local;
import net.adinvas.prototype_pain.limbs.PlayerHealthData;
import net.dries007.tfc.common.capabilities.food.TFCFoodData;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.food.FoodData;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import xyz.illuc.neuralgiacore.interfaces.IPlayerHealthDataAccessor;
@Mixin(PlayerHealthData.class)
public class MixinRespitoryArrest {
@Shadow
private boolean respitoryArrest;
@Redirect(
method = "tickUpdate", // replace with your method name
at = @At(
value = "FIELD",
target = "Lnet/adinvas/prototype_pain/limbs/PlayerHealthData;respitoryArrest:Z",
opcode = Opcodes.PUTFIELD
),
remap = false
)
private void tfcpain$redirectRespitoryArrest(PlayerHealthData instance, boolean value, @Local(argsOnly = true) ServerPlayer player) {
boolean dehydrated = false;
boolean septicShock = false;
FoodData nutrition = player.getFoodData();
if (nutrition instanceof TFCFoodData) {
if (((TFCFoodData) nutrition).getThirst() == 0)
dehydrated = true;
}
IPlayerHealthDataAccessor accessor = (IPlayerHealthDataAccessor) this;
if (accessor.getSepsis() > 99F){
septicShock = true;
}
boolean modified = value || dehydrated || septicShock;
respitoryArrest = modified;
}
}

View file

@ -1,6 +1,8 @@
package xyz.illuc.neuralgiacore.mixin.PrototypePain;
import net.adinvas.prototype_pain.PlayerHealthProvider;
import net.adinvas.prototype_pain.limbs.PlayerHealthData;
import net.dries007.tfc.common.capabilities.food.TFCFoodData;
import net.minecraft.server.level.ServerPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -17,4 +19,42 @@ public class MixinSickness {
accessor.setSickness(Math.max(0, Math.min(100, ((accessor.getSickness() + sicknessRemoval)))));
}
@Inject(method = "tickUpdate", at = @At(value = "INVOKE", target = "Ljava/lang/Math;max(FF)F", ordinal = 5, shift = At.Shift.AFTER), remap = false)
private void updateVomitTime(ServerPlayer player, CallbackInfo ci) {
IPlayerHealthDataAccessor accessor = (IPlayerHealthDataAccessor) this;
float sickness = accessor.getSickness();
float vomitTime = accessor.getVomitTime();
if (sickness > 50) {
accessor.setVomitTime(vomitTime + (sickness * 0.0025F));
} else {
accessor.setVomitTime(vomitTime - (sickness * 0.0025F));
}
if (accessor.getVomitTime() > 50) {
throwUp(player);
accessor.setVomitTime(0);
}
accessor.setVomitTime(Math.max(0, accessor.getVomitTime()));
}
private void throwUp(ServerPlayer player) {
player.getCapability(PlayerHealthProvider.PLAYER_HEALTH_DATA).ifPresent(h -> {
IPlayerHealthDataAccessor accessor = (IPlayerHealthDataAccessor) h;
if (player.getFoodData() instanceof TFCFoodData) {
float thirst = ((TFCFoodData) player.getFoodData()).getThirst();
((TFCFoodData) player.getFoodData()).setThirst(thirst - 10);
}
//System.out.println(player.getFoodData().getFoodLevel());
player.getFoodData().setFoodLevel(player.getFoodData().getFoodLevel() - 2);
accessor.setSickness(Math.max(0, Math.min(100, accessor.getSickness() - 8)));
});
}
}

View file

@ -25,15 +25,15 @@ public class MixinHealthBar {
remap = false
)
private static void renderHealth(LivingEntity player, ForgeGui gui, GuiGraphics graphics, int width, int height) {
tfcpain$renderConscioussnes(gui, graphics, width, height);
tfcpain$renderOxygen(gui, graphics, width, height);
renderConscioussnes(gui, graphics, width, height);
renderOxygen(gui, graphics, width, height);
}
@Unique
private static final ResourceLocation TEXTURE = new ResourceLocation("tfcpain", "textures/overlay.png");
private static final ResourceLocation TEXTURE = new ResourceLocation("neuralgiacore", "textures/overlay.png");
@Unique
private static void tfcpain$renderConscioussnes(ForgeGui gui, GuiGraphics graphics, int width, int height) {
private static void renderConscioussnes(ForgeGui gui, GuiGraphics graphics, int width, int height) {
PoseStack stack = graphics.pose();
Minecraft minecraft = Minecraft.getInstance();
if ( gui.shouldDrawSurvivalElements() && setup(gui, minecraft)) {
@ -65,7 +65,7 @@ public class MixinHealthBar {
}
@Unique
private static void tfcpain$renderOxygen(ForgeGui gui, GuiGraphics graphics, int width, int height) {
private static void renderOxygen(ForgeGui gui, GuiGraphics graphics, int width, int height) {
PoseStack stack = graphics.pose();
Minecraft minecraft = Minecraft.getInstance();
if ( gui.shouldDrawSurvivalElements() && setup(gui, minecraft)) {

View file

@ -41,7 +41,7 @@ public class RadiationSicknessMoodle extends AbstractMoodleVisual {
@Override
public ResourceLocation renderIcon(GuiGraphics ms, float partialTicks, int x, int y) {
ResourceLocation tex = new ResourceLocation("neuralgia", "textures/moodles/radiation.png");
ResourceLocation tex = new ResourceLocation("neuralgiacore", "textures/moodles/radiation.png");
ms.blit(tex, x, y, 0.0F, 0.0F, 16, 16, 16, 16);
return tex;
}
@ -51,16 +51,16 @@ public class RadiationSicknessMoodle extends AbstractMoodleVisual {
List<Component> componentList = new ArrayList();
switch (this.getMoodleStatus()) {
case NORMAL:
componentList.add(Component.translatable("neuralgia.gui.moodle.radiation.title1").withStyle(ChatFormatting.YELLOW));
componentList.add(Component.translatable("neuralgia.gui.moodle.radiation.description1").withStyle(ChatFormatting.GRAY));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.radiation.title1").withStyle(ChatFormatting.YELLOW));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.radiation.description1").withStyle(ChatFormatting.GRAY));
break;
case HEAVY:
componentList.add(Component.translatable("neuralgia.gui.moodle.radiation.title2").withStyle(ChatFormatting.GOLD));
componentList.add(Component.translatable("neuralgia.gui.moodle.radiation.description2").withStyle(ChatFormatting.GRAY));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.radiation.title2").withStyle(ChatFormatting.GOLD));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.radiation.description2").withStyle(ChatFormatting.GRAY));
break;
case CRITICAL:
componentList.add(Component.translatable("neuralgia.gui.moodle.radiation.title3").withStyle(ChatFormatting.RED));
componentList.add(Component.translatable("neuralgia.gui.moodle.radiation.description3").withStyle(ChatFormatting.GRAY));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.radiation.title3").withStyle(ChatFormatting.RED));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.radiation.description3").withStyle(ChatFormatting.GRAY));
}
return componentList;

View file

@ -41,7 +41,7 @@ public class SepsisMoodle extends AbstractMoodleVisual {
@Override
public ResourceLocation renderIcon(GuiGraphics ms, float partialTicks, int x, int y) {
ResourceLocation tex = new ResourceLocation("neuralgia", "textures/moodles/sepsis.png");
ResourceLocation tex = new ResourceLocation("neuralgiacore", "textures/moodles/sepsis.png");
ms.blit(tex, x, y, 0.0F, 0.0F, 16, 16, 16, 16);
return tex;
}
@ -51,16 +51,16 @@ public class SepsisMoodle extends AbstractMoodleVisual {
List<Component> componentList = new ArrayList();
switch (this.getMoodleStatus()) {
case NORMAL:
componentList.add(Component.translatable("neuralgia.gui.moodle.sepsis.title1").withStyle(ChatFormatting.YELLOW));
componentList.add(Component.translatable("neuralgia.gui.moodle.sepsis.description1").withStyle(ChatFormatting.GRAY));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sepsis.title1").withStyle(ChatFormatting.YELLOW));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sepsis.description1").withStyle(ChatFormatting.GRAY));
break;
case HEAVY:
componentList.add(Component.translatable("neuralgia.gui.moodle.sepsis.title2").withStyle(ChatFormatting.GOLD));
componentList.add(Component.translatable("neuralgia.gui.moodle.sepsis.description2").withStyle(ChatFormatting.GRAY));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sepsis.title2").withStyle(ChatFormatting.GOLD));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sepsis.description2").withStyle(ChatFormatting.GRAY));
break;
case CRITICAL:
componentList.add(Component.translatable("neuralgia.gui.moodle.sepsis.title3").withStyle(ChatFormatting.RED));
componentList.add(Component.translatable("neuralgia.gui.moodle.sepsis.description3").withStyle(ChatFormatting.GRAY));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sepsis.title3").withStyle(ChatFormatting.RED));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sepsis.description3").withStyle(ChatFormatting.GRAY));
}
return componentList;

View file

@ -0,0 +1,74 @@
package xyz.illuc.neuralgiacore.moodles;
import net.adinvas.prototype_pain.PlayerHealthProvider;
import net.adinvas.prototype_pain.client.moodles.AbstractMoodleVisual;
import net.adinvas.prototype_pain.client.moodles.MoodleStatus;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import xyz.illuc.neuralgiacore.interfaces.IPlayerHealthDataAccessor;
import java.util.ArrayList;
import java.util.List;
public class SicknessMoodle extends AbstractMoodleVisual {
public SicknessMoodle() {
}
//noinspection ConstantConditions
@Override
public MoodleStatus calculateStatus(Player player) {
if (!player.isLocalPlayer()) return MoodleStatus.NONE;
return player.getCapability(PlayerHealthProvider.PLAYER_HEALTH_DATA).map(ph -> {
IPlayerHealthDataAccessor accessor = (IPlayerHealthDataAccessor) ph;
float sickness = accessor.getSickness();
if (sickness > 75F) {
return (MoodleStatus.CRITICAL);
} else if (sickness > 50F) {
return (MoodleStatus.HEAVY);
} else if (sickness > 30F) {
return (MoodleStatus.NORMAL);
} else if (sickness > 10F) {
return (MoodleStatus.LIGHT);
} else {
return (MoodleStatus.NONE);
}
}).orElse(MoodleStatus.NONE);
}
@Override
public ResourceLocation renderIcon(GuiGraphics ms, float partialTicks, int x, int y) {
ResourceLocation tex = new ResourceLocation("neuralgiacore", "textures/moodles/sickness.png");
ms.blit(tex, x, y, 0.0F, 0.0F, 16, 16, 16, 16);
return tex;
}
@Override
public List<Component> getTooltip(Player player) {
List<Component> componentList = new ArrayList();
switch (this.getMoodleStatus()) {
case LIGHT:
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.title1").withStyle(ChatFormatting.YELLOW));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.description1").withStyle(ChatFormatting.GRAY));
break;
case NORMAL:
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.title2").withStyle(ChatFormatting.YELLOW));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.description2").withStyle(ChatFormatting.GRAY));
break;
case HEAVY:
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.title3").withStyle(ChatFormatting.GOLD));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.description3").withStyle(ChatFormatting.GRAY));
break;
case CRITICAL:
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.title4").withStyle(ChatFormatting.RED));
componentList.add(Component.translatable("neuralgiacore.gui.moodle.sickness.description4").withStyle(ChatFormatting.GRAY));
}
return componentList;
}
}

View file

@ -4,6 +4,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.common.Mod;
import xyz.illuc.neuralgiacore.NeuralgiaCoreMod;
import xyz.illuc.neuralgiacore.moodles.SepsisMoodle;
import xyz.illuc.neuralgiacore.moodles.SicknessMoodle;
import static net.adinvas.prototype_pain.client.moodles.MoodleController.registerMoodle;
@ -11,6 +12,6 @@ import static net.adinvas.prototype_pain.client.moodles.MoodleController.registe
public class RegisterMoodles {
static {
registerMoodle(new SepsisMoodle());
//registerMoodle(new SicknessMoodle());
registerMoodle(new SicknessMoodle());
}
}

View file

@ -6,10 +6,12 @@
"refmap": "neuralgiacore.refmap.json",
"mixins": [
"PrototypePain.MixinAmbientTemperature",
"PrototypePain.MixinDehydration",
"PrototypePain.MixinLegUsePacket",
"PrototypePain.MixinModdedMedicalFluids",
"PrototypePain.MixinOverlayController",
"PrototypePain.MixinPlayerHealthDataExtras",
"PrototypePain.MixinRespitoryArrest",
"PrototypePain.MixinSepsis",
"PrototypePain.MixinSickness",
"PrototypePain.MixinSicknessOverlay",