mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Some additional checks to prevent crashes for invalid/incomplete arrow entities #1262
This commit is contained in:
1 parent
161c292462
commit
384fe28be9
1 file changed
+6
@@ -39,6 +39,9 @@ public class ArrowEntity extends ProjectileBase {
|
||||
|
||||
@Override
|
||||
protected double getGravity() {
|
||||
if(returnStack == null || !returnStack.hasTagCompound())
|
||||
return super.getGravity();
|
||||
|
||||
float mass = returnStack.getTagCompound().getCompoundTag("InfiTool").getFloat("Mass");
|
||||
mass /= 36f; // why 36? simple because it's roughly 0.05 with flint head and wooden arrow shaft! Yes, that's the only reason.
|
||||
return mass;
|
||||
@@ -51,6 +54,9 @@ public class ArrowEntity extends ProjectileBase {
|
||||
if(defused)
|
||||
return;
|
||||
|
||||
if(returnStack == null || !returnStack.hasTagCompound())
|
||||
return;
|
||||
|
||||
// we might break! oh noez!
|
||||
float chance = returnStack.getTagCompound().getCompoundTag("InfiTool").getFloat("BreakChance");
|
||||
if(chance > TConstruct.random.nextFloat()) {
|
||||
|
||||
Reference in new issue
Block a user