This commit is contained in:
parent
142fd83a29
commit
40580ec504
@ -8,6 +8,6 @@ import net.minecraft.sound.BlockSoundGroup;
|
||||
|
||||
public class VeridiumBlockBlock extends SimpleBlock {
|
||||
public VeridiumBlockBlock() {
|
||||
super(FabricBlockSettings.of(Material.METAL, MaterialColor.PURPLE).requiresTool().strength(3f, 6f).sounds(BlockSoundGroup.METAL).nonOpaque().lightLevel(8).emissiveLighting((state, world, pos) -> true));
|
||||
super(FabricBlockSettings.of(Material.METAL, MaterialColor.PURPLE).requiresTool().strength(3f, 6f).sounds(BlockSoundGroup.METAL).nonOpaque().lightLevel(10).emissiveLighting((state, world, pos) -> true));
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class MixinLivingEntity {
|
||||
@Unique
|
||||
private static final TrackedData<Boolean> HAS_VERIDIUM_POISONING = DataTracker.registerData(LivingEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
||||
private static final TrackedData<Boolean> HAS_VERIDIUM_POISON = DataTracker.registerData(LivingEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
||||
|
||||
@Shadow
|
||||
public abstract boolean hasStatusEffect(StatusEffect effect);
|
||||
@ -32,12 +32,12 @@ public abstract class MixinLivingEntity {
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "initDataTracker")
|
||||
public void initDataTracker(CallbackInfo info) {
|
||||
((LivingEntity) (Object) this).getDataTracker().startTracking(HAS_VERIDIUM_POISONING, false);
|
||||
((LivingEntity) (Object) this).getDataTracker().startTracking(HAS_VERIDIUM_POISON, false);
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "onTrackedDataSet")
|
||||
public void onTrackedDataSet(TrackedData<?> data, CallbackInfo info) {
|
||||
if (HAS_VERIDIUM_POISONING.equals(data)) {
|
||||
if (HAS_VERIDIUM_POISON.equals(data)) {
|
||||
setHealth(getHealth());
|
||||
}
|
||||
}
|
||||
@ -45,16 +45,16 @@ public abstract class MixinLivingEntity {
|
||||
@Inject(at = @At("HEAD"), method = "tick")
|
||||
public void tick(CallbackInfo info) {
|
||||
if (!((LivingEntity) (Object) this).getEntityWorld().isClient()) {
|
||||
boolean hasVeridiumPoisoning = hasStatusEffect(CustomPotions.VERIDIUM_POISONING_EFFECT.statusEffect);
|
||||
if (((LivingEntity) (Object) this).getDataTracker().get(HAS_VERIDIUM_POISONING) != hasVeridiumPoisoning) {
|
||||
((LivingEntity) (Object) this).getDataTracker().set(HAS_VERIDIUM_POISONING, hasVeridiumPoisoning);
|
||||
boolean hasVeridiumPoison = hasStatusEffect(CustomPotions.VERIDIUM_POISON_EFFECT.statusEffect);
|
||||
if (((LivingEntity) (Object) this).getDataTracker().get(HAS_VERIDIUM_POISON) != hasVeridiumPoison) {
|
||||
((LivingEntity) (Object) this).getDataTracker().set(HAS_VERIDIUM_POISON, hasVeridiumPoison);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "getAttributeValue", cancellable = true)
|
||||
public void getAttributeValue(EntityAttribute attribute, CallbackInfoReturnable<Double> info) {
|
||||
if (EntityAttributes.GENERIC_MAX_HEALTH.equals(attribute) && ((LivingEntity) (Object) this).getDataTracker().get(HAS_VERIDIUM_POISONING)) {
|
||||
if (EntityAttributes.GENERIC_MAX_HEALTH.equals(attribute) && ((LivingEntity) (Object) this).getDataTracker().get(HAS_VERIDIUM_POISON)) {
|
||||
info.setReturnValue(0.5d);
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ public class CustomPotions {
|
||||
}
|
||||
}
|
||||
|
||||
public static CustomPotion VERIDIUM_POISONING_EFFECT;
|
||||
public static CustomPotion VERIDIUM_POISON_EFFECT;
|
||||
|
||||
public static void register() {
|
||||
VERIDIUM_POISONING_EFFECT = registerEffect("veridium_poisoning", 16711909);
|
||||
VERIDIUM_POISON_EFFECT = registerEffect("veridium_poison", 16711909);
|
||||
registerBrewingRecipes();
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ public class CustomPotions {
|
||||
}
|
||||
|
||||
private static void registerBrewingRecipes() {
|
||||
BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(Potions.AWKWARD, EnergonRelics.VERIDIUM_POWDER_ITEM, VERIDIUM_POISONING_EFFECT.potion);
|
||||
BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(VERIDIUM_POISONING_EFFECT.potion, Items.REDSTONE, VERIDIUM_POISONING_EFFECT.longPotion);
|
||||
BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(Potions.AWKWARD, EnergonRelics.VERIDIUM_POWDER_ITEM, VERIDIUM_POISON_EFFECT.potion);
|
||||
BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(VERIDIUM_POISON_EFFECT.potion, Items.REDSTONE, VERIDIUM_POISON_EFFECT.longPotion);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,9 +29,9 @@
|
||||
"block.energonrelics.research_complex_generator": "Research Complex Generator",
|
||||
"block.energonrelics.block_breaker": "Block Breaker",
|
||||
"item.energonrelics.veridium_powder": "Veridium Powder",
|
||||
"effect.energonrelics.veridium_poisoning": "Veridium Poisoning",
|
||||
"item.minecraft.potion.effect.energonrelics.veridium_poisoning": "Potion of Degradation",
|
||||
"item.minecraft.splash_potion.effect.energonrelics.veridium_poisoning": "Splash Potion of Degradation",
|
||||
"item.minecraft.lingering_potion.effect.energonrelics.veridium_poisoning": "Lingering Potion of Degradation",
|
||||
"item.minecraft.tipped_arrow.effect.energonrelics.veridium_poisoning": "Arrow of Degradation"
|
||||
"effect.energonrelics.veridium_poison": "Veridium Poison",
|
||||
"item.minecraft.potion.effect.energonrelics.veridium_poison": "Potion of Degradation",
|
||||
"item.minecraft.splash_potion.effect.energonrelics.veridium_poison": "Splash Potion of Degradation",
|
||||
"item.minecraft.lingering_potion.effect.energonrelics.veridium_poison": "Lingering Potion of Degradation",
|
||||
"item.minecraft.tipped_arrow.effect.energonrelics.veridium_poison": "Arrow of Degradation"
|
||||
}
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Reference in New Issue
Block a user