Another dupe fix + 1.16 support part 4

This commit is contained in:
nossr50 2020-03-03 16:37:13 -08:00
parent d585b1c2f7
commit 89a990f0cb
7 changed files with 75 additions and 53 deletions

View File

@ -1,37 +1,43 @@
Version 2.1.119
1.16 Support
Fixed another dupe bug
mcMMO is now aware of turtle shell 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
All excavation drops that can drop from soul_sand now also drop from soul_soil (edited treasures.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 'Netherite_Scrap' to bonus drops for Mining in config.yml
Added 'Ancient_Debris' to bonus drops for Mining in config.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' to bonus drops for Herbalism in config.yml
Added 'Warped_Fungus' with a value of 50 to herbalism experience tables in experience.yml
Added 'Warped_Fungus' to bonus drops for Herbalism in config.yml
Added 'Warped_Nylium' with a value of 5 to mining experience tables in experience.yml
Added 'Warped_Nylium' to bonus drops for Mining in config.yml
Added 'Crimson_Nylium' with a value of 5 to mining experience tables in experience.yml
Added 'Crimson_Nylium' to bonus drops for Mining in config.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 '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 'Ancient_Debris' with a value of 200 to smelting experience tables in experience.yml
Added 'Crimson_Stem' to bonus drops for Woodcutting in config.yml
Added 'Warped_Stem' to bonus drops for Woodcutting in config.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' to bonus drops for Woodcutting in config.yml
Added 'Soul_Soil' with a value of 50 to Excavation experience tables in experience.yml
Added 'Nether_Wart_Block' with a value of 20 to Woodcutting experience tables in experience.yml
Added 'Nether_Wart_Block' with a value of 20 to Herbalism experience tables in experience.yml
Added 'Warped_Wart_Block' with a value of 20 to Woodcutting experience tables in experience.yml
Added 'Warped_Wart_Block' with a value of 20 to Herbalism experience tables in experience.yml
Added 'Weeping_Vines' with a value of 10 to Herbalism experience tables in experience.yml
All excavation drops that can drop from soul_sand now also drop from soul_soil (edited treasures.yml)
Added 'Ancient_Debris' to bonus drops for Mining in config.yml
Added 'Netherite_Scrap' to bonus drops for Mining in config.yml
Added 'Crimson_Fungus' to bonus drops for Herbalism in config.yml
Added 'Warped_Fungus' to bonus drops for Herbalism in config.yml
Added 'Warped_Nylium' to bonus drops for Mining in config.yml
Added 'Crimson_Nylium' to bonus drops for Mining in config.yml
Added 'Crimson_Stem' to bonus drops for Woodcutting in config.yml
Added 'Warped_Stem' 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.
Version 2.1.118
Fixed another dupe bug

View File

@ -153,6 +153,9 @@ public class mcMMO extends JavaPlugin {
modManager = new ModManager();
//Init Material Maps
materialMapStore = new MaterialMapStore();
loadConfigFiles();
if (!noErrorsInConfigFiles) {
@ -250,9 +253,6 @@ public class mcMMO extends JavaPlugin {
getServer().getPluginManager().disablePlugin(this);
}
//Init Material Maps
materialMapStore = new MaterialMapStore();
//Init player level values
playerLevelUtils = new PlayerLevelUtils();

View File

@ -136,11 +136,11 @@ public class MiningManager extends SkillManager {
List<BlockState> ores = new ArrayList<BlockState>();
List<Block> newYieldList = new ArrayList<>();
List<Block> notOres = new ArrayList<>();
for (Block targetBlock : event.blockList()) {
//Containers usually have 0 XP unless someone edited their config in a very strange way
if (ExperienceConfig.getInstance().getXp(PrimarySkillType.MINING, targetBlock) == 0 || targetBlock instanceof Container || mcMMO.getPlaceStore().isTrue(targetBlock)) {
newYieldList.add(targetBlock);
notOres.add(targetBlock);
} else {
ores.add(targetBlock.getState());
}
@ -156,7 +156,7 @@ public class MiningManager extends SkillManager {
// float debrisYield = yield - debrisReduction;
for (BlockState blockState : ores) {
if (Misc.getRandom().nextFloat() < (newYieldList.size() + oreBonus)) {
if (Misc.getRandom().nextFloat() < (notOres.size() + oreBonus)) {
xp += Mining.getBlockXp(blockState);
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
@ -168,8 +168,9 @@ public class MiningManager extends SkillManager {
}
//Replace the event blocklist with the newYield list
event.blockList().clear();
event.blockList().addAll(newYieldList);
event.setYield(0F);
// event.blockList().clear();
// event.blockList().addAll(notOres);
applyXpGain(xp, XPGainReason.PVE);
}

View File

@ -98,6 +98,8 @@ public class SwordsManager extends SkillManager {
public int getToolTier(ItemStack itemStack)
{
if(ItemUtils.isNetherriteTool(itemStack))
return 5;
if(ItemUtils.isDiamondTool(itemStack))
return 4;
else if(ItemUtils.isIronTool(itemStack) || ItemUtils.isGoldTool(itemStack))

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.util;
import org.bukkit.Material;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
@ -53,6 +54,8 @@ public class MaterialMapStore {
private HashSet<String> ores;
private HashMap<String, Integer> tierValue;
public MaterialMapStore()
{
@ -96,7 +99,9 @@ public class MaterialMapStore {
ores = new HashSet<>();
fillHardcodedHashSets();
tierValue = new HashMap<>();
fillVanillaMaterialRegisters();
}
public boolean isMultiBlockPlant(Material material)
@ -139,7 +144,7 @@ public class MaterialMapStore {
return canMakeShroomyWhiteList.contains(material.getKey().getKey());
}
private void fillHardcodedHashSets()
private void fillVanillaMaterialRegisters()
{
fillAbilityBlackList();
fillToolBlackList();
@ -155,6 +160,34 @@ public class MaterialMapStore {
fillTools();
fillEnchantables();
fillOres();
fillTierMap();
}
private void fillTierMap() {
for(String id : leatherArmor) {
tierValue.put(id, 1);
}
for(String id : ironArmor) {
tierValue.put(id, 2);
}
for(String id : goldArmor) {
tierValue.put(id, 3);
}
for(String id : chainmailArmor) {
tierValue.put(id, 3);
}
for(String id : diamondArmor) {
tierValue.put(id, 6);
}
for(String id : netherriteArmor) {
tierValue.put(id, 12);
}
}
private void fillOres() {
@ -1040,6 +1073,14 @@ public class MaterialMapStore {
toolBlackList.add("stonecutter");
}
public int getTier(Material material) {
return getTier(material.getKey().getKey());
}
public int getTier(String id) {
return tierValue.getOrDefault(id, 1); //1 for unknown items
}
private void addToHashSet(String string, HashSet<String> stringHashSet)
{
stringHashSet.add(string.toLowerCase(Locale.ENGLISH));

View File

@ -411,12 +411,9 @@ public final class CombatUtils {
if(metadataValue.size() <= 0)
return;
if(metadataValue != null)
{
OldName oldName = (OldName) metadataValue.get(0);
entity.setCustomName(oldName.asString());
entity.setCustomNameVisible(false);
}
OldName oldName = (OldName) metadataValue.get(0);
entity.setCustomName(oldName.asString());
entity.setCustomNameVisible(false);
}
/**
@ -480,33 +477,7 @@ public final class CombatUtils {
* @return the armor quality of a specific Item Stack
*/
private static int getArmorQuality(ItemStack itemStack) {
int quality = 0;
switch(itemStack.getType()) {
case LEATHER_HELMET:
case LEATHER_BOOTS:
case LEATHER_CHESTPLATE:
case LEATHER_LEGGINGS:
return 1;
case IRON_HELMET:
case IRON_BOOTS:
case IRON_CHESTPLATE:
case IRON_LEGGINGS:
return 2;
case GOLDEN_HELMET:
case GOLDEN_BOOTS:
case GOLDEN_CHESTPLATE:
case GOLDEN_LEGGINGS:
return 3;
case DIAMOND_HELMET:
case DIAMOND_BOOTS:
case DIAMOND_CHESTPLATE:
case DIAMOND_LEGGINGS:
return 6;
default:
return 1;
}
return mcMMO.getMaterialMapStore().getTier(itemStack.getType().getKey().getKey());
}
/**

View File

@ -427,6 +427,7 @@ Skills:
###
Bonus_Drops:
Herbalism:
Bamboo_Sapling: true
Crimson_Fungus: true
Warped_Fungus: true
Chorus_Fruit: true