mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
Replace sortable tool tooltypes with the ones that have been in forge for... a while
This commit is contained in:
1 parent
0a558f72bd
commit
92c6708a68
5 files changed
+4
-28
No files matched your search
@@ -18,11 +18,6 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ISortableTool {
|
||||
|
||||
/**
|
||||
* Gets the type of tool that this is. A pick, axe or shovel.
|
||||
*/
|
||||
public ToolType getSortingType(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the priority that this tool should have when being sorted. The
|
||||
* tool with the highest priority will be picked. The way this is specified
|
||||
@@ -40,8 +35,4 @@ public interface ISortableTool {
|
||||
*/
|
||||
public int getSortingPriority(ItemStack stack);
|
||||
|
||||
public static enum ToolType {
|
||||
PICK, AXE, SHOVEL
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,8 +19,8 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import vazkii.botania.api.item.ISortableTool;
|
||||
import vazkii.botania.api.item.ISortableTool.ToolType;
|
||||
import vazkii.botania.common.item.equipment.tool.ToolCommons;
|
||||
|
||||
public class ItemSwapRing extends ItemBauble {
|
||||
@@ -50,7 +50,7 @@ public class ItemSwapRing extends ItemBauble {
|
||||
|
||||
Material mat = state.getMaterial();
|
||||
if(ToolCommons.materialsPick.contains(mat))
|
||||
typeToFind = ToolType.PICK;
|
||||
typeToFind = ToolType.PICKAXE;
|
||||
else if(ToolCommons.materialsShovel.contains(mat))
|
||||
typeToFind = ToolType.SHOVEL;
|
||||
else if(ToolCommons.materialsAxe.contains(mat))
|
||||
@@ -61,14 +61,14 @@ public class ItemSwapRing extends ItemBauble {
|
||||
return;
|
||||
|
||||
ItemStack bestTool = currentStack;
|
||||
int bestToolPriority = tool.getSortingType(currentStack) == typeToFind ? tool.getSortingPriority(currentStack) : -1;
|
||||
int bestToolPriority = currentStack.getToolTypes().contains(typeToFind) ? tool.getSortingPriority(currentStack) : -1;
|
||||
int bestSlot = -1;
|
||||
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
|
||||
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof ISortableTool && stackInSlot != currentStack) {
|
||||
ISortableTool toolInSlot = (ISortableTool) stackInSlot.getItem();
|
||||
if(toolInSlot.getSortingType(stackInSlot).equals(typeToFind)) {
|
||||
if(stackInSlot.getToolTypes().contains(typeToFind)) {
|
||||
int priority = toolInSlot.getSortingPriority(stackInSlot);
|
||||
if(priority > bestToolPriority) {
|
||||
bestTool = stackInSlot;
|
||||
|
||||
-5
@@ -86,11 +86,6 @@ public class ItemManasteelAxe extends AxeItem implements IManaUsingItem, ISortab
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolType getSortingType(ItemStack stack) {
|
||||
return ToolType.AXE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority(ItemStack stack) {
|
||||
return ToolCommons.getToolPriority(stack);
|
||||
|
||||
-5
@@ -95,11 +95,6 @@ public class ItemManasteelPick extends PickaxeItem implements IManaUsingItem, IS
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolType getSortingType(ItemStack stack) {
|
||||
return ToolType.PICK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority(ItemStack stack) {
|
||||
return ToolCommons.getToolPriority(stack);
|
||||
|
||||
-5
@@ -125,11 +125,6 @@ public class ItemManasteelShovel extends ShovelItem implements IManaUsingItem, I
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolType getSortingType(ItemStack stack) {
|
||||
return ToolType.SHOVEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingPriority(ItemStack stack) {
|
||||
return ToolCommons.getToolPriority(stack);
|
||||
|
||||
Reference in new issue
Block a user