Skip to content

Commit

Permalink
Poisoned Swords!
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Aug 5, 2014
1 parent b4bf814 commit 943a4a1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ public ItemHorn()
@Override
public boolean canApply(ItemStack platable)
{
if (platable.getItem() instanceof IPlatable)
{
IPlatable iplatable = (IPlatable) platable.getItem();
return "sword".equals(iplatable.getType());
}
return false;
return platable.getItem() instanceof MItemSword;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package minestrapteam.minestrappolation.item;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ItemPoisonSack extends Item implements IItemAddon
{
public ItemPoisonSack()
{
addons.add(this);
}

@Override
public boolean canApply(ItemStack platable)
{
return platable.getItem() instanceof MItemSword && MItemTool.getPoisonLevel(platable) < 4F;
}

@Override
public void apply(ItemStack platable)
{
MItemTool.setPoisonLevel(platable, 4F);
}

@Override
public void unapply(ItemStack platable)
{
MItemTool.setPoisonLevel(platable, 0F);
}

@Override
public boolean isApplied(ItemStack platable)
{
return MItemTool.getPoisonLevel(platable) == 4F;
}

@Override
public int getCount(ItemStack platable)
{
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

public class MItemTool extends ItemTool implements IPlatable
{
public static final UUID PLATING_UUID = UUID.fromString("DB3F55D3-645C-4F38-A497-9C13A33DB5CF");
public static final UUID HORN_UUID = UUID.fromString("DB3F55D3-645C-4F38-A497-9C13A33DB5DF");
public static final UUID PLATING_UUID = UUID.fromString("CB3F55D3-745C-4F38-A497-9C13A33DB5CF");
public static final UUID HORN_UUID = UUID.fromString("CB3F55D3-845C-4F38-A497-9C13A33DB5CF");

protected boolean ignites;
protected boolean weapon;
Expand Down Expand Up @@ -185,12 +185,6 @@ public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingB

public static void addInformation(ItemStack stack, List list)
{
IPlating plating = getPlating(stack);
if (plating != null)
{
list.add(I18n.getString("item.plating." + plating.getType() + ".desc"));
}

float poisonLevel = getPoisonLevel(stack);
if (poisonLevel > 0F)
{
Expand All @@ -201,6 +195,12 @@ public static void addInformation(ItemStack stack, List list)
{
list.add(I18n.getString("item.horned_sword.desc"));
}

IPlating plating = getPlating(stack);
if (plating != null)
{
list.add(I18n.getString("item.plating." + plating.getType() + ".desc"));
}
}

@Override
Expand Down Expand Up @@ -282,7 +282,7 @@ public static Multimap getAttributeModifiers(Multimap multimap, ItemStack stack)

if (isHorned(stack))
{
AttributeModifier modifier = new AttributeModifier(PLATING_UUID, "Plating Modifier", 2, 0);
AttributeModifier modifier = new AttributeModifier(HORN_UUID, "Horn Modifier", 2, 0);
multimap.put("generic.attackDamage", modifier);
}
return multimap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static void init()
flesh = new MItemFood(4, 0.35F).setPotionEffect(Potion.hunger.id, 20, 0, 0.05F).setCreativeTab(tabFood).setTextureName(MAssetManager.getFoodTexture("flesh"));
marrow = new MItemFood(5, 0.32F).setCreativeTab(tabBrewing).setTextureName(MAssetManager.getFoodTexture("marrow_bowl"));
legSpider = new MItem().setCreativeTab(tabBrewing).setTextureName(MAssetManager.getMobTexture("spider_leg"));
poisonSack = new MItem().setCreativeTab(tabMaterials).setTextureName(MAssetManager.getMobTexture("poison_sack"));
poisonSack = new ItemPoisonSack().setCreativeTab(tabMaterials).setTextureName(MAssetManager.getMobTexture("poison_sack"));
guano = new ItemGuano().setCreativeTab(tabMaterials).setTextureName(MAssetManager.getTexture("guano"));
carcassSilverfish = new MItem().setCreativeTab(tabBrewing).setTextureName(MAssetManager.getMobTexture("silverfish_carcass"));
hideCreeper = new MItem().setCreativeTab(tabMaterials).setTextureName(MAssetManager.getMobTexture("creeper_hide"));
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/minestrappolation/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,9 @@ item.plating.tin.desc=Tin-Plated
item.plating.bronze.desc=Bronze-Plated
item.plating.steel.desc=Steel-Plated
item.plating.meurodite.desc=Meurodite-Plated
item.plating.horn.desc=Horned

item.horned_sword.desc=Horned
item.poison_sword.desc=§aPoisoned: %.1d

lock.locked=This block has been locked by %1$s. You need the key to open it!
lock.locked.no_owner=This block is locked. You need a key to open it.
Expand Down

0 comments on commit 943a4a1

Please sign in to comment.