diff --git a/src/mods/battlegear2/api/IHeraldyArmour.java b/src/mods/battlegear2/api/IHeraldyArmour.java deleted file mode 100644 index a32e64a24c7..00000000000 --- a/src/mods/battlegear2/api/IHeraldyArmour.java +++ /dev/null @@ -1,11 +0,0 @@ -package mods.battlegear2.api; - - -import mods.battlegear2.heraldry.HeraldyPattern; - -public interface IHeraldyArmour extends IHeraldyItem{ - - public String getBaseArmourPath(int armourSlot); - - public String getPatternArmourPath(HeraldyPattern pattern, int armourSlot); -} diff --git a/src/mods/battlegear2/api/IHeraldyItem.java b/src/mods/battlegear2/api/IHeraldyItem.java deleted file mode 100644 index 1f188ee587c..00000000000 --- a/src/mods/battlegear2/api/IHeraldyItem.java +++ /dev/null @@ -1,77 +0,0 @@ -package mods.battlegear2.api; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; - -@Deprecated -public interface IHeraldyItem { - - public enum HeraldyRenderPassess{ - /** - * The first render pass. This will use the items base icon coloured the primary colour - */ - PrimaryColourBase, - /** - * The second render pass. This will use the selected pattern overlayed on top of the base icon with the apropriate colour - */ - SecondaryColourPattern, - /** - * The third render pass. The sigil(s) will be rendered on top of the pattern in the apropriate positions - */ - Sigil, - /** - * Fourth render pass. The items trim icon will be rendered in the secondady colour - */ - SecondaryColourTrim, - /** - * Fifth Render pass, the Items post render icon will be rendered in the default colour - */ - PostRenderIcon - } - - /** - * Returns the "base" icon. This icon will be coloured the primary colour - */ - public Icon getBaseIcon(ItemStack stack); - /** - * Returns the trim icon, This will be coloured the secondary colour - */ - public Icon getTrimIcon(ItemStack stack); - /** - * Returns the post render icon, this Icon will render after all other rendering passess in it's default colour - */ - public Icon getPostRenderIcon(ItemStack stack); - - - /** - * Returns true if the given itemstack has heraldy attached - */ - public boolean hasHeraldry(ItemStack stack); - /** - * Returns the current heraldy code, this will only be called on ItemStacks that have been found to have heraldrybackup using the hasHeraldryMethod - */ - public byte[] getHeraldryCode(ItemStack stack); - - /** - * Saves the given heraldy code in the given stack. It is recommended to use the stacks NBT Tag compound for this - */ - public void setHeraldryCode(ItemStack stack, byte[] code); - - /** - * Removes the heraldy code from the item - */ - public void removeHeraldry(ItemStack item); - - /** - * Returns true if the default renderer should perform the given render pass - */ - public boolean shouldDoPass(HeraldyRenderPassess pass); - - /** - * Returns true if the default renderer should be used. - * If the method returns true, the default renderer will be attached. - * If this method returns false it is the modders responsibility to attach an appropriate renderer - */ - public boolean useDefaultRenderer(); - -} diff --git a/src/mods/battlegear2/api/heraldry/HeraldryData.java b/src/mods/battlegear2/api/heraldry/HeraldryData.java deleted file mode 100644 index 46fc6ec7a65..00000000000 --- a/src/mods/battlegear2/api/heraldry/HeraldryData.java +++ /dev/null @@ -1,138 +0,0 @@ -package mods.battlegear2.api.heraldry; - -import mods.battlegear2.utils.BattlegearUtils; - -import java.io.*; -import java.util.Arrays; - -public class HeraldryData { - - - public static final int RED = 1; - public static final int GREEN = 2; - public static final int BLUE = 3; - - private byte pattern; - private short crest; - private byte crestPosition; - private int[] colours = new int[5]; - - private byte helm; - private byte banner; - - private byte[] byteArray = null; - - public HeraldryData(int pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3, int crest, int crest_col_1, int crest_col_2, int crest_position, int helm, int banner) { - this.pattern = (byte) pattern; - this.crest = (short) crest; - colours = new int[]{pattern_col_1, pattern_col_2, pattern_col_3, crest_col_1, crest_col_2}; - this.crestPosition = (byte) crest_position; - this.helm = (byte) helm; - this.banner = (byte) banner; - } - - public HeraldryData(byte pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3){ - this(pattern, pattern_col_1, pattern_col_2, pattern_col_3, 0, 0, 0,0, 0, 0); - } - - public HeraldryData(byte[] data){ - DataInputStream input = null; - - try{ - input = new DataInputStream(new ByteArrayInputStream(data)); - - pattern = input.readByte();; - crest = input.readShort(); - crestPosition = input.readByte(); - colours= new int[5]; - for(int i = 0; i < colours.length; i++){ - colours[i] = input.readInt(); - } - - helm = input.readByte(); - banner = input.readByte(); - - byteArray = Arrays.copyOf(data, data.length); - - }catch (Exception e){ - e.printStackTrace(); - }finally { - BattlegearUtils.closeStream(input); - } - } - - public static HeraldryData getDefault() { - return new HeraldryData(10, 0xFF000000, 0xFFFFFFFF, 0xFFFFFF00, 0, 0xFF000000, 0xFF000000, 0, 0, 0); - } - - public byte[] getByteArray(){ - - if(byteArray != null){ - return byteArray; - } - - DataOutputStream output = null; - - ByteArrayOutputStream bos = null; - - try{ - bos = new ByteArrayOutputStream(); - output = new DataOutputStream(bos); - - output.writeByte(pattern); - output.writeShort(crest); - output.writeByte(crestPosition); - for(int i = 0; i < 5; i++){ - output.writeInt(colours[i]); - } - - output.writeByte(helm); - output.writeByte(banner); - - return bos.toByteArray(); - } catch (Exception e){ - e.printStackTrace(); - } finally { - BattlegearUtils.closeStream(output); - } - - return null; - } - - public int getColourChanel(int colour, int chanelNo){ - switch (chanelNo){ - case RED: - return (colours[colour] >> 16) & 0xFF; - case GREEN: - return (colours[colour] >> 8) & 0xFF; - case BLUE: - return (colours[colour] >> 0) & 0xFF; - default: - return (colours[colour] >> 16) & 0xFF; - } - } - - public byte getPattern() { - return pattern; - } - - public int getColour(int i) { - return colours[i]; - } - - @Override - public String toString() { - return byteArrayToHex(getByteArray()); - } - - public static String byteArrayToHex(byte[] a) { - StringBuilder sb = new StringBuilder(); - for(byte b: a) - sb.append(String.format("%02x", b&0xff)); - return sb.toString(); - } - - public short getCrest() { - return crest; - } -} diff --git a/src/mods/battlegear2/api/heraldry/IHeraldryItem.java b/src/mods/battlegear2/api/heraldry/IHeraldryItem.java deleted file mode 100644 index 040d1013826..00000000000 --- a/src/mods/battlegear2/api/heraldry/IHeraldryItem.java +++ /dev/null @@ -1,59 +0,0 @@ -package mods.battlegear2.api.heraldry; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; - -public interface IHeraldryItem { - - public enum HeraldyRenderPassess{ - Pattern, - SecondaryColourTrim, - PostRenderIcon - } - - /** - * Returns the "base" icon. This icon will be coloured the primary colour - */ - public Icon getBaseIcon(ItemStack stack); - /** - * Returns the trim icon, This will be coloured the secondary colour - */ - public Icon getTrimIcon(ItemStack stack); - /** - * Returns the post render icon, this Icon will render after all other rendering passess in it's default colour - */ - public Icon getPostRenderIcon(ItemStack stack); - - - /** - * Returns true if the given itemstack has heraldy attached - */ - public boolean hasHeraldry(ItemStack stack); - /** - * Returns the current heraldy code, this will only be called on ItemStacks that have been found to have heraldry using the hasHeraldryMethod - */ - public byte[] getHeraldry(ItemStack stack); - - /** - * Saves the given heraldry code in the given stack. It is recommended to save the Byte array representation of the crest in the NBT - */ - public void setHeraldry(ItemStack stack, byte[] data); - - /** - * Removes the heraldry code from the item - */ - public void removeHeraldry(ItemStack item); - - /** - * Returns true if the default renderer should perform the given render pass - */ - public boolean shouldDoPass(HeraldyRenderPassess pass); - - /** - * Returns true if the default renderer should be used. - * If the method returns true, the default renderer will be attached. - * If this method returns false it is the modders responsibility to attach an appropriate renderer - */ - public boolean useDefaultRenderer(); - -}