mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Implement zap apple disguises
This commit is contained in:
parent
7bd92d2d2d
commit
a14cb80cb4
3 changed files with 35 additions and 0 deletions
|
@ -95,6 +95,17 @@ public class ZapAppleItem extends AppleItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getAppearanceStack(ItemStack stack) {
|
||||||
|
Item appearance = ((ZapAppleItem)stack.getItem()).getAppearance(stack);
|
||||||
|
if (appearance != Items.AIR) {
|
||||||
|
ItemStack newAppearance = new ItemStack(appearance, stack.getCount());
|
||||||
|
newAppearance.setTag(stack.getTag().copy());
|
||||||
|
newAppearance.removeSubTag("appearance");
|
||||||
|
return newAppearance;
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
public Item getAppearance(ItemStack stack) {
|
public Item getAppearance(ItemStack stack) {
|
||||||
if (stack.hasTag() && stack.getTag().contains("appearance")) {
|
if (stack.hasTag() && stack.getTag().contains("appearance")) {
|
||||||
return Registry.ITEM.get(new Identifier(stack.getTag().getString("appearance")));
|
return Registry.ITEM.get(new Identifier(stack.getTag().getString("appearance")));
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.minelittlepony.unicopia.mixin.client;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.item.ZapAppleItem;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.item.ItemModels;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
@Mixin(ItemModels.class)
|
||||||
|
abstract class MixinItemModels {
|
||||||
|
@ModifyVariable(method = "getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
index = 1)
|
||||||
|
private ItemStack modifyStack(ItemStack stack) {
|
||||||
|
if (stack.getItem() instanceof ZapAppleItem) {
|
||||||
|
return ((ZapAppleItem)stack.getItem()).getAppearanceStack(stack);
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@
|
||||||
"client.MixinCamera",
|
"client.MixinCamera",
|
||||||
"client.MixinEntityRenderDispatcher",
|
"client.MixinEntityRenderDispatcher",
|
||||||
"client.MixinGameRenderer",
|
"client.MixinGameRenderer",
|
||||||
|
"client.MixinItemModels",
|
||||||
"client.MixinKeyboardInput",
|
"client.MixinKeyboardInput",
|
||||||
"client.MixinMinecraftClient",
|
"client.MixinMinecraftClient",
|
||||||
"client.MixinMouse"
|
"client.MixinMouse"
|
||||||
|
|
Loading…
Reference in a new issue