fix item sprites
This commit is contained in:
parent
1ef1b4ae30
commit
5c0e71f80c
10 changed files with 43 additions and 209 deletions
|
@ -11,7 +11,6 @@ import common.collect.Sets;
|
|||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.model.ItemMeshDefinition;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
|
@ -293,11 +292,11 @@ public class Item
|
|||
return provider.getModel(this.getTransform(), name);
|
||||
}
|
||||
|
||||
public ItemMeshDefinition getMesher() {
|
||||
public String[] getRenderItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void getRenderItems(Item itemIn, List<ItemStack> subItems) {
|
||||
subItems.add(new ItemStack(itemIn));
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.color.DyeColor;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.model.ItemMeshDefinition;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.tags.TagObject;
|
||||
|
@ -177,44 +176,6 @@ public class ItemBanner extends ItemBlock
|
|||
|
||||
return enumdyecolor;
|
||||
}
|
||||
|
||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||
// if(tag.hasKey("BlockEntityTag")) {
|
||||
// if(!tag.hasTag("BlockEntityTag")) {
|
||||
// return false;
|
||||
// }
|
||||
// NBTTagCompound etag = tag.getCompoundTag("BlockEntityTag");
|
||||
// if(etag.hasKey("Patterns")) {
|
||||
// if(!etag.hasList("Patterns")) {
|
||||
// return false;
|
||||
// }
|
||||
// NBTTagList patterns = etag.getTagList("Patterns", 10);
|
||||
// if(patterns.tagCount() > 16) {
|
||||
// NBTTagList npatterns = new NBTTagList();
|
||||
// for(int z = 0; z < 16; z++) {
|
||||
// npatterns.appendTag(patterns.get(z));
|
||||
// }
|
||||
// etag.setTag("Patterns", npatterns);
|
||||
// }
|
||||
// }
|
||||
// if(etag.hasKey("Base")) {
|
||||
// if(!etag.hasInt("Base")) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public ItemMeshDefinition getMesher() {
|
||||
return new ItemMeshDefinition()
|
||||
{
|
||||
public String getModelLocation(ItemStack stack)
|
||||
{
|
||||
return "item/banner" + '#' + "inventory";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.item;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.enchantment.Enchantment;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
|
@ -137,16 +138,21 @@ public class ItemBow extends Item
|
|||
return 1;
|
||||
}
|
||||
|
||||
public void getRenderItems(Item itemIn, List<ItemStack> subItems) {
|
||||
super.getRenderItems(itemIn, subItems);
|
||||
for(int z = 0; z < 3; z++) {
|
||||
final int data = z + 1;
|
||||
subItems.add(new ItemStack(new ItemBow() {
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.getTransform(), "bow_pulling_" + data);
|
||||
}
|
||||
}));
|
||||
}
|
||||
public String[] getRenderItems() {
|
||||
return new String[] {"bow_pulling_0", "bow_pulling_1", "bow_pulling_2"};
|
||||
}
|
||||
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
if(player.getItemInUse() != null) {
|
||||
int pull = stack.getMaxItemUseDuration() - player.getItemInUseCount();
|
||||
if(pull >= 18)
|
||||
return "bow_pulling_2";
|
||||
else if(pull > 13)
|
||||
return "bow_pulling_1";
|
||||
else if(pull > 0)
|
||||
return "bow_pulling_0";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.enchantment.EnchantmentHelper;
|
|||
import common.enchantment.RngEnchantment;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.model.ItemMeshDefinition;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
|
||||
|
@ -146,58 +145,4 @@ public class ItemEnchantedBook extends Item
|
|||
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30);
|
||||
return new RngLoot(itemstack, minChance, maxChance, weight);
|
||||
}
|
||||
|
||||
// public Set<String> getValidTags() {
|
||||
// return Sets.newHashSet("StoredEnchantments");
|
||||
// }
|
||||
//
|
||||
// protected boolean validateNbt(NBTTagCompound tag) {
|
||||
// if(tag.hasKey("StoredEnchantments")) {
|
||||
// if(!tag.hasList("StoredEnchantments")) {
|
||||
// return false;
|
||||
// }
|
||||
// NBTTagList ench = tag.getTagList("StoredEnchantments", 10);
|
||||
// if(ench.hasNoTags()) {
|
||||
// return false;
|
||||
// }
|
||||
// if(ench.tagCount() > Enchantment.getNames().size()) {
|
||||
// return false;
|
||||
// }
|
||||
// Enchantment[] ecn = new Enchantment[ench.tagCount()];
|
||||
// for(int e = 0; e < ench.tagCount(); e++) {
|
||||
// NBTTagCompound ec = ench.getCompoundTagAt(e);
|
||||
// if(ec.getKeySet().size() != 2 || !ec.hasShort("id") || !ec.hasShort("lvl")) {
|
||||
// return false;
|
||||
// }
|
||||
// int id = ec.getShort("id");
|
||||
// int lvl = ec.getShort("lvl");
|
||||
// Enchantment en = Enchantment.getEnchantmentById(id);
|
||||
// if(en == null) {
|
||||
// return false;
|
||||
// }
|
||||
//// if(!adv && (lvl < en.getMinLevel() || lvl > en.getMaxLevel())) {
|
||||
//// return false;
|
||||
//// }
|
||||
// ecn[e] = en;
|
||||
// }
|
||||
// for(int e = 0; e < ecn.length; e++) {
|
||||
// for(int f = 0; f < ecn.length; f++) {
|
||||
// if(f != e && ecn[e] == ecn[f]) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public ItemMeshDefinition getMesher() {
|
||||
return new ItemMeshDefinition()
|
||||
{
|
||||
public String getModelLocation(ItemStack stack)
|
||||
{
|
||||
return "item/enchanted_book" + '#' + "inventory";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package common.item;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.projectile.EntityHook;
|
||||
|
@ -78,13 +79,12 @@ public class ItemFishingRod extends Item
|
|||
return 1;
|
||||
}
|
||||
|
||||
public void getRenderItems(Item itemIn, List<ItemStack> subItems) {
|
||||
super.getRenderItems(itemIn, subItems);
|
||||
subItems.add(new ItemStack(new ItemFishingRod() {
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.getTransform(), "fishing_rod_cast");
|
||||
}
|
||||
}));
|
||||
public String[] getRenderItems() {
|
||||
return new String[] {"fishing_rod_cast"};
|
||||
}
|
||||
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
return player.fishEntity != null ? "fishing_rod_cast" : null;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.projectile.EntityPotion;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.model.ItemMeshDefinition;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.potion.Potion;
|
||||
|
@ -341,21 +340,6 @@ public class ItemPotion extends Item
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
public ItemMeshDefinition getMesher() {
|
||||
return new ItemMeshDefinition()
|
||||
{
|
||||
public String getModelLocation(ItemStack stack)
|
||||
{
|
||||
return ItemPotion.this.isSplashPotion() ? ("item/splash_potion" + '#' + "inventory") : ("item/potion" + '#' + "inventory");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void getRenderItems(Item itemIn, List<ItemStack> subItems) {
|
||||
if(this.data == 0 || this.data == 16384)
|
||||
super.getRenderItems(itemIn, subItems);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.getTransform(), "potion_overlay", this.isSplashPotion() ? "potion_bottle_splash" : "potion_bottle_drinkable");
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
package common.model;
|
||||
|
||||
import common.item.ItemStack;
|
||||
|
||||
public interface ItemMeshDefinition {
|
||||
String getModelLocation(ItemStack stack);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue