Updated herbalism (crop replaced by ageable) (#3523)

* [WIP] Replacing MaterialData with Blockdata

* Fixed most block based experience gain

* Removed debug prints

* Updated configs

* [WIP] Replacing MaterialData with Blockdata

* Fixed most block based experience gain & updated wooden_tools

* ACTAULLY removed debug prints

* [WIP] Replacing bukkit treespecies 

This feature has been unofficially deprecated, (not yet fixed/marked in bukkit)
Also updated config.yml to match changes

* Updated configs

* [WIP] Replacing MaterialData with Blockdata

* [WIP] Replacing MaterialData with Blockdata

* Fixed most block based experience gain

* Fixed most block based experience gain & updated wooden_tools

* Removed debug prints

* ACTAULLY removed debug prints

* [WIP] Replacing bukkit treespecies 

This feature has been unofficially deprecated, (not yet fixed/marked in bukkit)
Also updated config.yml to match changes

* Fixed greenterra

Replaced deprecated features
This commit is contained in:
Shane Robertson 2018-07-31 20:35:45 -05:00 committed by t00thpick1
parent fecf83c79c
commit 63378ae4c1
2 changed files with 17 additions and 30 deletions

View File

@ -18,12 +18,12 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NetherWartsState; import org.bukkit.NetherWartsState;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.data.Ageable;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.material.CocoaPlant; import org.bukkit.material.CocoaPlant;
import org.bukkit.material.CocoaPlant.CocoaPlantSize; import org.bukkit.material.CocoaPlant.CocoaPlantSize;
import org.bukkit.material.Crops;
import org.bukkit.material.NetherWarts; import org.bukkit.material.NetherWarts;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
@ -324,53 +324,40 @@ public class HerbalismManager extends SkillManager {
case CARROTS: case CARROTS:
case BEETROOTS: case BEETROOTS:
case WHEAT: case WHEAT:
Crops crops = (Crops) blockState.getBlockData(); Ageable crops = (Ageable) blockState.getBlockData();
if (greenTerra) { if (greenTerra) {
crops.setState(CropState.MEDIUM); crops.setAge(3);
} }
else { else {
switch (greenThumbStage) { crops.setAge(greenThumbStage);
case 4:
crops.setState(CropState.SMALL);
break;
case 3:
crops.setState(CropState.VERY_SMALL);
break;
case 2:
crops.setState(CropState.GERMINATED);
break;
default:
crops.setState(CropState.SEEDED);
break;
}
} }
return true; return true;
case NETHER_WART_BLOCK: case NETHER_WART_BLOCK:
NetherWarts warts = (NetherWarts) blockState.getBlockData(); Ageable warts = (Ageable) blockState.getBlockData();
if (greenTerra || greenThumbStage > 2) { if (greenTerra || greenThumbStage > 2) {
warts.setState(NetherWartsState.STAGE_TWO); warts.setAge(2);
} }
else if (greenThumbStage == 2) { else if (greenThumbStage == 2) {
warts.setState(NetherWartsState.STAGE_ONE); warts.setAge(1);
} }
else { else {
warts.setState(NetherWartsState.SEEDED); warts.setAge(0);
} }
return true; return true;
case COCOA: case COCOA:
CocoaPlant plant = (CocoaPlant) blockState.getBlockData(); Ageable plant = (Ageable) blockState.getBlockData();
if (greenTerra || getGreenThumbStage() > 1) { if (greenTerra || getGreenThumbStage() > 1) {
plant.setSize(CocoaPlantSize.MEDIUM); plant.setAge(1);
} }
else { else {
plant.setSize(CocoaPlantSize.SMALL); plant.setAge(0);
} }
return true; return true;

View File

@ -444,12 +444,12 @@ Double_Drops:
Sandstone: true Sandstone: true
Stone: true Stone: true
Woodcutting: Woodcutting:
Acacia: true Acacia_Wood: true
Birch: true Birch_Wood: true
Dark_Oak: true Dark_Oak_Wood: true
Generic: true Oak_Wood: true
Jungle: true Jungle_Wood: true
Redwood: true Spruce_Wood: true
# #
# Settings for commands # Settings for commands