mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed component tooltips not rendering
This commit is contained in:
parent
bc1d6f40e6
commit
6ffe1f5e58
2 changed files with 15 additions and 1 deletions
|
@ -92,6 +92,9 @@ public record CustomisedSpellType<T extends Spell> (
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(TooltipContext context, Consumer<Text> tooltip, TooltipType type) {
|
public void appendTooltip(TooltipContext context, Consumer<Text> tooltip, TooltipType type) {
|
||||||
|
if (isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
MutableText lore = Text.translatable(type().getTranslationKey() + ".lore").formatted(type().getAffinity().getColor());
|
MutableText lore = Text.translatable(type().getTranslationKey() + ".lore").formatted(type().getAffinity().getColor());
|
||||||
|
|
||||||
if (!InteractionManager.getInstance().getClientSpecies().canCast()) {
|
if (!InteractionManager.getInstance().getClientSpecies().canCast()) {
|
||||||
|
|
|
@ -12,6 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
import com.minelittlepony.unicopia.client.ModifierTooltipRenderer;
|
||||||
import com.minelittlepony.unicopia.entity.effect.FoodPoisoningStatusEffect;
|
import com.minelittlepony.unicopia.entity.effect.FoodPoisoningStatusEffect;
|
||||||
import com.minelittlepony.unicopia.item.DamageChecker;
|
import com.minelittlepony.unicopia.item.DamageChecker;
|
||||||
import com.minelittlepony.unicopia.item.ItemStackDuck;
|
import com.minelittlepony.unicopia.item.ItemStackDuck;
|
||||||
|
@ -45,7 +47,7 @@ abstract class MixinItemStack implements ItemStackDuck {
|
||||||
getTransientComponents().setCarrier(user);
|
getTransientComponents().setCarrier(user);
|
||||||
TypedActionResult<ItemStack> result = FoodPoisoningStatusEffect.apply((ItemStack)(Object)this, user);
|
TypedActionResult<ItemStack> result = FoodPoisoningStatusEffect.apply((ItemStack)(Object)this, user);
|
||||||
if (result.getResult() != ActionResult.PASS) {
|
if (result.getResult() != ActionResult.PASS) {
|
||||||
info.setReturnValue(result);
|
info.setReturnValue(result) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +71,15 @@ abstract class MixinItemStack implements ItemStackDuck {
|
||||||
getTransientComponents().setCarrier(null);
|
getTransientComponents().setCarrier(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getTooltip",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "net/minecraft/item/ItemStack.appendAttributeModifiersTooltip(Ljava/util/function/Consumer;Lnet/minecraft/entity/player/PlayerEntity;)V"
|
||||||
|
))
|
||||||
|
public void onGetTooltip(Item.TooltipContext context, @Nullable PlayerEntity player, TooltipType type, CallbackInfoReturnable<List<Text>> info, @Local List<Text> lines) {
|
||||||
|
ItemStack self = (ItemStack)(Object)this;
|
||||||
|
ModifierTooltipRenderer.INSTANCE.getTooltip(self, context, player, type, lines);
|
||||||
|
}
|
||||||
|
|
||||||
@ModifyReturnValue(method = "takesDamageFrom", at = @At("RETURN"))
|
@ModifyReturnValue(method = "takesDamageFrom", at = @At("RETURN"))
|
||||||
private boolean onTakesDamageFrom(boolean takesDamage, DamageSource source) {
|
private boolean onTakesDamageFrom(boolean takesDamage, DamageSource source) {
|
||||||
ItemStack self = (ItemStack)(Object)this;
|
ItemStack self = (ItemStack)(Object)this;
|
||||||
|
|
Loading…
Reference in a new issue