mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 09:06:46 +01:00
Merge pull request #391 from Glitchfinder/master
Fixing Data Value issues caused by the patch to deprecated ItemStack use.
This commit is contained in:
commit
17169903b4
@ -126,8 +126,7 @@ public class TreasuresConfig extends ConfigLoader{
|
|||||||
* Drops From & Max Level
|
* Drops From & Max Level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ItemStack item = new ItemStack(id, amount, (short) 0);
|
ItemStack item = (new MaterialData(id, (byte) data)).toItemStack(amount);
|
||||||
item.setData(new MaterialData(id, (byte) data));
|
|
||||||
|
|
||||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||||
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
||||||
|
@ -79,8 +79,7 @@ public class CustomBlocksConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skillType.equals("Ability_Blocks")) {
|
if (skillType.equals("Ability_Blocks")) {
|
||||||
blockItem = new ItemStack(id, 1, (short) 0);
|
blockItem = (new MaterialData(id, data)).toItemStack(1);
|
||||||
blockItem.setData(new MaterialData(id, data));
|
|
||||||
|
|
||||||
blockList.add(blockItem);
|
blockList.add(blockItem);
|
||||||
continue;
|
continue;
|
||||||
@ -92,17 +91,14 @@ public class CustomBlocksConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dropItem) {
|
if (dropItem) {
|
||||||
itemDrop = new ItemStack(dropID, 1, (short) 0);
|
itemDrop = (new MaterialData(dropID, dropData)).toItemStack(1);
|
||||||
itemDrop.setData(new MaterialData(dropID, dropData));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemDrop = new ItemStack(id, 1, (short) 0);
|
itemDrop = (new MaterialData(id, data)).toItemStack(1);
|
||||||
itemDrop.setData(new MaterialData(id, data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id);
|
block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id);
|
||||||
blockItem = new ItemStack(id, 1, (short) 0);
|
blockItem = (new MaterialData(id, data)).toItemStack(1);
|
||||||
blockItem.setData(new MaterialData(id, data));
|
|
||||||
|
|
||||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||||
customOres.add(blockItem);
|
customOres.add(blockItem);
|
||||||
|
@ -52,8 +52,7 @@ public class Excavation {
|
|||||||
|
|
||||||
int xp;
|
int xp;
|
||||||
|
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||||
xp = ModChecks.getCustomBlock(block).getXpGain();
|
xp = ModChecks.getCustomBlock(block).getXpGain();
|
||||||
|
@ -241,8 +241,7 @@ public class Herbalism {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||||
customPlant = true;
|
customPlant = true;
|
||||||
|
@ -97,8 +97,7 @@ public class Mining {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (ModChecks.isCustomMiningBlock(block)) {
|
if (ModChecks.isCustomMiningBlock(block)) {
|
||||||
ItemStack dropItem = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack dropItem = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
dropItem.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
Misc.dropItem(location, dropItem);
|
Misc.dropItem(location, dropItem);
|
||||||
}
|
}
|
||||||
@ -121,8 +120,7 @@ public class Mining {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case COAL_ORE:
|
case COAL_ORE:
|
||||||
if (configInstance.getCoalDoubleDropsEnabled()) {
|
if (configInstance.getCoalDoubleDropsEnabled()) {
|
||||||
item = new ItemStack(Material.COAL, 1, (short) 0);
|
item = (new MaterialData(Material.COAL, CoalType.COAL.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(Material.COAL, CoalType.COAL.getData()));
|
|
||||||
|
|
||||||
Misc.dropItem(location, item);
|
Misc.dropItem(location, item);
|
||||||
}
|
}
|
||||||
@ -172,8 +170,7 @@ public class Mining {
|
|||||||
|
|
||||||
case LAPIS_ORE:
|
case LAPIS_ORE:
|
||||||
if (configInstance.getLapisDoubleDropsEnabled()) {
|
if (configInstance.getLapisDoubleDropsEnabled()) {
|
||||||
item = new ItemStack(Material.INK_SACK, 1, (short) 0);
|
item = (new MaterialData(Material.INK_SACK, (byte) 0x4)).toItemStack(1);
|
||||||
item.setData(new MaterialData(Material.INK_SACK, (byte) 0x4));
|
|
||||||
|
|
||||||
Misc.dropItems(location, item, 4);
|
Misc.dropItems(location, item, 4);
|
||||||
Misc.randomDropItems(location, item, 50, 4);
|
Misc.randomDropItems(location, item, 50, 4);
|
||||||
|
@ -98,18 +98,14 @@ public class WoodCutting {
|
|||||||
|
|
||||||
//Prepare ItemStacks
|
//Prepare ItemStacks
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0);
|
ItemStack oak = (new MaterialData(Material.LOG, TreeSpecies.GENERIC.getData())).toItemStack(1);
|
||||||
ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0);
|
ItemStack spruce = (new MaterialData(Material.LOG, TreeSpecies.REDWOOD.getData())).toItemStack(1);
|
||||||
ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0);
|
ItemStack birch = (new MaterialData(Material.LOG, TreeSpecies.BIRCH.getData())).toItemStack(1);
|
||||||
ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0);
|
ItemStack jungle = (new MaterialData(Material.LOG, TreeSpecies.JUNGLE.getData())).toItemStack(1);
|
||||||
|
|
||||||
oak.setData(new MaterialData(Material.LOG, TreeSpecies.GENERIC.getData()));
|
|
||||||
spruce.setData(new MaterialData(Material.LOG, TreeSpecies.REDWOOD.getData()));
|
|
||||||
birch.setData(new MaterialData(Material.LOG, TreeSpecies.BIRCH.getData()));
|
|
||||||
jungle.setData(new MaterialData(Material.LOG, TreeSpecies.JUNGLE.getData()));
|
|
||||||
for (Block x : toBeFelled) {
|
for (Block x : toBeFelled) {
|
||||||
if (Misc.blockBreakSimulate(x, player, true)) {
|
if (Misc.blockBreakSimulate(x, player, true)) {
|
||||||
if (Config.getInstance().getBlockModsEnabled()) {
|
if (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLogBlock(x)) {
|
||||||
if (ModChecks.isCustomLogBlock(x)) {
|
if (ModChecks.isCustomLogBlock(x)) {
|
||||||
CustomBlock block = ModChecks.getCustomBlock(x);
|
CustomBlock block = ModChecks.getCustomBlock(x);
|
||||||
item = block.getItemDrop();
|
item = block.getItemDrop();
|
||||||
@ -209,8 +205,8 @@ public class WoodCutting {
|
|||||||
else if (x.getType() == Material.LEAVES) {
|
else if (x.getType() == Material.LEAVES) {
|
||||||
final int SAPLING_DROP_CHANCE = 10;
|
final int SAPLING_DROP_CHANCE = 10;
|
||||||
|
|
||||||
item = new ItemStack(Material.SAPLING, 1, (short) 0);
|
//Drop the right type of sapling
|
||||||
item.setData(new MaterialData(Material.SAPLING, (byte) (x.getData() & 3))); //Drop the right type of sapling
|
item = (new MaterialData(Material.SAPLING, (byte) (x.getData() & 3))).toItemStack(1);
|
||||||
|
|
||||||
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||||
|
|
||||||
@ -380,8 +376,7 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item = new ItemStack(mat, 1, (short) 0);
|
item = (new MaterialData(mat, type)).toItemStack(1);
|
||||||
item.setData(new MaterialData(mat, type));
|
|
||||||
|
|
||||||
location = block.getLocation();
|
location = block.getLocation();
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
|
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
|
||||||
return true;
|
return true;
|
||||||
@ -79,8 +78,7 @@ public class BlockChecks {
|
|||||||
* @return true if the block should allow ability activation, false otherwise
|
* @return true if the block should allow ability activation, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean abilityBlockCheck(Block block) {
|
public static boolean abilityBlockCheck(Block block) {
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(item)) {
|
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(item)) {
|
||||||
return false;
|
return false;
|
||||||
@ -205,8 +203,7 @@ public class BlockChecks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||||
return true;
|
return true;
|
||||||
@ -243,8 +240,7 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
|
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
|
||||||
return true;
|
return true;
|
||||||
@ -273,8 +269,7 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||||
return true;
|
return true;
|
||||||
@ -299,8 +294,7 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -49,8 +49,7 @@ public class ModChecks {
|
|||||||
* @return the block if it exists, null otherwise
|
* @return the block if it exists, null otherwise
|
||||||
*/
|
*/
|
||||||
public static CustomBlock getCustomBlock(Block block) {
|
public static CustomBlock getCustomBlock(Block block) {
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (!blocksInstance.customItems.contains(item)) {
|
if (!blocksInstance.customItems.contains(item)) {
|
||||||
return null;
|
return null;
|
||||||
@ -72,8 +71,7 @@ public class ModChecks {
|
|||||||
* @return true if the block is custom, false otherwise
|
* @return true if the block is custom, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomMiningBlock(Block block) {
|
public static boolean isCustomMiningBlock(Block block) {
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(item)) {
|
if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(item)) {
|
||||||
for (CustomBlock b : blocksInstance.customBlocks) {
|
for (CustomBlock b : blocksInstance.customBlocks) {
|
||||||
@ -93,8 +91,7 @@ public class ModChecks {
|
|||||||
* @return true if the block represents leaves, false otherwise
|
* @return true if the block represents leaves, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomLeafBlock(Block block) {
|
public static boolean isCustomLeafBlock(Block block) {
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (blocksInstance.customLeaves.contains(item)) {
|
if (blocksInstance.customLeaves.contains(item)) {
|
||||||
for (CustomBlock b : blocksInstance.customBlocks) {
|
for (CustomBlock b : blocksInstance.customBlocks) {
|
||||||
@ -114,8 +111,7 @@ public class ModChecks {
|
|||||||
* @return true if the block represents a log, false otherwise
|
* @return true if the block represents a log, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomLogBlock(Block block) {
|
public static boolean isCustomLogBlock(Block block) {
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (blocksInstance.customLogs.contains(item)) {
|
if (blocksInstance.customLogs.contains(item)) {
|
||||||
for (CustomBlock b : blocksInstance.customBlocks) {
|
for (CustomBlock b : blocksInstance.customBlocks) {
|
||||||
@ -135,8 +131,7 @@ public class ModChecks {
|
|||||||
* @return true if the block represents an ore, false otherwise
|
* @return true if the block represents an ore, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomOreBlock(Block block) {
|
public static boolean isCustomOreBlock(Block block) {
|
||||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
|
||||||
|
|
||||||
if (blocksInstance.customOres.contains(item)) {
|
if (blocksInstance.customOres.contains(item)) {
|
||||||
for (CustomBlock b : blocksInstance.customBlocks) {
|
for (CustomBlock b : blocksInstance.customBlocks) {
|
||||||
|
Loading…
Reference in New Issue
Block a user