1.16 support part 5

This commit is contained in:
nossr50 2020-03-03 17:14:57 -08:00
parent 89a990f0cb
commit 3a81d94b32
8 changed files with 173 additions and 16 deletions

View File

@ -1,23 +1,28 @@
Version 2.1.119 Version 2.1.119
1.16 Support 1.16 Support
Fixed another dupe bug Fixed another dupe bug
Fixed a bug that can cause blast mining to give out more rewards than intended
Blast Mining rewards are now randomized but still influenced by your blast mining rank
mcMMO is now aware of turtle shell and treats it appropriately mcMMO is now aware of turtle shell and treats it appropriately
mcMMO is now aware of chainmail armor and treats it appropriately mcMMO is now aware of chainmail armor and treats it appropriately
Calculations which change depend on the quality of your tool or armor has had netherrack support coded in Calculations which change depend on the quality of your tool or armor has had netherrack support coded in
All excavation drops that can drop from soul_sand now also drop from soul_soil (edited treasures.yml) All excavation drops that can drop from soul_sand now also drop from soul_soil (edited treasures.yml)
Added Netherrack armor/weapons/tools to repair.vanilla.yml
Added Netherrack armor/weapons/tools to salvage.vanilla.yml
Added 'Bamboo_Sapling' to bonus drops for Herbalism in experience.yml Added 'Bamboo_Sapling' to bonus drops for Herbalism in experience.yml
Added 'Ancient_Debris' with a value of 7777 to mining experience tables in experience.yml Added 'Ancient_Debris' with a value of 7777 to Mining experience tables in experience.yml
Added 'Basalt' with a value of 40 to mining experience tables in experience.yml Added 'Basalt' with a value of 40 to Mining experience tables in experience.yml
Added 'Crimson_Fungus' with a value of 50 to herbalism experience tables in experience.yml Added 'Crimson_Fungus' with a value of 50 to Herbalism experience tables in experience.yml
Added 'Warped_Fungus' with a value of 50 to herbalism experience tables in experience.yml Added 'Warped_Fungus' with a value of 50 to Herbalism experience tables in experience.yml
Added 'Warped_Nylium' with a value of 5 to mining experience tables in experience.yml Added 'Warped_Nylium' with a value of 5 to Mining experience tables in experience.yml
Added 'Crimson_Nylium' with a value of 5 to mining experience tables in experience.yml Added 'Crimson_Nylium' with a value of 5 to Mining experience tables in experience.yml
Added 'Crimson_Stem' with a value of 35 to woodcutting experience tables in experience.yml Added 'Crimson_Stem' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Crimson_Roots' with a value of 35 to woodcutting experience tables in experience.yml Added 'Crimson_Roots' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Warped_Stem' with a value of 35 to woodcutting experience tables in experience.yml Added 'Warped_Stem' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Warped_Roots' with a value of 35 to woodcutting experience tables in experience.yml Added 'Warped_Roots' with a value of 35 to Woodcutting experience tables in experience.yml
Added 'Ancient_Debris' with a value of 200 to smelting experience tables in experience.yml Added 'Ancient_Debris' with a value of 200 to Smelting experience tables in experience.yml
Added 'Nether_Sprouts' with a value of 10 to Herbalism experience tables in experience.yml Added 'Nether_Sprouts' with a value of 10 to Herbalism experience tables in experience.yml
Added 'Shroomlight' with a value of 100 to Woodcutting experience tables in experience.yml Added 'Shroomlight' with a value of 100 to Woodcutting experience tables in experience.yml
Added 'Soul_Soil' with a value of 50 to Excavation experience tables in experience.yml Added 'Soul_Soil' with a value of 50 to Excavation experience tables in experience.yml
@ -38,6 +43,10 @@ Version 2.1.119
Added 'Shroomlight' to bonus drops for Woodcutting in config.yml Added 'Shroomlight' to bonus drops for Woodcutting in config.yml
NOTES: You may have to edit your configs for this update to mcMMO, either do it manually or delete the config files to regenerate them. NOTES: You may have to edit your configs for this update to mcMMO, either do it manually or delete the config files to regenerate them.
Here are the default configuration files if you wish to compare them to your own servers settings while updating your configs.
Netherrack is repaired using netherrack scraps for now, wait for 2.2 for a better version of repair.
Netherrack salvages into netherrack scraps for now, wait for 2.2 for a better version of salvage.
Version 2.1.118 Version 2.1.118
Fixed another dupe bug Fixed another dupe bug

