mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-27 23:33:06 +00:00
Fix crash when replacing tool parts on stone tools with stone tools disabled. Stone tools are not replaceable then.
Replacing has to be prevented, because otherwise the old tool cannot be reconstructed and not all necessary information can be obtained.
This commit is contained in:
1 parent
7763ea4f26
commit
969d05a7e3
2 files changed
+16
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package iguanaman.iguanatweakstconstruct.replacing;
|
||||
|
||||
import iguanaman.iguanatweakstconstruct.leveling.LevelingLogic;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Config;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -37,6 +38,20 @@ public class ModPartReplacement extends ItemModifier {
|
||||
if(tags.getInteger("Damage") > 0)
|
||||
return false;
|
||||
|
||||
// check if any of the tools parts contain stone. we have to prevent exchanging that with disabled stone tools
|
||||
// because otherwise the replacement-logic would not be able to obtain neccessary information and crash.
|
||||
if(Config.disableStoneTools)
|
||||
{
|
||||
if(tool.getHeadItem() != null && getToolPartMaterial(tags, HEAD) == 1)
|
||||
return false;
|
||||
if(tool.getHandleItem() != null && getToolPartMaterial(tags, HANDLE) == 1)
|
||||
return false;
|
||||
if(tool.getAccessoryItem() != null && getToolPartMaterial(tags, ACCESSORY) == 1)
|
||||
return false;
|
||||
if(tool.getExtraItem() != null && getToolPartMaterial(tags, EXTRA) == 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the recipe of the tool
|
||||
ToolRecipe recipe = findRecipe(tool);
|
||||
if(recipe == null)
|
||||
|
||||
Reference in new issue
Block a user