mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Adding herbalism green thumb ability to carrots, potatoes, and netherwart.
This commit is contained in:
@ -11,33 +11,74 @@ import com.gmail.nossr50.datatypes.SkillType;
|
||||
public class GreenThumbTimer implements Runnable {
|
||||
private Block block;
|
||||
private PlayerProfile profile;
|
||||
private Material type;
|
||||
|
||||
public GreenThumbTimer(Block block, PlayerProfile profile) {
|
||||
public GreenThumbTimer(Block block, PlayerProfile profile, Material material) {
|
||||
this.block = block;
|
||||
this.profile = profile;
|
||||
this.type = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
block.setType(Material.CROPS);
|
||||
if(this.block.getType() != this.type)
|
||||
this.block.setType(this.type);
|
||||
|
||||
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
||||
if (!profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||
if (profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
||||
block.setData(CropState.MEDIUM.getData());
|
||||
}
|
||||
else if (profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
||||
block.setData(CropState.SMALL.getData());
|
||||
}
|
||||
else if (profile.getSkillLevel(SkillType.HERBALISM) >= 200) {
|
||||
block.setData(CropState.VERY_SMALL.getData());
|
||||
switch(this.type) {
|
||||
case CROPS:
|
||||
case CARROT:
|
||||
case POTATO:
|
||||
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
||||
if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||
if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
||||
this.block.setData(CropState.MEDIUM.getData());
|
||||
}
|
||||
else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
||||
this.block.setData(CropState.SMALL.getData());
|
||||
}
|
||||
else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 200) {
|
||||
this.block.setData(CropState.VERY_SMALL.getData());
|
||||
}
|
||||
else {
|
||||
this.block.setData(CropState.GERMINATED.getData());
|
||||
}
|
||||
}
|
||||
else {
|
||||
block.setData(CropState.GERMINATED.getData());
|
||||
this.block.setData(CropState.MEDIUM.getData());
|
||||
}
|
||||
}
|
||||
else {
|
||||
block.setData(CropState.MEDIUM.getData());
|
||||
break;
|
||||
case NETHER_WARTS:
|
||||
if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||
if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
||||
this.block.setData((byte) 2);
|
||||
}
|
||||
else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
||||
this.block.setData((byte) 1);
|
||||
}
|
||||
else {
|
||||
this.block.setData((byte) 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.block.setData((byte) 2);
|
||||
}
|
||||
break;
|
||||
case COCOA:
|
||||
if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||
if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
||||
this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4)));
|
||||
}
|
||||
else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
||||
this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4)));
|
||||
}
|
||||
else {
|
||||
this.block.setData((byte) (this.block.getData() ^ ((byte) 0xc)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user