Tweak a few things with Herbalism.

This commit is contained in:
GJ 2013-01-25 19:21:33 -05:00
parent a0a52a3433
commit 3e04bacf73

View File

@ -48,6 +48,11 @@ public class Herbalism {
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax(); public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel(); public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel();
public static boolean greenTerraWalls = Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall();
public static boolean greenTerraSmoothBrick = Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy();
public static boolean greenTerraDirt = Config.getInstance().getHerbalismGreenThumbDirtToGrass();
public static boolean greenTerraCobble = Config.getInstance().getHerbalismGreenThumbCobbleToMossy();
public static void farmersDiet(Player player, int rankChange, FoodLevelChangeEvent event) { public static void farmersDiet(Player player, int rankChange, FoodLevelChangeEvent event) {
if (!Permissions.farmersDiet(player)) { if (!Permissions.farmersDiet(player)) {
return; return;
@ -68,8 +73,10 @@ public class Herbalism {
if (!hasSeeds) { if (!hasSeeds) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.NeedMore")); player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.NeedMore"));
return;
} }
else if (hasSeeds && !block.getType().equals(Material.WHEAT)) {
if (!block.getType().equals(Material.WHEAT)) {
inventory.removeItem(new ItemStack(Material.SEEDS)); inventory.removeItem(new ItemStack(Material.SEEDS));
player.updateInventory(); // Needed until replacement available player.updateInventory(); // Needed until replacement available
greenTerraConvert(player, block); greenTerraConvert(player, block);
@ -77,22 +84,36 @@ public class Herbalism {
} }
public static void greenTerraConvert(Player player, Block block) { public static void greenTerraConvert(Player player, Block block) {
Material type = block.getType();
if (Misc.blockBreakSimulate(block, player, false)) { if (Misc.blockBreakSimulate(block, player, false)) {
if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type == Material.SMOOTH_BRICK && block.getData() == 0) { Material type = block.getType();
block.setTypeIdAndData(block.getTypeId(), (byte) 1, false); //Set type of the brick to mossy, force the client update
} switch (type) {
else if (Config.getInstance().getHerbalismGreenThumbDirtToGrass() && type == Material.DIRT) { case SMOOTH_BRICK:
block.setType(Material.GRASS); if (greenTerraSmoothBrick && block.getData() == 0x0) {
} block.setData((byte) 0x1);
else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type == Material.COBBLESTONE) { }
block.setType(Material.MOSSY_COBBLESTONE); return;
// Don't award double drops to mossified cobblestone
mcMMO.placeStore.setTrue(block); case DIRT:
} if (greenTerraDirt) {
else if (Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall() && type == Material.COBBLE_WALL) { block.setType(Material.GRASS);
block.setData((byte) 1); }
return;
case COBBLESTONE:
if (greenTerraCobble) {
block.setType(Material.MOSSY_COBBLESTONE);
}
return;
case COBBLE_WALL:
if (greenTerraWalls && block.getData() == 0x0) {
block.setData((byte) 0x1);
}
return;
default:
return;
} }
} }
} }