Proper Reformating

This commit is contained in:
Kam committed 2025-03-13 17:14:45 -04:00
1 parent ce75880aba
commit 180d257024
1179 files changed
+59847 -61583

No files matched your search

@@ -79,10 +79,10 @@ public class ScriptCustomItem extends ScriptCustomizableItem implements IItemCus
this.loaded = true;
}
if(!this.isEnabled())
if (!this.isEnabled())
return;
if(ScriptController.Instance.lastLoaded > lastInited){
if (ScriptController.Instance.lastLoaded > lastInited) {
lastInited = ScriptController.Instance.lastLoaded;
if (!Objects.equals(hookName, EnumScriptType.INIT.function)) {
EventHooks.onScriptItemInit(this);
@@ -92,7 +92,7 @@ public class ScriptCustomItem extends ScriptCustomizableItem implements IItemCus
for (int i = 0; i < this.scripts.size(); i++) {
ScriptContainer script = this.scripts.get(i);
if (!this.errored.contains(i)) {
if(script == null || script.errored || !script.hasCode())
if (script == null || script.errored || !script.hasCode())
continue;
script.run(hookName, event);
@@ -152,35 +152,35 @@ public class ScriptCustomItem extends ScriptCustomizableItem implements IItemCus
saveItemData();
}
public int getArmorType(){
public int getArmorType() {
return this.armorType;
}
public void setIsTool(boolean isTool){
public void setIsTool(boolean isTool) {
this.isTool = isTool;
saveItemData();
}
public boolean isTool(){
public boolean isTool() {
return this.isTool;
}
public void setIsNormalItem(boolean normalItem){
public void setIsNormalItem(boolean normalItem) {
this.isNormalItem = normalItem;
saveItemData();
}
public boolean isNormalItem(){
public boolean isNormalItem() {
return this.isNormalItem;
}
public void setDigSpeed(int digSpeed){
public void setDigSpeed(int digSpeed) {
this.digSpeed = digSpeed;
saveItemData();
}
public int getDigSpeed(){
public int getDigSpeed() {
return this.digSpeed;
}
@@ -198,11 +198,11 @@ public class ScriptCustomItem extends ScriptCustomizableItem implements IItemCus
}
public void setDurabilityValue(float value) {
this.durabilityValue = (double)value;
this.durabilityValue = (double) value;
saveItemData();
}
public int getMaxItemUseDuration(){
public int getMaxItemUseDuration() {
return this.maxItemUseDuration;
}
@@ -220,11 +220,11 @@ public class ScriptCustomItem extends ScriptCustomizableItem implements IItemCus
return this.itemUseAction;
}
public int getEnchantability(){
public int getEnchantability() {
return this.enchantability;
}
public void setEnchantability(int enchantability){
public void setEnchantability(int enchantability) {
this.enchantability = enchantability;
saveItemData();
}
@@ -258,8 +258,8 @@ public class ScriptCustomItem extends ScriptCustomizableItem implements IItemCus
public NBTTagCompound getItemNBT(NBTTagCompound compound) {
super.getItemNBT(compound);
compound.setDouble("DurabilityValue",this.durabilityValue);
compound.setInteger("MaxStackSize",this.stackSize);
compound.setDouble("DurabilityValue", this.durabilityValue);
compound.setInteger("MaxStackSize", this.stackSize);
compound.setBoolean("IsTool", this.isTool);
compound.setBoolean("IsNormalItem", this.isNormalItem);
@@ -35,8 +35,8 @@ public abstract class ScriptCustomizableItem extends ScriptItemStack implements
return this.itemDisplay.texture == null ? "" : this.itemDisplay.texture;
}
public void setTexture(String texture){
if(texture == null)
public void setTexture(String texture) {
if (texture == null)
texture = "";
this.itemDisplay.texture = texture;
saveItemData();
@@ -70,28 +70,28 @@ public abstract class ScriptCustomizableItem extends ScriptItemStack implements
}
public void setRotation(Float rotationX, Float rotationY, Float rotationZ){
public void setRotation(Float rotationX, Float rotationY, Float rotationZ) {
this.itemDisplay.rotationX = rotationX;
this.itemDisplay.rotationY = rotationY;
this.itemDisplay.rotationZ = rotationZ;
saveItemData();
}
public void setRotationRate(Float rotationXRate, Float rotationYRate, Float rotationZRate){
public void setRotationRate(Float rotationXRate, Float rotationYRate, Float rotationZRate) {
this.itemDisplay.rotationXRate = rotationXRate;
this.itemDisplay.rotationYRate = rotationYRate;
this.itemDisplay.rotationZRate = rotationZRate;
saveItemData();
}
public void setScale(Float scaleX, Float scaleY, Float scaleZ){
public void setScale(Float scaleX, Float scaleY, Float scaleZ) {
this.itemDisplay.scaleX = scaleX;
this.itemDisplay.scaleY = scaleY;
this.itemDisplay.scaleZ = scaleZ;
saveItemData();
}
public void setTranslate(Float translateX, Float translateY, Float translateZ){
public void setTranslate(Float translateX, Float translateY, Float translateZ) {
this.itemDisplay.translateX = translateX;
this.itemDisplay.translateY = translateY;
this.itemDisplay.translateZ = translateZ;
@@ -167,7 +167,7 @@ public abstract class ScriptCustomizableItem extends ScriptItemStack implements
public void loadItemData() {
NBTTagCompound c = this.item.getTagCompound();
if (c != null && !c.getCompoundTag("ItemData").hasNoTags()){
if (c != null && !c.getCompoundTag("ItemData").hasNoTags()) {
this.setItemNBT(c.getCompoundTag("ItemData"));
}
}
@@ -19,11 +19,11 @@ public class ScriptItemBook extends ScriptItemStack implements IItemBook {
List<String> list = new ArrayList<String>();
NBTTagList pages = this.getTag().getTagList("pages", 8);
for(int i = 0; i < pages.tagCount(); ++i) {
for (int i = 0; i < pages.tagCount(); ++i) {
list.add(pages.getStringTagAt(i));
}
return (String[])list.toArray(new String[list.size()]);
return (String[]) list.toArray(new String[list.size()]);
}
public void setText(String[] pages) {
@@ -32,7 +32,7 @@ public class ScriptItemBook extends ScriptItemStack implements IItemBook {
String[] var3 = pages;
int var4 = pages.length;
for(int var5 = 0; var5 < var4; ++var5) {
for (int var5 = 0; var5 < var4; ++var5) {
String page = var3[var5];
list.appendTag(new NBTTagString(page));
}
@@ -46,7 +46,7 @@ public class ScriptItemBook extends ScriptItemStack implements IItemBook {
}
public void setAuthor(String author) {
this.getTag().setString("author",author);
this.getTag().setString("author", author);
}
public String getTitle() {
@@ -54,7 +54,7 @@ public class ScriptItemBook extends ScriptItemStack implements IItemBook {
}
public void setTitle(String title) {
this.getTag().setString("title",title);
this.getTag().setString("title", title);
}
private NBTTagCompound getTag() {
@@ -28,301 +28,301 @@ import java.util.List;
import java.util.Map;
public class ScriptItemStack implements IItemStack {
public ItemStack item;
public ItemStack item;
public ScriptItemStack(ItemStack item){
this.item = item;
}
public ScriptItemStack(ItemStack item) {
this.item = item;
}
public int getType() {
if (this.item.getItem() instanceof IPlantable) {
return 5;
} else {
return this.item.getItem() instanceof ItemSword ? 4 : 0;
}
}
public int getType() {
if (this.item.getItem() instanceof IPlantable) {
return 5;
} else {
return this.item.getItem() instanceof ItemSword ? 4 : 0;
}
}
/**
* @return The minecraft name for this item
*/
public String getName(){
return Item.itemRegistry.getNameForObject(item.getItem());
}
/**
* @return The minecraft name for this item
*/
public String getName() {
return Item.itemRegistry.getNameForObject(item.getItem());
}
/**
* @return Returns the stacksize
*/
public int getStackSize(){
return item.stackSize;
}
/**
* @return Returns the stacksize
*/
public int getStackSize() {
return item.stackSize;
}
/**
* @return Return whether or not the item has a custom name
*/
public boolean hasCustomName(){
return item.hasDisplayName();
}
/**
* @return Return whether or not the item has a custom name
*/
public boolean hasCustomName() {
return item.hasDisplayName();
}
/**
* @param name The custom name this item will get
*/
public void setCustomName(String name){
item.setStackDisplayName(name);
}
/**
* @param name The custom name this item will get
*/
public void setCustomName(String name) {
item.setStackDisplayName(name);
}
/**
* @return Return the ingame displayed name. This is either the item name or the custom name if it has one.
*/
public String getDisplayName(){
return item.getDisplayName();
}
/**
* @return Return the ingame displayed name. This is either the item name or the custom name if it has one.
*/
public String getDisplayName() {
return item.getDisplayName();
}
/**
* @return Get the items ingame name. Use this incase the item ingame has custom name and you want the original name.
*/
public String getItemName(){
return item.getItem().getItemStackDisplayName(item);
}
/**
* @return Get the items ingame name. Use this incase the item ingame has custom name and you want the original name.
*/
public String getItemName() {
return item.getItem().getItemStackDisplayName(item);
}
public int getMaxStackSize() {
return this.item.getMaxStackSize();
}
public int getMaxStackSize() {
return this.item.getMaxStackSize();
}
/**
* @param size The size of the itemstack. A number between 1 and 64
*/
public void setStackSize(int size){
if(size < 0)
size = 1;
else if(size > 64)
size = 64;
item.stackSize = size;
}
/**
* @param size The size of the itemstack. A number between 1 and 64
*/
public void setStackSize(int size) {
if (size < 0)
size = 1;
else if (size > 64)
size = 64;
item.stackSize = size;
}
/**
* @return Returns the item damage of this item. For tools this is the durability for other items the color and more.
*/
public int getItemDamage(){
return item.getItemDamage();
}
/**
* @return Returns the item damage of this item. For tools this is the durability for other items the color and more.
*/
public int getItemDamage() {
return item.getItemDamage();
}
/**
* @param value The value to be set as item damage. For tools this is the durability for other items the color and more.
*/
public void setItemDamage(int value){
item.setItemDamage(value);
}
/**
* @param value The value to be set as item damage. For tools this is the durability for other items the color and more.
*/
public void setItemDamage(int value) {
item.setItemDamage(value);
}
/**
* @param key The key of this NBTTag
* @param value The value to be stored. Can be a Number or String
*/
public void setTag(String key, Object value){
if(value instanceof Number)
getTag().setDouble(key, ((Number) value).doubleValue());
else if(value instanceof String)
getTag().setString(key, (String) value);
/**
* @param key The key of this NBTTag
* @param value The value to be stored. Can be a Number or String
*/
public void setTag(String key, Object value) {
if (value instanceof Number)
getTag().setDouble(key, ((Number) value).doubleValue());
else if (value instanceof String)
getTag().setString(key, (String) value);
}
}
/**
* @param key The key of the NBTTag
* @return Returns whether or not the key exists
*/
public boolean hasTag(String key){
if(item.stackTagCompound == null)
return false;
return getTag().hasKey(key);
}
/**
* @param key The key of the NBTTag
* @return Returns whether or not the key exists
*/
public boolean hasTag(String key) {
if (item.stackTagCompound == null)
return false;
return getTag().hasKey(key);
}
/**
* @param key The key of the NBTTag
* @return Returns the value associated with the key. Returns null of it doesnt exist
*/
public Object getTag(String key){
if(item.stackTagCompound == null)
return null;
/**
* @param key The key of the NBTTag
* @return Returns the value associated with the key. Returns null of it doesnt exist
*/
public Object getTag(String key) {
if (item.stackTagCompound == null)
return null;
NBTBase tag = getTag().getTag(key);
if(tag == null)
return null;
if(tag instanceof NBTPrimitive)
return ((NBTPrimitive)tag).func_150286_g();
if(tag instanceof NBTTagString)
return ((NBTTagString)tag).func_150285_a_();
return tag;
}
NBTBase tag = getTag().getTag(key);
if (tag == null)
return null;
if (tag instanceof NBTPrimitive)
return ((NBTPrimitive) tag).func_150286_g();
if (tag instanceof NBTTagString)
return ((NBTTagString) tag).func_150285_a_();
return tag;
}
public INbt removeTags() {
ScriptNbt nbt = (ScriptNbt) NpcAPI.Instance().getINbt(item.stackTagCompound);
item.stackTagCompound = null;
return nbt;
}
public INbt removeTags() {
ScriptNbt nbt = (ScriptNbt) NpcAPI.Instance().getINbt(item.stackTagCompound);
item.stackTagCompound = null;
return nbt;
}
public boolean isEnchanted(){
return item.isItemEnchanted();
}
public boolean isEnchanted() {
return item.isItemEnchanted();
}
/**
* @since 1.7.10d
* @param id The enchantment id
* @return
*/
public boolean hasEnchant(int id){
if(!isEnchanted())
return false;
NBTTagList list = item.getEnchantmentTagList();
for(int i = 0; i < list.tagCount(); i++){
NBTTagCompound compound = list.getCompoundTagAt(i);
if(compound.getShort("id") == id)
return true;
}
return false;
}
/**
* @param id The enchantment id
* @return
* @since 1.7.10d
*/
public boolean hasEnchant(int id) {
if (!isEnchanted())
return false;
NBTTagList list = item.getEnchantmentTagList();
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound compound = list.getCompoundTagAt(i);
if (compound.getShort("id") == id)
return true;
}
return false;
}
public void addEnchant(int id, int strength) {
Enchantment ench = Enchantment.enchantmentsList[id];
if (ench == null) {
throw new CustomNPCsException("Unknown enchant id:" + id, new Object[0]);
} else {
this.item.addEnchantment(ench, strength);
}
}
public void addEnchant(int id, int strength) {
Enchantment ench = Enchantment.enchantmentsList[id];
if (ench == null) {
throw new CustomNPCsException("Unknown enchant id:" + id, new Object[0]);
} else {
this.item.addEnchantment(ench, strength);
}
}
public void setAttribute(String name, double value) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
this.item.setTagCompound(compound = new NBTTagCompound());
}
public void setAttribute(String name, double value) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
this.item.setTagCompound(compound = new NBTTagCompound());
}
NBTTagList nbttaglist = compound.getTagList("AttributeModifiers", 10);
NBTTagList newList = new NBTTagList();
NBTTagList nbttaglist = compound.getTagList("AttributeModifiers", 10);
NBTTagList newList = new NBTTagList();
NBTTagCompound nbttagcompound;
for(int i = 0; i < nbttaglist.tagCount(); ++i) {
nbttagcompound = nbttaglist.getCompoundTagAt(i);
if (!nbttagcompound.getString("AttributeName").equals(name)) {
newList.appendTag(nbttagcompound);
}
}
NBTTagCompound nbttagcompound;
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
nbttagcompound = nbttaglist.getCompoundTagAt(i);
if (!nbttagcompound.getString("AttributeName").equals(name)) {
newList.appendTag(nbttagcompound);
}
}
if (value != 0.0D) {
AttributeModifier attributeModifier = new AttributeModifier(name, value, 0);
nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("Name", attributeModifier.getName());
nbttagcompound.setDouble("Amount", attributeModifier.getAmount());
nbttagcompound.setInteger("Operation", attributeModifier.getOperation());
nbttagcompound.setLong("UUIDMost", attributeModifier.getID().getMostSignificantBits());
nbttagcompound.setLong("UUIDLeast", attributeModifier.getID().getLeastSignificantBits());
nbttagcompound.setString("AttributeName", name);
newList.appendTag(nbttagcompound);
}
if (value != 0.0D) {
AttributeModifier attributeModifier = new AttributeModifier(name, value, 0);
nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("Name", attributeModifier.getName());
nbttagcompound.setDouble("Amount", attributeModifier.getAmount());
nbttagcompound.setInteger("Operation", attributeModifier.getOperation());
nbttagcompound.setLong("UUIDMost", attributeModifier.getID().getMostSignificantBits());
nbttagcompound.setLong("UUIDLeast", attributeModifier.getID().getLeastSignificantBits());
nbttagcompound.setString("AttributeName", name);
newList.appendTag(nbttagcompound);
}
compound.setTag("AttributeModifiers", newList);
}
compound.setTag("AttributeModifiers", newList);
}
public double getAttribute(String name) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
return 0.0D;
} else {
Multimap<String, AttributeModifier> map = this.item.getAttributeModifiers();
Iterator var4 = map.entries().iterator();
public double getAttribute(String name) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
return 0.0D;
} else {
Multimap<String, AttributeModifier> map = this.item.getAttributeModifiers();
Iterator var4 = map.entries().iterator();
while(var4.hasNext()) {
Map.Entry entry = (Map.Entry)var4.next();
if (((String)entry.getKey()).equals(name)) {
AttributeModifier mod = (AttributeModifier)entry.getValue();
return mod.getAmount();
}
}
while (var4.hasNext()) {
Map.Entry entry = (Map.Entry) var4.next();
if (((String) entry.getKey()).equals(name)) {
AttributeModifier mod = (AttributeModifier) entry.getValue();
return mod.getAmount();
}
}
return 0.0D;
}
}
return 0.0D;
}
}
public String[] getLore() {
if (this.item.getTagCompound() != null) {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if(compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
if (nbttaglist.tagCount() > 0) {
List<String> lore = new ArrayList();
public String[] getLore() {
if (this.item.getTagCompound() != null) {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if (compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
if (nbttaglist.tagCount() > 0) {
List<String> lore = new ArrayList();
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
lore.add(nbttaglist.getStringTagAt(i));
}
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
lore.add(nbttaglist.getStringTagAt(i));
}
return (String[]) ((String[]) lore.toArray(new String[lore.size()]));
}
}
}
return new String[0];
}
return (String[]) ((String[]) lore.toArray(new String[lore.size()]));
}
}
}
return new String[0];
}
public boolean hasLore() {
if (this.item.getTagCompound() != null) {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if (compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
return nbttaglist.tagCount() > 0;
}
}
return false;
}
public boolean hasLore() {
if (this.item.getTagCompound() != null) {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if (compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
return nbttaglist.tagCount() > 0;
}
}
return false;
}
public void setLore(String[] lore) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
this.item.setTagCompound(compound = new NBTTagCompound());
}
public void setLore(String[] lore) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
this.item.setTagCompound(compound = new NBTTagCompound());
}
NBTTagCompound display = compound.getCompoundTag("display");
if(lore == null || lore.length == 0) {
if (lore == null || lore.length == 0) {
display.removeTag("Lore");
return;
}
NBTTagList nbtlist = new NBTTagList();
for(String s : lore) {
for (String s : lore) {
nbtlist.appendTag(new NBTTagString(s));
}
display.setTag("Lore", nbtlist);
compound.setTag("display", display);
}
}
public boolean hasAttribute(String name) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
return false;
} else {
NBTTagList nbttaglist = compound.getTagList("AttributeModifiers", 10);
public boolean hasAttribute(String name) {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
return false;
} else {
NBTTagList nbttaglist = compound.getTagList("AttributeModifiers", 10);
for(int i = 0; i < nbttaglist.tagCount(); ++i) {
NBTTagCompound c = nbttaglist.getCompoundTagAt(i);
if (c.getString("AttributeName").equals(name)) {
return true;
}
}
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
NBTTagCompound c = nbttaglist.getCompoundTagAt(i);
if (c.getString("AttributeName").equals(name)) {
return true;
}
}
return false;
}
}
return false;
}
}
private static ScriptItemStack createNew(ItemStack item){
if(item == null)
private static ScriptItemStack createNew(ItemStack item) {
if (item == null)
return null;
if (item.getItem() instanceof ItemLinked) {
return new ScriptLinkedItem(item);
}
if(item.getItem() instanceof ItemScripted) {
if (item.getItem() instanceof ItemScripted) {
return new ScriptCustomItem(item);
}
if(item.getItem() == Items.written_book || item.getItem() == Items.writable_book || item.getItem() instanceof ItemWritableBook || item.getItem() instanceof ItemEditableBook)
if (item.getItem() == Items.written_book || item.getItem() == Items.writable_book || item.getItem() instanceof ItemWritableBook || item.getItem() instanceof ItemEditableBook)
return new ScriptItemBook(item);
if(item.getItem() instanceof ItemArmor)
if (item.getItem() instanceof ItemArmor)
return new ScriptItemArmor(item);
if (item.getItem() instanceof ItemBlock)
return new ScriptItemBlock(item);
@@ -336,112 +336,114 @@ public class ScriptItemStack implements IItemStack {
}
@Override
public int getMaxItemDamage(){
public int getMaxItemDamage() {
return item.getMaxDamage();
}
/**
* @since 1.7.10d
* @return Returns whether this item is a book
*/
public boolean isWrittenBook(){
return item.getItem() == Items.written_book || item.getItem() == Items.writable_book;
}
/**
* @return Returns whether this item is a book
* @since 1.7.10d
*/
public boolean isWrittenBook() {
return item.getItem() == Items.written_book || item.getItem() == Items.writable_book;
}
/**
* @since 1.7.10d
* @return Returns the books title
*/
public String getBookTitle(){
return item.getTagCompound().getString("title");
}
/**
* @return Returns the books title
* @since 1.7.10d
*/
public String getBookTitle() {
return item.getTagCompound().getString("title");
}
/**
* @since 1.7.10d
* @return Returns the books author
*/
public String getBookAuthor(){
return item.getTagCompound().getString("author");
}
/**
* @return Returns the books author
* @since 1.7.10d
*/
public String getBookAuthor() {
return item.getTagCompound().getString("author");
}
/**
* @since 1.7.10d
* @return If the item is a book, returns a string array with book pages
*/
public String[] getBookText(){
if(!isWrittenBook())
return null;
List<String> list = new ArrayList<String>();
/**
* @return If the item is a book, returns a string array with book pages
* @since 1.7.10d
*/
public String[] getBookText() {
if (!isWrittenBook())
return null;
List<String> list = new ArrayList<String>();
NBTTagList pages = item.getTagCompound().getTagList("pages", 8);
for (int i = 0; i < pages.tagCount(); ++i){
list.add(pages.getStringTagAt(i));
for (int i = 0; i < pages.tagCount(); ++i) {
list.add(pages.getStringTagAt(i));
}
return list.toArray(new String[list.size()]);
}
}
private NBTTagCompound getTag(){
if(item.stackTagCompound == null)
item.stackTagCompound = new NBTTagCompound();
return item.stackTagCompound;
}
private NBTTagCompound getTag() {
if (item.stackTagCompound == null)
item.stackTagCompound = new NBTTagCompound();
return item.stackTagCompound;
}
/**
* @return Returns whether or not this item is a block
*/
public boolean isBlock(){
Block block = Block.getBlockFromItem(item.getItem());
if(block == null || block == Blocks.air)
return false;
return true;
}
/**
* @return Returns whether or not this item is a block
*/
public boolean isBlock() {
Block block = Block.getBlockFromItem(item.getItem());
if (block == null || block == Blocks.air)
return false;
return true;
}
public boolean isFood() {
return item.getItem() instanceof ItemFood;
}
public boolean isFood() {
return item.getItem() instanceof ItemFood;
}
public int getFoodPoints() {
if (isFood()) return ((ItemFood)item.getItem()).func_150905_g(item);
return -1;
}
public int getFoodPoints() {
if (isFood()) return ((ItemFood) item.getItem()).func_150905_g(item);
return -1;
}
public INbt getNbt() {
NBTTagCompound compound = this.item.getTagCompound();
if(compound == null) {
this.item.setTagCompound(compound = new NBTTagCompound());
}
public INbt getNbt() {
NBTTagCompound compound = this.item.getTagCompound();
if (compound == null) {
this.item.setTagCompound(compound = new NBTTagCompound());
}
return NpcAPI.Instance().getINbt(compound);
}
return NpcAPI.Instance().getINbt(compound);
}
public INbt getItemNbt() {
NBTTagCompound compound = new NBTTagCompound();
this.item.writeToNBT(compound);
return NpcAPI.Instance().getINbt(compound);
}
public INbt getItemNbt() {
NBTTagCompound compound = new NBTTagCompound();
this.item.writeToNBT(compound);
return NpcAPI.Instance().getINbt(compound);
}
public NBTTagCompound getMCNbt() {
NBTTagCompound compound = new NBTTagCompound();
this.item.writeToNBT(compound);
return compound;
}
public NBTTagCompound getMCNbt() {
NBTTagCompound compound = new NBTTagCompound();
this.item.writeToNBT(compound);
return compound;
}
public void setMCNbt(NBTTagCompound compound) {}
public void setMCNbt(NBTTagCompound compound) {
}
/**
* No support is given for this method. Dont use if you dont know what you are doing.
* @return Minecraft ItemStack
*/
public ItemStack getMCItemStack() {
return item;
}
/**
* No support is given for this method. Dont use if you dont know what you are doing.
*
* @return Minecraft ItemStack
*/
public ItemStack getMCItemStack() {
return item;
}
public int itemHash() {
return item.hashCode();
}
public int itemHash() {
return item.hashCode();
}
public boolean equals(Object object) {
return object instanceof ScriptItemStack && ((ScriptItemStack) object).getMCItemStack().equals(this.getMCItemStack());
}
public boolean equals(Object object) {
return object instanceof ScriptItemStack && ((ScriptItemStack) object).getMCItemStack().equals(this.getMCItemStack());
}
@Override
public boolean compare(IItemStack item, boolean ignoreNBT) {
@@ -11,6 +11,7 @@ public class ScriptLinkedItem extends ScriptCustomizableItem implements IItemLin
public LinkedItem linkedItem = new LinkedItem();
public double durabilityValue = 1.0D;
public int linkedVersion = 1;
public ScriptLinkedItem(ItemStack item) {
super(item);
setDefaults();
@@ -26,7 +27,7 @@ public class ScriptLinkedItem extends ScriptCustomizableItem implements IItemLin
saveItemData();
}
public void setDefaults(){
public void setDefaults() {
this.itemDisplay.texture = null;
this.itemDisplay.translateX = null;
this.itemDisplay.translateY = null;
@@ -51,7 +52,7 @@ public class ScriptLinkedItem extends ScriptCustomizableItem implements IItemLin
@Override
public INpcScriptHandler getScriptHandler() {
if(this.getLinkedItem() == null)
if (this.getLinkedItem() == null)
return null;
return this.getLinkedItem().getScriptHandler();
}
@@ -192,7 +193,7 @@ public class ScriptLinkedItem extends ScriptCustomizableItem implements IItemLin
public void loadItemData() {
NBTTagCompound c = this.item.getTagCompound();
if (c != null && !c.getCompoundTag("ItemData").hasNoTags()){
if (c != null && !c.getCompoundTag("ItemData").hasNoTags()) {
this.setItemNBT(c.getCompoundTag("ItemData"));
}
}