View File

@ -75,6 +75,8 @@ public class SalvageConfig extends ConfigLoader {
} }
else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) { else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
salvageMaterialType = MaterialType.DIAMOND; salvageMaterialType = MaterialType.DIAMOND;
} else if (ItemUtils.isNetherriteTool(salvageItem) || ItemUtils.isNetherriteArmor(salvageItem)) {
salvageMaterialType = MaterialType.NETHERRACK;
} }
} }
else { else {

View File

@ -10,6 +10,7 @@ public enum MaterialType {
IRON, IRON,
GOLD, GOLD,
DIAMOND, DIAMOND,
NETHERRACK,
OTHER; OTHER;
public Material getDefaultMaterial() { public Material getDefaultMaterial() {
@ -35,6 +36,12 @@ public enum MaterialType {
case DIAMOND: case DIAMOND:
return Material.DIAMOND; return Material.DIAMOND;
case NETHERRACK:
if(Material.getMaterial("netherrite_scrap") != null)
return Material.getMaterial("netherrite_scrap");
else
return Material.GOLD_INGOT;
case OTHER: case OTHER:
default: default:
return null; return null;

View File

@ -17,6 +17,7 @@ import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -131,6 +132,30 @@ public class MiningManager extends SkillManager {
* @param yield The % of blocks to drop * @param yield The % of blocks to drop
* @param event The {@link EntityExplodeEvent} * @param event The {@link EntityExplodeEvent}
*/ */
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
//TODO: Rewrite this garbage
public void blastMiningDropProcessing(float yield, EntityExplodeEvent event) { public void blastMiningDropProcessing(float yield, EntityExplodeEvent event) {
//Strip out only stuff that gives mining XP //Strip out only stuff that gives mining XP
@ -148,7 +173,7 @@ public class MiningManager extends SkillManager {
int xp = 0; int xp = 0;
float oreBonus = (float) (getOreBonus() / 100); // float oreBonus = (float) (getOreBonus() / 100);
//TODO: Pretty sure something is fucked with debrisReduction stuff //TODO: Pretty sure something is fucked with debrisReduction stuff
// float debrisReduction = (float) (getDebrisReduction() / 100); // float debrisReduction = (float) (getDebrisReduction() / 100);
int dropMultiplier = getDropMultiplier(); int dropMultiplier = getDropMultiplier();
@ -156,13 +181,14 @@ public class MiningManager extends SkillManager {
// float debrisYield = yield - debrisReduction; // float debrisYield = yield - debrisReduction;
for (BlockState blockState : ores) { for (BlockState blockState : ores) {
if (Misc.getRandom().nextFloat() < (notOres.size() + oreBonus)) { if (RandomUtils.nextInt(ores.size()) >= (ores.size() / 2)) {
xp += Mining.getBlockXp(blockState); xp += Mining.getBlockXp(blockState);
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
for (int i = 1; i < dropMultiplier; i++) { for (int i = 1; i < dropMultiplier; i++) {
Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items if(RandomUtils.nextInt(100) >= 75)
Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items
} }
} }
} }
@ -234,7 +260,21 @@ public class MiningManager extends SkillManager {
* @return the Blast Mining tier * @return the Blast Mining tier
*/ */
public int getDropMultiplier() { public int getDropMultiplier() {
return getDropMultiplier(getBlastMiningTier()); switch(getBlastMiningTier()) {
case 8:
case 7:
return 3;
case 6:
case 5:
case 4:
case 3:
return 2;
case 2:
case 1:
return 1;
default:
return 0;
}
} }
/** /**

View File

@ -144,6 +144,29 @@ public final class Misc {
return location.getWorld().dropItem(location, itemStack); return location.getWorld().dropItem(location, itemStack);
} }
/**
* Drop an item at a given location.
*
* @param location The location to drop the item at
* @param itemStack The item to drop
* @return Dropped Item entity or null if invalid or cancelled
*/
public static Item dropItem(Location location, ItemStack itemStack, int count) {
if (itemStack.getType() == Material.AIR) {
return null;
}
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return null;
}
return location.getWorld().dropItem(location, itemStack);
}
/** /**
* Drop items at a given location. * Drop items at a given location.
* *

View File

@ -298,6 +298,11 @@ public class SkillUtils {
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) { public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
int quantity = 0; int quantity = 0;
if(mcMMO.getMaterialMapStore().isNetherriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetherriteArmor(itemMaterial)) {
//One netherrite bar requires 4 netherrite scraps
return 4;
}
for(Iterator<? extends Recipe> recipeIterator = Bukkit.getServer().recipeIterator(); recipeIterator.hasNext();) { for(Iterator<? extends Recipe> recipeIterator = Bukkit.getServer().recipeIterator(); recipeIterator.hasNext();) {
Recipe bukkitRecipe = recipeIterator.next(); Recipe bukkitRecipe = recipeIterator.next();

View File

@ -181,6 +181,39 @@ Repairables:
DIAMOND_BOOTS: DIAMOND_BOOTS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 6 XpMultiplier: 6
#
# Diamond repairables
###
# Tools
NETHERRITE_SWORD:
MinimumLevel: 0
XpMultiplier: .6
NETHERRITE_SHOVEL:
MinimumLevel: 0
XpMultiplier: .4
NETHERRITE_PICKAXE:
MinimumLevel: 0
XpMultiplier: 1.1
NETHERRITE_AXE:
MinimumLevel: 0
XpMultiplier: 1.1
NETHERRITE_HOE:
MinimumLevel: 0
XpMultiplier: .75
# Armor
NETHERRITE_HELMET:
MinimumLevel: 0
XpMultiplier: 7
NETHERRITE_CHESTPLATE:
MinimumLevel: 0
XpMultiplier: 7
NETHERRITE_LEGGINGS:
MinimumLevel: 0
XpMultiplier: 7
NETHERRITE_BOOTS:
MinimumLevel: 0
XpMultiplier: 7
# #
# Leather repairables # Leather repairables
### ###

View File

@ -12,7 +12,7 @@
## This defaults to OTHER. ## This defaults to OTHER.
# #
# MaterialType: This is the type of the material of the item to be salvaged, this is only important for permissions. # MaterialType: This is the type of the material of the item to be salvaged, this is only important for permissions.
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER ## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, NETHERRACK, and OTHER
## This defaults to OTHER. ## This defaults to OTHER.
# #
# SalvageMaterial: This is the material name of the item used to salvage this item. # SalvageMaterial: This is the material name of the item used to salvage this item.
@ -219,6 +219,44 @@ Salvageables:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 6 XpMultiplier: 6
MaximumQuantity: 4 MaximumQuantity: 4
NETHERRITE_SWORD:
MinimumLevel: 50
XpMultiplier: .5
MaximumQuantity: 2
NETHERRITE_SHOVEL:
MinimumLevel: 50
XpMultiplier: .3
MaximumQuantity: 1
NETHERRITE_PICKAXE:
MinimumLevel: 50
XpMultiplier: 1
MaximumQuantity: 3
NETHERRITE_AXE:
MinimumLevel: 50
XpMultiplier: 1
MaximumQuantity: 3
NETHERRITE_HOE:
MinimumLevel: 50
XpMultiplier: .5
MaximumQuantity: 2
# Armor
NETHERRITE_HELMET:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 5
NETHERRITE_CHESTPLATE:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 8
NETHERRITE_LEGGINGS:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 7
NETHERRITE_BOOTS:
MinimumLevel: 50
XpMultiplier: 6
MaximumQuantity: 4
# #
# Leather salvageables # Leather salvageables
### ###