fixed bug on using rangeable tools
This commit is contained in:
parent
4c5dea1756
commit
0c744ef52b
@ -9,7 +9,7 @@ yarn_mappings=1.21.3+build.2
|
||||
loader_version=0.16.9
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.21.3.1
|
||||
mod_version=1.21.3.2
|
||||
maven_group=de.jottyfan.quickiemod
|
||||
archives_base_name=quickiemod
|
||||
|
||||
|
@ -3,6 +3,7 @@ package de.jottyfan.quickiemod.event;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.jottyfan.quickiemod.Quickiemod;
|
||||
import de.jottyfan.quickiemod.item.HarvestRange;
|
||||
import de.jottyfan.quickiemod.item.ModItems;
|
||||
import de.jottyfan.quickiemod.item.ToolRangeable;
|
||||
@ -63,32 +64,38 @@ public class EventBlockBreak {
|
||||
BlockPos pos, PlayerEntity player) {
|
||||
List<Block> validBlocks = tool.getBlockList(currentBlock);
|
||||
HarvestRange range = tool.getRange(itemStack);
|
||||
List<String> visitedBlocks = new ArrayList<>();
|
||||
if (tool instanceof ToolSpeedpowderAxe) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
|
||||
player, true);
|
||||
} else if (ModItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(tool.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(tool.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_SPEEDPOWDERHOE.getName().equals(tool.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERAXE.getName().equals(tool.getName())) {
|
||||
if (tool instanceof Item) {
|
||||
Item toolItem = (Item) tool; // a rangeable tool should always be an item
|
||||
List<String> visitedBlocks = new ArrayList<>();
|
||||
if (tool instanceof ToolSpeedpowderAxe) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
|
||||
player, true);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(tool.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(tool.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERHOE.getName().equals(tool.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_SPEEDPOWDERHOE.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERAXE.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS,
|
||||
player, true);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else if (ModItems.TOOL_QUICKIEPOWDERHOE.getName().equals(toolItem.getName())) {
|
||||
return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL,
|
||||
player, false);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
Quickiemod.LOGGER.warn("using a tool that is not an item - no rangeable operations are possible.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -14,13 +13,6 @@ import net.minecraft.text.Text;
|
||||
*/
|
||||
public interface ToolRangeable {
|
||||
|
||||
/**
|
||||
* dummy to have a getName method that comes with the item
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public Text getName();
|
||||
|
||||
/**
|
||||
* @param stack the item stack that keeps the range
|
||||
* @return range of blocks to be harvested
|
||||
|
Loading…
x
Reference in New Issue
Block a user