mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 19:59:55 +00:00
Prevent (x)bow crafting with invalid materials crash #1261
This commit is contained in:
1 parent
7eadf0df54
commit
f3ba95bbea
1 file changed
+14
@@ -163,6 +163,13 @@ public class WeaponryHandler {
|
||||
bottom = TConstructRegistry.getBowMaterial(tags.getInteger("Accessory"));
|
||||
string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Handle"), BowstringMaterial.class);
|
||||
|
||||
// some materials seem to be incompatible
|
||||
if(top == null || bottom == null || string == null)
|
||||
{
|
||||
event.setResult(Event.Result.DENY);
|
||||
return;
|
||||
}
|
||||
|
||||
drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2f * string.drawspeedModifier);
|
||||
flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax)/2 * string.flightSpeedModifier;
|
||||
|
||||
@@ -184,6 +191,13 @@ public class WeaponryHandler {
|
||||
top = TConstructRegistry.getBowMaterial(tags.getInteger("Head"));
|
||||
string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), BowstringMaterial.class);
|
||||
|
||||
// some materials seem to be incompatible
|
||||
if(top == null || string == null)
|
||||
{
|
||||
event.setResult(Event.Result.DENY);
|
||||
return;
|
||||
}
|
||||
|
||||
drawSpeed = (int) ((float)top.drawspeed * string.drawspeedModifier);
|
||||
flightSpeed = (top.flightSpeedMax * string.flightSpeedModifier);
|
||||
|
||||
|
||||
Reference in new issue
Block a user