Remove health modifier

This commit is contained in:
illuc 2026-03-01 15:28:14 +02:00
parent da321363d4
commit 041601b649
3 changed files with 45 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -27,6 +28,7 @@ import org.slf4j.Logger;
import xyz.illuc.neuralgiacore.entities.OfflinePlayerEntity; import xyz.illuc.neuralgiacore.entities.OfflinePlayerEntity;
import xyz.illuc.neuralgiacore.entities.OfflinePlayerRenderer; import xyz.illuc.neuralgiacore.entities.OfflinePlayerRenderer;
import xyz.illuc.neuralgiacore.peripherals.BearingPeripheral; import xyz.illuc.neuralgiacore.peripherals.BearingPeripheral;
//import xyz.illuc.neuralgiacore.peripherals.GunPeripheral;
import xyz.illuc.neuralgiacore.registers.RegisterItems; import xyz.illuc.neuralgiacore.registers.RegisterItems;
import xyz.illuc.neuralgiacore.registers.RegisterMedicalFluids; import xyz.illuc.neuralgiacore.registers.RegisterMedicalFluids;
@ -74,12 +76,15 @@ public class NeuralgiaCoreMod {
event.enqueueWork(this::registerPeripherals); event.enqueueWork(this::registerPeripherals);
} }
//TODO move peripheral stuff in a different file
private void registerPeripherals() { private void registerPeripherals() {
registerBearingPeripheral("mechanical_bearing"); registerBearingPeripheral("mechanical_bearing");
registerBearingPeripheral("clockwork_bearing"); registerBearingPeripheral("clockwork_bearing");
registerBearingPeripheral("windmill_bearing"); registerBearingPeripheral("windmill_bearing");
registerGunPeripheral("machine_gun");
} }
private void registerBearingPeripheral(String blockEntityName) { private void registerBearingPeripheral(String blockEntityName) {
@ -109,6 +114,30 @@ public class NeuralgiaCoreMod {
} }
} }
private void registerGunPeripheral(String blockEntityName) {
BlockEntityType<?> type = ForgeRegistries.BLOCK_ENTITY_TYPES.getValue(
new ResourceLocation("crusty_chunks", blockEntityName)
);
if (type != null) {
ForgeComputerCraftAPI.registerPeripheralProvider((level, pos, direction) -> {
var blockEntity = level.getBlockEntity(pos);
if (blockEntity != null && blockEntity.getType() == type) {
try {
//TODO gun peripheral
} catch (ClassCastException e) {
LOGGER.error("Failed to create peripheral at {}", pos);
return null;
}
}
return null;
});
LOGGER.debug("Registered peripheral for {}", blockEntityName);
} else {
LOGGER.warn("Could not find block entity type: crusty_chunks:{}", blockEntityName);
}
}

View file

@ -0,0 +1,15 @@
package xyz.illuc.neuralgiacore.mixin.Tfc;
import net.dries007.tfc.common.capabilities.food.TFCFoodData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(TFCFoodData.class)
public class MixinDisableHealthModifier {
@Inject(method = "getHealthModifier", at = @At("HEAD"), cancellable = true, remap = false)
private void disableHealthModifier(CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(1f);
}
}

View file

@ -15,6 +15,7 @@
"PrototypePain.MixinSepsis", "PrototypePain.MixinSepsis",
"PrototypePain.MixinSickness", "PrototypePain.MixinSickness",
"PrototypePain.MixinSicknessOverlay", "PrototypePain.MixinSicknessOverlay",
"Tfc.MixinDisableHealthModifier",
"Tfc.MixinFoodData", "Tfc.MixinFoodData",
"Tfc.MixinHealthBar", "Tfc.MixinHealthBar",
"Tfc.MixinOptimizeClimateUpdate", "Tfc.MixinOptimizeClimateUpdate",