Skip to content

Commit

Permalink
Merge pull request #139 from nossr50/master
Browse files Browse the repository at this point in the history
Fixed some problems with Herbalism code, also optimized GT checks.
  • Loading branch information
NuclearW committed Feb 9, 2012
2 parents e36cd81 + 9c11a6f commit 41ce19b
Showing 1 changed file with 18 additions and 27 deletions.
45 changes: 18 additions & 27 deletions src/main/java/com/gmail/nossr50/skills/Herbalism.java
Expand Up @@ -163,11 +163,11 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
//GREEN THUMB
if((Math.random() * 1500 <= herbLevel) || herbLevel > 1500)
if(herbLevel > 1500 || (Math.random() * 1500 <= herbLevel))
{
event.setCancelled(true);
m.mcDropItem(loc, is);
Expand All @@ -176,24 +176,15 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
is = new ItemStack(mat, 1, (byte)0, (byte)0);
m.mcDropItem(loc, is);

block.setData((byte) 0x1); //Change it to first stage

//Setup the bonuses
int bonus = 0;
if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
bonus++;
if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
bonus++;
//This replants the wheat at a certain stage in development based on Herbalism Skill
if(PP.getSkillLevel(SkillType.HERBALISM) >= 600)
bonus++;

//Change wheat to be whatever stage based on the bonus
if(bonus == 1)
block.setData((byte) 0x2);
if(bonus == 2)
block.setData((byte) 0x4);
else if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
block.setData((byte) 0x3);
if(bonus == 3)
block.setData((byte) 0x4);
else if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
block.setData((byte) 0x2);
else
block.setData((byte) 0x1);
}
}

Expand All @@ -205,7 +196,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
m.mcDropItem(loc, is);
Expand Down Expand Up @@ -251,7 +242,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
if(byteArray[x] != (byte) 5)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(target.getLocation(), is);
}
Expand Down Expand Up @@ -290,7 +281,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
//Check for being placed by the player
if(byteArray[x] != (byte) 5)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(target.getLocation(), is);
}
Expand All @@ -308,7 +299,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
}
Expand All @@ -322,7 +313,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
m.mcDropItem(loc, is);
Expand All @@ -346,7 +337,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
}
Expand All @@ -358,7 +349,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
Expand All @@ -369,7 +360,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
Expand All @@ -379,7 +370,7 @@ public static void herbalismProcCheck(Block block, Player player, BlockBreakEven
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
Expand Down

0 comments on commit 41ce19b

Please sign in to comment.