mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
2.1.18 - It turns out Kelp is actually made up of 2 blocks mixed together
This commit is contained in:
parent
8994594ed4
commit
2f0a58b968
@ -7,6 +7,13 @@ Key:
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 2.1.18
|
||||
You will need to add Kelp to your experience.yml file for this fix to be fully functional
|
||||
Breaking Kelp will now properly count its XP
|
||||
Added "Kelp" to experience.yml (Kelp is actually made up of two blocks mixed together)
|
||||
It is recommended that Kelp and Kelp_Plant have the same XP value in experience.yml
|
||||
mcMMO will now calculate XP for plants that are taller than naturally allowed (Cactus above 3 block height, etc)
|
||||
|
||||
Version 2.1.17
|
||||
Fixed a logic error that resulted in Drowned giving no XP
|
||||
Fixed a bug that resulted in mob spawner entities to not be marked for no xp after being transforming into Drowned
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.17</version>
|
||||
<version>2.1.18</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -91,7 +91,7 @@ public class Herbalism {
|
||||
}
|
||||
} else {
|
||||
// Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally
|
||||
for (int y = 1; y < 3; y++) {
|
||||
for (int y = 1; y < 256; y++) {
|
||||
Block relativeBlock = block.getRelative(BlockFace.UP, y);
|
||||
|
||||
if (relativeBlock.getType() != blockType) {
|
||||
@ -109,6 +109,51 @@ public class Herbalism {
|
||||
return dropAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the drop amounts for kelp plants based on the blocks
|
||||
* relative to them.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} of the bottom block of the plant
|
||||
* @return the number of bonus drops to award from the blocks in this plant
|
||||
*/
|
||||
protected static int calculateKelpPlantDrops(BlockState blockState) {
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
int dropAmount = mcMMO.getPlaceStore().isTrue(block) ? 0 : 1;
|
||||
|
||||
int kelpMaxHeight = 256;
|
||||
|
||||
// Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally
|
||||
for (int y = 1; y < kelpMaxHeight; y++) {
|
||||
Block relativeUpBlock = block.getRelative(BlockFace.UP, y);
|
||||
|
||||
if(!isKelp(relativeUpBlock))
|
||||
break;
|
||||
|
||||
dropAmount = addKelpDrops(dropAmount, relativeUpBlock);
|
||||
}
|
||||
|
||||
return dropAmount;
|
||||
}
|
||||
|
||||
private static int addKelpDrops(int dropAmount, Block relativeBlock) {
|
||||
if (isKelp(relativeBlock) && !mcMMO.getPlaceStore().isTrue(relativeBlock)) {
|
||||
dropAmount++;
|
||||
} else {
|
||||
mcMMO.getPlaceStore().setFalse(relativeBlock);
|
||||
}
|
||||
|
||||
return dropAmount;
|
||||
}
|
||||
|
||||
private static boolean isKelp(Block relativeBlock) {
|
||||
Material kelptype_1 = Material.KELP_PLANT;
|
||||
Material kelptype_2 = Material.KELP;
|
||||
|
||||
return relativeBlock.getType() == kelptype_1 || relativeBlock.getType() == kelptype_2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
|
@ -126,7 +126,8 @@ public class HerbalismManager extends SkillManager {
|
||||
public void herbalismBlockCheck(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
Material material = blockState.getType();
|
||||
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE || material == Material.KELP_PLANT);
|
||||
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT
|
||||
|| material == Material.SUGAR_CANE || material == Material.KELP_PLANT || material == Material.KELP);
|
||||
|
||||
// Prevents placing and immediately breaking blocks for exp
|
||||
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
@ -158,7 +159,13 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
if (!oneBlockPlant) {
|
||||
//Kelp is actually two blocks mixed together
|
||||
if(material == Material.KELP_PLANT || material == Material.KELP) {
|
||||
amount = Herbalism.calculateKelpPlantDrops(blockState);
|
||||
} else {
|
||||
amount = Herbalism.calculateMultiBlockPlantDrops(blockState);
|
||||
}
|
||||
|
||||
xp *= amount;
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,7 @@ Experience:
|
||||
Brown_Mushroom_Block: 70
|
||||
Mushroom_Stem: 80
|
||||
Herbalism:
|
||||
Kelp: 3
|
||||
Kelp_Plant: 3
|
||||
Tube_Coral_Fan: 80
|
||||
Brain_Coral: 90
|
||||
|
Loading…
Reference in New Issue
Block a user