mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Merge pull request #139 from nossr50/master
Fixed some problems with Herbalism code, also optimized GT checks.
This commit is contained in:
commit
41ce19b835
@ -163,11 +163,11 @@ public class Herbalism
|
|||||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
|
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
|
||||||
if(player != null)
|
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);
|
||||||
}
|
}
|
||||||
//GREEN THUMB
|
//GREEN THUMB
|
||||||
if((Math.random() * 1500 <= herbLevel) || herbLevel > 1500)
|
if(herbLevel > 1500 || (Math.random() * 1500 <= herbLevel))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
m.mcDropItem(loc, is);
|
m.mcDropItem(loc, is);
|
||||||
@ -176,24 +176,15 @@ public class Herbalism
|
|||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
m.mcDropItem(loc, is);
|
m.mcDropItem(loc, is);
|
||||||
|
|
||||||
block.setData((byte) 0x1); //Change it to first stage
|
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
||||||
|
|
||||||
//Setup the bonuses
|
|
||||||
int bonus = 0;
|
|
||||||
if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
|
|
||||||
bonus++;
|
|
||||||
if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
|
|
||||||
bonus++;
|
|
||||||
if(PP.getSkillLevel(SkillType.HERBALISM) >= 600)
|
if(PP.getSkillLevel(SkillType.HERBALISM) >= 600)
|
||||||
bonus++;
|
block.setData((byte) 0x4);
|
||||||
|
else if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
|
||||||
//Change wheat to be whatever stage based on the bonus
|
|
||||||
if(bonus == 1)
|
|
||||||
block.setData((byte) 0x2);
|
|
||||||
if(bonus == 2)
|
|
||||||
block.setData((byte) 0x3);
|
block.setData((byte) 0x3);
|
||||||
if(bonus == 3)
|
else if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
|
||||||
block.setData((byte) 0x4);
|
block.setData((byte) 0x2);
|
||||||
|
else
|
||||||
|
block.setData((byte) 0x1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +196,7 @@ public class Herbalism
|
|||||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
|
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
|
||||||
if(player != null)
|
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);
|
||||||
m.mcDropItem(loc, is);
|
m.mcDropItem(loc, is);
|
||||||
@ -251,7 +242,7 @@ public class Herbalism
|
|||||||
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
|
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
|
||||||
if(byteArray[x] != (byte) 5)
|
if(byteArray[x] != (byte) 5)
|
||||||
{
|
{
|
||||||
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
|
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||||
{
|
{
|
||||||
m.mcDropItem(target.getLocation(), is);
|
m.mcDropItem(target.getLocation(), is);
|
||||||
}
|
}
|
||||||
@ -290,7 +281,7 @@ public class Herbalism
|
|||||||
//Check for being placed by the player
|
//Check for being placed by the player
|
||||||
if(byteArray[x] != (byte) 5)
|
if(byteArray[x] != (byte) 5)
|
||||||
{
|
{
|
||||||
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
|
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||||
{
|
{
|
||||||
m.mcDropItem(target.getLocation(), is);
|
m.mcDropItem(target.getLocation(), is);
|
||||||
}
|
}
|
||||||
@ -308,7 +299,7 @@ public class Herbalism
|
|||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
if(player != null)
|
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);
|
||||||
}
|
}
|
||||||
@ -322,7 +313,7 @@ public class Herbalism
|
|||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
if(player != null)
|
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);
|
||||||
m.mcDropItem(loc, is);
|
m.mcDropItem(loc, is);
|
||||||
@ -346,7 +337,7 @@ public class Herbalism
|
|||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
if(player != null)
|
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);
|
||||||
}
|
}
|
||||||
@ -358,7 +349,7 @@ public class Herbalism
|
|||||||
mat = Material.getMaterial(block.getTypeId());
|
mat = Material.getMaterial(block.getTypeId());
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
if(player != null){
|
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);
|
||||||
}
|
}
|
||||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
|
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
|
||||||
@ -369,7 +360,7 @@ public class Herbalism
|
|||||||
mat = Material.getMaterial(block.getTypeId());
|
mat = Material.getMaterial(block.getTypeId());
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
if(player != null){
|
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);
|
||||||
}
|
}
|
||||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
|
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
|
||||||
@ -379,7 +370,7 @@ public class Herbalism
|
|||||||
mat = Material.getMaterial(block.getTypeId());
|
mat = Material.getMaterial(block.getTypeId());
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
if(player != null){
|
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);
|
||||||
}
|
}
|
||||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
|
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
|
||||||
|
Loading…
Reference in New Issue
Block a user