mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
Prevent ammo creation when missing information through old 3rd party materials is encountered instead of crashing #1236
This commit is contained in:
1 parent
782d1e5df1
commit
139b1fb1b0
1 file changed
+15
@@ -1,5 +1,6 @@
|
||||
package tconstruct.weaponry;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
@@ -74,6 +75,13 @@ public class WeaponryHandler {
|
||||
if(fletching == null)
|
||||
fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class);
|
||||
|
||||
// invalid materials
|
||||
if(arrow == null || shaft == null || fletching == null)
|
||||
{
|
||||
event.setResult(Event.Result.DENY);
|
||||
return;
|
||||
}
|
||||
|
||||
int durability = (int)((float)head.durability() * shaft.durabilityModifier * fletching.durabilityModifier);
|
||||
float weight = arrow.mass + shaft.weight;
|
||||
float accuracy = fletching.accuracy;
|
||||
@@ -106,6 +114,13 @@ public class WeaponryHandler {
|
||||
if(fletching == null)
|
||||
fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class);
|
||||
|
||||
// invalid materials
|
||||
if(head == null || core == null || fletching == null)
|
||||
{
|
||||
event.setResult(Event.Result.DENY);
|
||||
return;
|
||||
}
|
||||
|
||||
int durability = (int)((float)headMat.durability() * coreMat.handleDurability() * fletching.durabilityModifier);
|
||||
float weight = head.mass + core.mass*1.5f;
|
||||
float accuracy = (100f + fletching.accuracy)/2f;
|
||||
|
||||
Reference in new issue
Block a user