Use new NetherWartState values.

This commit is contained in:
GJ 2013-04-04 22:24:02 -04:00
parent da29185b7d
commit ce08405c00
2 changed files with 12 additions and 6 deletions

View File

@ -5,12 +5,14 @@ import java.util.List;
import org.bukkit.CropState;
import org.bukkit.Material;
import org.bukkit.NetherWartsState;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.material.CocoaPlant;
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
import org.bukkit.material.NetherWarts;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
@ -307,20 +309,22 @@ public class HerbalismManager extends SkillManager {
return true;
case NETHER_WARTS:
NetherWarts warts = (NetherWarts) blockState.getData();
if (greenTerra) {
blockState.setRawData((byte) 2);
warts.setState(NetherWartsState.STAGE_TWO);
}
else {
int greenThumbStage = getGreenThumbStage();
if (greenThumbStage > 2) {
blockState.setRawData((byte) 2);
warts.setState(NetherWartsState.STAGE_TWO);
}
else if (greenThumbStage == 2) {
blockState.setRawData((byte) 1);
warts.setState(NetherWartsState.STAGE_ONE);
}
else {
blockState.setRawData((byte) 0);
warts.setState(NetherWartsState.SEEDED);
}
}

View File

@ -1,9 +1,11 @@
package com.gmail.nossr50.util;
import org.bukkit.CropState;
import org.bukkit.NetherWartsState;
import org.bukkit.block.BlockState;
import org.bukkit.material.CocoaPlant;
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
import org.bukkit.material.NetherWarts;
import com.gmail.nossr50.config.Config;
@ -62,7 +64,7 @@ public final class BlockUtils {
return blockState.getRawData() == CropState.RIPE.getData();
case NETHER_WARTS:
return blockState.getRawData() == (byte) 0x3;
return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;
case COCOA:
return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;
@ -194,7 +196,7 @@ public final class BlockUtils {
return blockState.getRawData() == CropState.RIPE.getData();
case NETHER_WARTS:
return blockState.getRawData() == (byte) 0x3;
return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;
case COCOA:
return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;