Skip to content

Commit

Permalink
Drilling/Power: Ignore Block Hardness in Creative
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Apr 14, 2024
1 parent ec32509 commit 92805fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.flo56958.minetinker.utils.ConfigurationManager;
import de.flo56958.minetinker.utils.data.DataHandler;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
Expand Down Expand Up @@ -196,7 +197,7 @@ private boolean drillingBlockBreak(final Block block, final float centralBlockHa
if (treatAsWhitelist ^ blacklist.contains(block.getType())) return false;
if (block.getDrops(player.getInventory().getItemInMainHand()).isEmpty()) return false;
//So Obsidian can not be mined using Cobblestone and Drilling
if (block.getType().getHardness() > centralBlockHardness + 2) return false;
if (player.getGameMode() != GameMode.CREATIVE && block.getType().getHardness() > centralBlockHardness + 2) return false;

try {
events.put(block.getLocation(), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import de.flo56958.minetinker.utils.ConfigurationManager;
import de.flo56958.minetinker.utils.PlayerInfo;
import de.flo56958.minetinker.utils.data.DataHandler;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Ageable;
Expand Down Expand Up @@ -361,7 +358,7 @@ private void powerBlockBreak(@Nullable final Block block, final float centralBlo
Bukkit.getScheduler().runTask(this.getSource(), () -> {
if (treatAsWhitelist ^ blacklist.contains(block.getType())) return;
if (block.getDrops(tool).isEmpty()) return;
if (block.getType().getHardness() > centralBlockHardness + 2) // + 2 so you can mine ore as well
if (player.getGameMode() != GameMode.CREATIVE && block.getType().getHardness() > centralBlockHardness + 2) // + 2 so you can mine ore as well
return; //So Obsidian can not be mined using Cobblestone and Power
if (block.getBlockData() instanceof Ageable ageable && ageable.getAge() != ageable.getMaximumAge()) return;
if (!(block.getBlockData() instanceof Ageable) && ToolType.HOE.contains(tool.getType())) return;
Expand Down

0 comments on commit 92805fb

Please sign in to comment.