Posted November 22, 201410 yr I just merged my armor (which implements ISpecialArmor) from 4 classes to 1, and I'm having 3 issues with it now. First, I can't figure out what I need to change to alter the armor points it gives you; when it was 4 classes, it didn't give you any, and now it gives you 3 full icons for some reason, but nothing I change affects the points. Second, I set it up to spawn particles when the wearer is hit at night, and merging it into 1 class broke this. No clue why. Third, I added step-up capabilities to the armor when the full set is worn, but even though player.stepHeight is being set correctly every time in every situation, I get no step-up capability. PS, related to #2, the only vanilla particles that will show up for me when I try to spawn particles myself are the explosion varieties, why is this? Armor public class ItemMithrilArmor extends ItemArmor implements ISpecialArmor { private String texturePath = Reference.MODID + ":" + "textures/models/armor/"; public ItemMithrilArmor(String name, ArmorMaterial armormat, int renderIndex, int slot) { super(armormat, renderIndex, slot); setUnlocalizedName(name); setTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setMaxStackSize(1); setCreativeTab(AACreativeTab.aaTab); MinecraftForge.EVENT_BUS.register(this); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return slot == 2 ? Reference.MODID + ":textures/models/armor/mithrilArmor_layer_2.png" : Reference.MODID + ":textures/models/armor/mithrilArmor_layer_1.png"; } @Override public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { this.setDamage(stack, this.getDamage(stack) + damage); } @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { WorldServer overworldInst = null; if(!player.worldObj.isRemote) { overworldInst = MinecraftServer.getServer().worldServers[0]; } ArmorProperties mithArmor = null; if(overworldInst != null) { switch(slot) { case 0: mithArmor = new ArmorProperties(1, 1D, 2); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 8; } else { mithArmor.AbsorbMax = 2; } return mithArmor; case 1: mithArmor = new ArmorProperties(4, 1D, 4); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 16; } else { mithArmor.AbsorbMax = 4; } return mithArmor; case 2: mithArmor = new ArmorProperties(3, 1D, 3); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 12; } else { mithArmor.AbsorbMax = 3; } return mithArmor; case 3: mithArmor = new ArmorProperties(2, 1D, 2); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 8; } else { mithArmor.AbsorbMax = 2; } return mithArmor; default: mithArmor = new ArmorProperties(0, 0, 0); } } return mithArmor; } @Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return slot; } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { if(player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(2) != null && player.getEquipmentInSlot(3) != null && player.getEquipmentInSlot(4) != null) { if(player.getEquipmentInSlot(1).getItem() instanceof ItemMithrilArmor && player.getEquipmentInSlot(2).getItem() instanceof ItemMithrilArmor && player.getEquipmentInSlot(3).getItem() instanceof ItemMithrilArmor && player.getEquipmentInSlot(4).getItem() instanceof ItemMithrilArmor) { if(!world.isDaytime()) { player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 0, 1)); player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 0, 1)); if(!player.isSneaking()) { if(player.stepHeight == 0.5F) { player.stepHeight = 1F; System.out.println(player.stepHeight); } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } @SubscribeEvent(receiveCanceled = true) public void reduceDurability(LivingHurtEvent event) { EntityLivingBase player = event.entityLiving; if(player instanceof EntityPlayer) { for (int i = 1; i < 5; ++i) { if(player.getEquipmentInSlot(i) != null) { Item entArmor = player.getEquipmentInSlot(i).getItem(); ItemStack entArmorStack = player.getEquipmentInSlot(i); if(entArmor instanceof ItemMithrilArmor) { if(player.dimension == 0 && !event.entityLiving.worldObj.isDaytime()) { ArcaneArtificing.snw.sendToAllAround(new MessageMithrilArmorParticles(i - 1, player.getEntityId()), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 40)); ArcaneArtificing.snw.sendTo(new MessageMithrilArmorParticles(i - 1, player.getEntityId()), (EntityPlayerMP)player); } damageArmor(player, entArmorStack, event.source, (int)event.ammount, i); } } } } } } Creation of Armor public static ArmorMaterial mithrilAM = EnumHelper.addArmorMaterial("MithrilAM", 2456, new int[]{4, 8, 6, 4}, -1); public static Item mithrilHelmet; public static Item mithrilChestplate; public static Item mithrilLeggings; public static Item mithrilBoots; mithrilHelmet = new ItemMithrilArmor("mithrilHelmet", mithrilAM, 0, 0); RegisterHelper.registerItem(mithrilHelmet); mithrilChestplate = new ItemMithrilArmor("mithrilChestplate", mithrilAM, 0, 1); RegisterHelper.registerItem(mithrilChestplate); mithrilLeggings = new ItemMithrilArmor("mithrilLeggings", mithrilAM, 0, 2); RegisterHelper.registerItem(mithrilLeggings); mithrilBoots = new ItemMithrilArmor("mithrilBoots", mithrilAM, 0, 3); RegisterHelper.registerItem(mithrilBoots); Message/Handler public class MessageMithrilArmorParticles implements IMessage { public static int armorID; public static int playerID; public MessageMithrilArmorParticles(){} public MessageMithrilArmorParticles(int i, int p) { this.armorID = i; this.playerID = p; } @Override public void fromBytes(ByteBuf buf) { this.armorID = buf.readInt(); this.playerID = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(armorID); buf.writeInt(playerID); } public static class MessageMithrilArmorParticlesHandler implements IMessageHandler<MessageMithrilArmorParticles, IMessage> { @Override public IMessage onMessage(MessageMithrilArmorParticles message, MessageContext ctx) { ArcaneArtificing.proxy.doMithrilArmorParticles(message.armorID, message.playerID); return null; } } } ClientProxy @Override public void doMithrilArmorParticles(int armorID, int playerID) { if(Minecraft.getMinecraft().theWorld.getEntityByID(playerID) != null && Minecraft.getMinecraft().theWorld.getEntityByID(playerID) instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().theWorld.getEntityByID(playerID); switch(armorID) { case 0: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; case 1: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; case 2: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; case 3: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; } } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.