mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Kirins can now cool themselves off by drinking bottles of water, juice, and eating melon slices
This commit is contained in:
parent
2df34bd986
commit
8a85f0709e
12 changed files with 100 additions and 62 deletions
|
@ -27,6 +27,7 @@ public interface UTags {
|
||||||
TagKey<Item> SPOOKED_MOB_DROPS = item("spooked_mob_drops");
|
TagKey<Item> SPOOKED_MOB_DROPS = item("spooked_mob_drops");
|
||||||
TagKey<Item> IS_DELIVERED_AGGRESSIVELY = item("is_delivered_aggressively");
|
TagKey<Item> IS_DELIVERED_AGGRESSIVELY = item("is_delivered_aggressively");
|
||||||
TagKey<Item> FLOATS_ON_CLOUDS = item("floats_on_clouds");
|
TagKey<Item> FLOATS_ON_CLOUDS = item("floats_on_clouds");
|
||||||
|
TagKey<Item> COOLS_OFF_KIRINS = item("cools_off_kirins");
|
||||||
|
|
||||||
TagKey<Item> POLEARMS = item("polearms");
|
TagKey<Item> POLEARMS = item("polearms");
|
||||||
TagKey<Item> HORSE_SHOES = item("horse_shoes");
|
TagKey<Item> HORSE_SHOES = item("horse_shoes");
|
||||||
|
|
|
@ -30,11 +30,17 @@ public class RageAbilitySpell extends AbstractSpell {
|
||||||
private int age;
|
private int age;
|
||||||
private int ticksExtenguishing;
|
private int ticksExtenguishing;
|
||||||
|
|
||||||
|
private int ticksToExtenguish;
|
||||||
|
|
||||||
public RageAbilitySpell(CustomisedSpellType<?> type) {
|
public RageAbilitySpell(CustomisedSpellType<?> type) {
|
||||||
super(type);
|
super(type);
|
||||||
setHidden(true);
|
setHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExtenguishing() {
|
||||||
|
ticksToExtenguish += 15;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tick(Caster<?> source, Situation situation) {
|
public boolean tick(Caster<?> source, Situation situation) {
|
||||||
|
|
||||||
|
@ -42,7 +48,7 @@ public class RageAbilitySpell extends AbstractSpell {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.asEntity().isInsideWaterOrBubbleColumn()) {
|
if (source.asEntity().isInsideWaterOrBubbleColumn() || source.asEntity().isFrozen() || ticksToExtenguish > 0) {
|
||||||
ticksExtenguishing++;
|
ticksExtenguishing++;
|
||||||
source.playSound(SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, 1);
|
source.playSound(SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, 1);
|
||||||
source.spawnParticles(ParticleTypes.CLOUD, 12);
|
source.spawnParticles(ParticleTypes.CLOUD, 12);
|
||||||
|
@ -51,6 +57,10 @@ public class RageAbilitySpell extends AbstractSpell {
|
||||||
ticksExtenguishing = 0;
|
ticksExtenguishing = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ticksToExtenguish > 0) {
|
||||||
|
ticksToExtenguish--;
|
||||||
|
}
|
||||||
|
|
||||||
if (ticksExtenguishing > 10) {
|
if (ticksExtenguishing > 10) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,8 @@ import net.minecraft.entity.effect.StatusEffectCategory;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.FoodComponent;
|
import net.minecraft.item.FoodComponent;
|
||||||
import net.minecraft.item.ItemConvertible;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
|
|
||||||
public class FoodPoisoningStatusEffect extends StatusEffect {
|
public class FoodPoisoningStatusEffect extends StatusEffect {
|
||||||
|
@ -54,18 +52,18 @@ public class FoodPoisoningStatusEffect extends StatusEffect {
|
||||||
return i <= 0 || duration % i == 0;
|
return i <= 0 || duration % i == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TypedActionResult<ItemStack> apply(ItemConvertible sender, PlayerEntity user, Hand hand) {
|
public static TypedActionResult<ItemStack> apply(ItemStack stack, PlayerEntity user) {
|
||||||
@Nullable
|
@Nullable
|
||||||
FoodComponent food = sender.asItem().getFoodComponent();
|
FoodComponent food = stack.getItem().getFoodComponent();
|
||||||
|
|
||||||
if (food == null || !user.canConsume(food.isAlwaysEdible()) || !user.hasStatusEffect(UEffects.FOOD_POISONING)) {
|
if (food == null || !user.canConsume(food.isAlwaysEdible()) || !user.hasStatusEffect(UEffects.FOOD_POISONING)) {
|
||||||
return TypedActionResult.pass(user.getStackInHand(hand));
|
return TypedActionResult.pass(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getWorld().playSound(null, user.getX(), user.getY(), user.getZ(), USounds.Vanilla.ENTITY_PLAYER_BURP, SoundCategory.NEUTRAL,
|
user.getWorld().playSound(null, user.getX(), user.getY(), user.getZ(), USounds.Vanilla.ENTITY_PLAYER_BURP, SoundCategory.NEUTRAL,
|
||||||
1,
|
1,
|
||||||
1 + (user.getWorld().random.nextFloat() - user.getWorld().random.nextFloat()) * 0.4f);
|
1 + (user.getWorld().random.nextFloat() - user.getWorld().random.nextFloat()) * 0.4f);
|
||||||
user.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 100, 1, true, false, false));
|
user.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 100, 1, true, false, false));
|
||||||
return TypedActionResult.fail(user.getStackInHand(hand));
|
return TypedActionResult.fail(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.minelittlepony.unicopia.ability.*;
|
||||||
import com.minelittlepony.unicopia.ability.magic.*;
|
import com.minelittlepony.unicopia.ability.magic.*;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.CastingMethod;
|
import com.minelittlepony.unicopia.ability.magic.spell.CastingMethod;
|
||||||
|
import com.minelittlepony.unicopia.ability.magic.spell.RageAbilitySpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.TraitDiscovery;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.TraitDiscovery;
|
||||||
|
@ -53,6 +54,8 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.potion.PotionUtil;
|
||||||
|
import net.minecraft.potion.Potions;
|
||||||
import net.minecraft.registry.tag.DamageTypeTags;
|
import net.minecraft.registry.tag.DamageTypeTags;
|
||||||
import net.minecraft.registry.tag.FluidTags;
|
import net.minecraft.registry.tag.FluidTags;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
@ -428,7 +431,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
if (getObservedSpecies() == Race.KIRIN) {
|
if (getObservedSpecies() == Race.KIRIN) {
|
||||||
var charge = getMagicalReserves().getCharge();
|
var charge = getMagicalReserves().getCharge();
|
||||||
|
|
||||||
if (entity.isTouchingWater()) {
|
if (entity.isTouchingWater() || entity.isFrozen()) {
|
||||||
charge.multiply(0.5F);
|
charge.multiply(0.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,6 +737,18 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onEat(ItemStack stack) {
|
||||||
|
if (isClient()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getObservedSpecies() == Race.KIRIN
|
||||||
|
&& (stack.isIn(UTags.COOLS_OFF_KIRINS) || PotionUtil.getPotion(stack) == Potions.WATER)) {
|
||||||
|
getMagicalReserves().getCharge().multiply(0.5F);
|
||||||
|
getSpellSlot().get(SpellType.RAGE, false).ifPresent(RageAbilitySpell::setExtenguishing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
protected void handleFall(float distance, float damageMultiplier, DamageSource cause) {
|
protected void handleFall(float distance, float damageMultiplier, DamageSource cause) {
|
||||||
|
|
|
@ -7,11 +7,7 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.TypedActionResult;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public record Ailment (
|
public record Ailment (
|
||||||
Toxicity toxicity,
|
Toxicity toxicity,
|
||||||
|
@ -31,13 +27,6 @@ public record Ailment (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
|
||||||
if (!Pony.of(player).getObservedSpecies().hasIronGut()) {
|
|
||||||
return TypedActionResult.fail(player.getStackInHand(hand));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface Set {
|
public interface Set {
|
||||||
Set EMPTY = e -> Optional.empty();
|
Set EMPTY = e -> Optional.empty();
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,17 @@ import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
|
import com.minelittlepony.unicopia.entity.effect.FoodPoisoningStatusEffect;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.FoodComponent;
|
import net.minecraft.item.FoodComponent;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.TypedActionResult;
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.util.UseAction;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -37,11 +41,20 @@ public record Toxic (
|
||||||
ailment.get(player).ifPresent(ailment -> ailment.appendTooltip(tooltip, context));
|
ailment.get(player).ifPresent(ailment -> ailment.appendTooltip(tooltip, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity entity) {
|
public TypedActionResult<ItemStack> startUsing(ItemStack stack, World world, PlayerEntity user, Hand hand) {
|
||||||
|
if (stack.getItem() instanceof BlockItem && ailment().get(user).isPresent() && !Pony.of(user).getObservedSpecies().hasIronGut()) {
|
||||||
|
return TypedActionResult.fail(stack);
|
||||||
|
}
|
||||||
|
return FoodPoisoningStatusEffect.apply(stack, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishUsing(ItemStack stack, World world, LivingEntity entity) {
|
||||||
if (entity instanceof PlayerEntity player) {
|
if (entity instanceof PlayerEntity player) {
|
||||||
ailment.get(entity).ifPresent(ailment -> ailment.effect().afflict(player, stack));
|
ailment.get(entity).ifPresent(ailment -> ailment.effect().afflict(player, stack));
|
||||||
}
|
}
|
||||||
return stack;
|
if (stack.isFood() || stack.getUseAction() == UseAction.DRINK) {
|
||||||
|
Pony.of(entity).ifPresent(pony -> pony.onEat(stack));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -9,15 +9,11 @@ import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
|
||||||
import com.minelittlepony.unicopia.server.world.WaterLoggingManager;
|
import com.minelittlepony.unicopia.server.world.WaterLoggingManager;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.TypedActionResult;
|
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.util.UseAction;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
@Mixin(BlockItem.class)
|
@Mixin(BlockItem.class)
|
||||||
abstract class MixinBlockItem extends Item implements ToxicHolder {
|
abstract class MixinBlockItem extends Item implements ToxicHolder {
|
||||||
|
@ -28,15 +24,6 @@ abstract class MixinBlockItem extends Item implements ToxicHolder {
|
||||||
return getToxic(stack, null).useAction().orElseGet(() -> super.getUseAction(stack));
|
return getToxic(stack, null).useAction().orElseGet(() -> super.getUseAction(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
|
||||||
return getToxic(player.getStackInHand(hand), player)
|
|
||||||
.ailment()
|
|
||||||
.get(player)
|
|
||||||
.map(t -> t.use(world, player, hand))
|
|
||||||
.orElseGet(() -> super.use(world, player, hand));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true)
|
@Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true)
|
||||||
private void onGetPlacementState(ItemPlacementContext context, CallbackInfoReturnable<BlockState> info) {
|
private void onGetPlacementState(ItemPlacementContext context, CallbackInfoReturnable<BlockState> info) {
|
||||||
WaterLoggingManager.getInstance().getPlacementState(context, info);
|
WaterLoggingManager.getInstance().getPlacementState(context, info);
|
||||||
|
|
|
@ -8,25 +8,15 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.minelittlepony.unicopia.entity.ItemImpl;
|
import com.minelittlepony.unicopia.entity.ItemImpl;
|
||||||
import com.minelittlepony.unicopia.entity.ItemImpl.GroundTickCallback;
|
import com.minelittlepony.unicopia.entity.ItemImpl.GroundTickCallback;
|
||||||
import com.minelittlepony.unicopia.entity.effect.FoodPoisoningStatusEffect;
|
|
||||||
import com.minelittlepony.unicopia.item.toxin.*;
|
import com.minelittlepony.unicopia.item.toxin.*;
|
||||||
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.item.FoodComponent;
|
import net.minecraft.item.FoodComponent;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ActionResult;
|
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.TypedActionResult;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
@Mixin(Item.class)
|
@Mixin(Item.class)
|
||||||
abstract class MixinItem implements ItemDuck {
|
abstract class MixinItem implements ItemDuck {
|
||||||
|
@ -50,19 +40,4 @@ abstract class MixinItem implements ItemDuck {
|
||||||
}
|
}
|
||||||
return Toxics.lookup(this, entity);
|
return Toxics.lookup(this, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "finishUsing", at = @At("HEAD"))
|
|
||||||
private void finishUsing(ItemStack stack, World world, LivingEntity entity, CallbackInfoReturnable<ItemStack> info) {
|
|
||||||
getToxic(stack, entity).finishUsing(stack, world, entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
|
||||||
private void use(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> info) {
|
|
||||||
// ensure the food component is updated before attempting to use
|
|
||||||
getToxic(user.getStackInHand(hand), user);
|
|
||||||
TypedActionResult<ItemStack> result = FoodPoisoningStatusEffect.apply(this, user, hand);
|
|
||||||
if (result.getResult() != ActionResult.PASS) {
|
|
||||||
info.setReturnValue(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.minelittlepony.unicopia.mixin;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
|
||||||
|
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.TypedActionResult;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@Mixin(ItemStack.class)
|
||||||
|
abstract class MixinItemStack {
|
||||||
|
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void onUse(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> info) {
|
||||||
|
ItemStack self = (ItemStack)(Object)this;
|
||||||
|
TypedActionResult<ItemStack> result = ((ToxicHolder)self.getItem()).getToxic(self, user).startUsing(self, world, user, hand);
|
||||||
|
if (result.getResult() != ActionResult.PASS) {
|
||||||
|
info.setReturnValue(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "finishUsing", at = @At("HEAD"))
|
||||||
|
private void onFinishUsing(World world, LivingEntity user, CallbackInfoReturnable<ItemStack> info) {
|
||||||
|
ItemStack self = (ItemStack)(Object)this;
|
||||||
|
((ToxicHolder)self.getItem()).getToxic(self, user).finishUsing(self, world, user);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.stat.Stats;
|
import net.minecraft.stat.Stats;
|
||||||
import net.minecraft.util.Unit;
|
import net.minecraft.util.Unit;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@Mixin(PlayerEntity.class)
|
@Mixin(PlayerEntity.class)
|
||||||
abstract class MixinPlayerEntity extends LivingEntity implements Equine.Container<Pony>, PlayerEntityDuck {
|
abstract class MixinPlayerEntity extends LivingEntity implements Equine.Container<Pony>, PlayerEntityDuck {
|
||||||
|
@ -42,6 +43,11 @@ abstract class MixinPlayerEntity extends LivingEntity implements Equine.Containe
|
||||||
return new Pony((PlayerEntity)(Object)this);
|
return new Pony((PlayerEntity)(Object)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "createPlayerAttributes()Lnet/minecraft/entity/attribute/DefaultAttributeContainer$Builder;", at = @At("RETURN"))
|
||||||
|
private static void onCreateAttributes(CallbackInfoReturnable<DefaultAttributeContainer.Builder> info) {
|
||||||
|
Pony.registerAttributes(info.getReturnValue());
|
||||||
|
}
|
||||||
|
|
||||||
@ModifyVariable(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"), ordinal = 0)
|
@ModifyVariable(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"), ordinal = 0)
|
||||||
protected float modifyDamageAmount(float amount, DamageSource source) {
|
protected float modifyDamageAmount(float amount, DamageSource source) {
|
||||||
return get().modifyDamage(source, amount).orElse(amount);
|
return get().modifyDamage(source, amount).orElse(amount);
|
||||||
|
@ -60,9 +66,9 @@ abstract class MixinPlayerEntity extends LivingEntity implements Equine.Containe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "createPlayerAttributes()Lnet/minecraft/entity/attribute/DefaultAttributeContainer$Builder;", at = @At("RETURN"))
|
@Inject(method = "eatFood(Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;", at = @At("HEAD"))
|
||||||
private static void onCreateAttributes(CallbackInfoReturnable<DefaultAttributeContainer.Builder> info) {
|
private void onEatFood(World world, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||||
Pony.registerAttributes(info.getReturnValue());
|
get().onEat(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "trySleep(Lnet/minecraft/util/math/BlockPos;)Lcom/mojang/datafixers/util/Either;",
|
@Inject(method = "trySleep(Lnet/minecraft/util/math/BlockPos;)Lcom/mojang/datafixers/util/Either;",
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"minecraft:melon_slice",
|
||||||
|
"unicopia:juice",
|
||||||
|
{ "id": "farmersdelight:melon_popsicle", "required": false },
|
||||||
|
{ "id": "farmersdelight:melon_juice", "required": false }
|
||||||
|
]
|
||||||
|
}
|
|
@ -27,6 +27,7 @@
|
||||||
"MixinGuardianTargetPredicate",
|
"MixinGuardianTargetPredicate",
|
||||||
"MixinItem",
|
"MixinItem",
|
||||||
"MixinItemEntity",
|
"MixinItemEntity",
|
||||||
|
"MixinItemStack",
|
||||||
"MixinLivingEntity",
|
"MixinLivingEntity",
|
||||||
"MixinMilkBucketItem",
|
"MixinMilkBucketItem",
|
||||||
"MixinMobEntity",
|
"MixinMobEntity",
|
||||||
|
|
Loading…
Reference in a new issue