mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed not being able to place blocks on top of certain repair/salvage
anvils
This commit is contained in:
parent
280889e11a
commit
8d7f1cb595
@ -1,3 +1,8 @@
|
||||
Version 2.1.125
|
||||
*Fixed a bug where you could not place blocks on top of certain repair/salvage anvils
|
||||
|
||||
Notes: You won't be able to place blocks on top of stuff that has an interactable component if its setup as an anvil for either Repair or Salvage, for example if you set the vanilla minecraft anvil to Repair, you won't be able to place blocks on top of that. If the repair anvil is still set to iron block then you can now place blocks on it again.
|
||||
|
||||
Version 2.1.124
|
||||
Repair/Salvage can now be set to use vanilla blocks that already do something and that vanilla functionality will be disabled by mcMMO (you could use vanilla-anvils instead of iron_blocks for repair now)
|
||||
Added Gold_Nugget to Mining's Bonus_Drops in config.yml (edit your config)
|
||||
|
@ -597,17 +597,23 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Cancel the event to prevent vanilla functionality
|
||||
if(event.getClickedBlock() != null) {
|
||||
if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if(event.getClickedBlock().getType() == Repair.anvilMaterial || event.getClickedBlock().getType() == Salvage.anvilMaterial) {
|
||||
if(event.useInteractedBlock() == Event.Result.ALLOW) {
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
if(clickedBlock != null) {
|
||||
Material clickedBlockType = clickedBlock.getType();
|
||||
//The blacklist contains interactable blocks so its a convenient filter
|
||||
if(clickedBlockType == Repair.anvilMaterial || clickedBlockType == Salvage.anvilMaterial) {
|
||||
Bukkit.broadcastMessage("Debug");
|
||||
event.setUseItemInHand(Event.Result.ALLOW);
|
||||
|
||||
if(mcMMO.getMaterialMapStore().isToolActivationBlackListed(clickedBlockType)) {
|
||||
Bukkit.broadcastMessage("Derp 2");
|
||||
event.setUseInteractedBlock(Event.Result.DENY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Cancel the event to prevent vanilla functionality
|
||||
//Only cancel if item in hand has durability
|
||||
}
|
||||
|
||||
if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
return;
|
||||
@ -621,12 +627,11 @@ public class PlayerListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
Material type = block.getType();
|
||||
Material type = clickedBlock.getType();
|
||||
|
||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||
/* REPAIR CHECKS */
|
||||
@ -655,7 +660,7 @@ public class PlayerListener implements Listener {
|
||||
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
||||
if (salvageManager.checkConfirmation(true)) {
|
||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||
salvageManager.handleSalvage(block.getLocation(), heldItem);
|
||||
salvageManager.handleSalvage(clickedBlock.getLocation(), heldItem);
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
@ -674,7 +679,7 @@ public class PlayerListener implements Listener {
|
||||
break;
|
||||
|
||||
case LEFT_CLICK_BLOCK:
|
||||
type = block.getType();
|
||||
type = clickedBlock.getType();
|
||||
|
||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||
/* REPAIR CHECKS */
|
||||
|
@ -89,7 +89,9 @@ public final class BlockUtils {
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean canActivateTools(BlockState blockState) {
|
||||
return !mcMMO.getMaterialMapStore().isToolActivationBlackListed(blockState.getType());
|
||||
return !mcMMO.getMaterialMapStore().isToolActivationBlackListed(blockState.getType())
|
||||
&& blockState.getType() != Repair.anvilMaterial
|
||||
&& blockState.getType() != Salvage.anvilMaterial;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -939,14 +939,11 @@ public class MaterialMapStore {
|
||||
abilityBlackList.add("smoker");
|
||||
abilityBlackList.add("stonecutter");
|
||||
abilityBlackList.add("sweet_berry_bush");
|
||||
abilityBlackList.add("iron_block");
|
||||
abilityBlackList.add("gold_block");
|
||||
abilityBlackList.add("bell");
|
||||
abilityBlackList.add("barrel");
|
||||
abilityBlackList.add("blast_furnace");
|
||||
abilityBlackList.add("campfire");
|
||||
abilityBlackList.add("composter");
|
||||
|
||||
}
|
||||
|
||||
private void fillToolBlackList()
|
||||
@ -1072,8 +1069,6 @@ public class MaterialMapStore {
|
||||
toolBlackList.add("oak_log");
|
||||
toolBlackList.add("oak_wood");
|
||||
toolBlackList.add("spruce_log");
|
||||
toolBlackList.add("iron_block");
|
||||
toolBlackList.add("gold_block");
|
||||
toolBlackList.add("bell");
|
||||
toolBlackList.add("barrel");
|
||||
toolBlackList.add("blast_furnace");
|
||||
|
Loading…
Reference in New Issue
Block a user