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