mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-15 12:04:43 +02:00
Fixed errors with block-based skill experience (#3506)
* Updated configs * [WIP] Replacing MaterialData with Blockdata * Fixed most block based experience gain * Fixed most block based experience gain & updated wooden_tools * Removed debug prints
This commit is contained in:

committed by
t00thpick1

parent
210b418e44
commit
ee324c77a9
@ -7,7 +7,7 @@ import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
@ -15,15 +15,15 @@ import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customOres = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customLogs = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customLeaves = new ArrayList<MaterialData>();
|
||||
public List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
|
||||
public List<BlockData> customExcavationBlocks = new ArrayList<BlockData>();
|
||||
public List<BlockData> customHerbalismBlocks = new ArrayList<BlockData>();
|
||||
public List<BlockData> customMiningBlocks = new ArrayList<BlockData>();
|
||||
public List<BlockData> customOres = new ArrayList<BlockData>();
|
||||
public List<BlockData> customLogs = new ArrayList<BlockData>();
|
||||
public List<BlockData> customLeaves = new ArrayList<BlockData>();
|
||||
public List<BlockData> customAbilityBlocks = new ArrayList<BlockData>();
|
||||
|
||||
public HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
|
||||
public HashMap<BlockData, CustomBlock> customBlockMap = new HashMap<BlockData, CustomBlock>();
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@ -44,7 +44,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBlocks(String skillType, List<MaterialData> blockList) {
|
||||
private void loadBlocks(String skillType, List<BlockData> blockList) {
|
||||
if (needsUpdate) {
|
||||
return;
|
||||
}
|
||||
@ -73,10 +73,10 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
|
||||
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
||||
BlockData blockBlockData = blockMaterial.createBlockData();
|
||||
|
||||
if (blockList != null) {
|
||||
blockList.add(blockMaterialData);
|
||||
blockList.add(blockBlockData);
|
||||
}
|
||||
|
||||
if (skillType.equals("Ability_Blocks")) {
|
||||
@ -87,20 +87,20 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
int smeltingXp = 0;
|
||||
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockMaterialData);
|
||||
customOres.add(blockBlockData);
|
||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockMaterialData);
|
||||
customLogs.add(blockBlockData);
|
||||
}
|
||||
else {
|
||||
customLeaves.add(blockMaterialData);
|
||||
customLeaves.add(blockBlockData);
|
||||
xp = 0; // Leaves don't grant XP
|
||||
}
|
||||
}
|
||||
|
||||
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||
customBlockMap.put(blockBlockData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.config.mods;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
@ -54,7 +54,7 @@ public class CustomEntityConfig extends ConfigLoader {
|
||||
canBeSummoned = false;
|
||||
}
|
||||
|
||||
CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new MaterialData(callOfTheWildMaterial, callOfTheWildData).toItemStack(1) : null), callOfTheWildAmount);
|
||||
CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new ItemStack(callOfTheWildMaterial) : null), callOfTheWildAmount);
|
||||
|
||||
customEntityTypeMap.put(entityTypeName, entity);
|
||||
customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity);
|
||||
|
Reference in New Issue
Block a user