11package com .fox2code .foxloader .client .mixins ;
22
33import com .fox2code .foxloader .client .network .NetworkItemStack ;
4- import com .fox2code .foxloader .client .renderer .TextureDynamic ;
5- import com .fox2code .foxloader .loader .ClientMod ;
64import com .fox2code .foxloader .registry .GameRegistryClient ;
75import com .fox2code .foxloader .registry .RegisteredItem ;
86import com .fox2code .foxloader .registry .RegisteredItemStack ;
1816import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
1917
2018@ Mixin (ItemStack .class )
21- public abstract class MixinItemStack implements RegisteredItemStack ,
22- NetworkItemStack , TextureDynamic .Hooks .TexCacheItemStackRender {
19+ public abstract class MixinItemStack implements RegisteredItemStack , NetworkItemStack {
2320 @ Shadow public int itemID ;
2421 @ Shadow public int stackSize ;
2522 @ Shadow public int itemDamage ;
2623 @ Unique private int networkId ;
27- @ Unique private ItemStack renderCache ;
2824
2925 @ Shadow public abstract Item getItem ();
3026 @ Shadow public abstract String getDisplayName ();
3127 @ Shadow public abstract void setItemName (String par1Str );
3228 @ Shadow public abstract boolean hasDisplayName ();
3329
34- @ Shadow public NBTTagCompound nbtTagCompound ;
35-
3630 @ Inject (method = "<init>(II)V" , at = @ At ("RETURN" ))
3731 public void onNewItemStack (int id , int count , CallbackInfo ci ) {
3832 this .verifyRegisteredItemStack ();
@@ -51,7 +45,6 @@ public void onNewItemStack(int id, int count, int damage, NBTTagCompound tagComp
5145 @ Inject (method = "readFromNBT" , at = @ At ("RETURN" ))
5246 public void onReadFromNBT (NBTTagCompound nbtTagCompound , CallbackInfo ci ) {
5347 this .verifyRegisteredItemStack ();
54- this .renderCache = null ;
5548 }
5649
5750 @ Inject (method = "splitStack" , at = @ At ("RETURN" ))
@@ -99,28 +92,6 @@ public void setRegisteredDisplayName(String displayName) {
9992 this .setItemName (displayName );
10093 }
10194
102- @ Override
103- public int getRegisteredDynamicTextureId () {
104- NBTTagCompound nbtTagCompound = this .nbtTagCompound ;
105- return nbtTagCompound == null || // Avoid NPEs here
106- !nbtTagCompound .hasKey ("DynamicTextureId" ) ? -1 :
107- nbtTagCompound .getByte ("DynamicTextureId" );
108- }
109-
110- @ Override
111- public void setRegisteredDynamicTextureId (int dynamicTextureSlot ) {
112- NBTTagCompound nbtTagCompound = this .nbtTagCompound ;
113- if (dynamicTextureSlot == -1 ) {
114- if (nbtTagCompound != null )
115- nbtTagCompound .removeTag ("DynamicTextureId" );
116- return ;
117- }
118- if (nbtTagCompound == null ) {
119- this .nbtTagCompound = nbtTagCompound = new NBTTagCompound ();
120- }
121- nbtTagCompound .setByte ("DynamicTextureId" , (byte ) dynamicTextureSlot );
122- }
123-
12495 @ Override
12596 public int getRemoteItemId () {
12697 int networkId = this .networkId ;
@@ -136,20 +107,4 @@ public void setRemoteNetworkId(int networkId) {
136107
137108 @ Override
138109 public void verifyRegisteredItemStack () {}
139-
140- @ Override
141- public ItemStack getRenderItemCache (Item item ) {
142- if (this .networkId == -1 )
143- return ClientMod .toItemStack (this );
144- if (this .renderCache == null ) {
145- ItemStack cache = new ItemStack (item , this .stackSize , this .itemDamage , this .nbtTagCompound );
146- ((NetworkItemStack ) (Object ) cache ).setRemoteNetworkId (-1 );
147- return this .renderCache = cache ;
148- }
149- this .renderCache .itemID = item .itemID ;
150- this .renderCache .stackSize = this .stackSize ;
151- this .renderCache .itemDamage = this .itemDamage ;
152- this .renderCache .nbtTagCompound = this .nbtTagCompound ;
153- return this .renderCache ;
154- }
155110}
0 commit comments