mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Fix some internal rendering discrepancies with loaded crossbow ammo and prevent possible crashes from corrupt NBT/worlds/whatever
This commit is contained in:
1 parent
478052bbd3
commit
4b240acbf7
2 files changed
+8
-2
No files matched your search
@@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.weaponry.entity.BoltEntity;
|
||||
|
||||
public class BowRenderer extends FlexibleToolRenderer {
|
||||
private static final ArrowEntity dummy = new ArrowEntity(null);
|
||||
@@ -84,7 +85,7 @@ public class BowRenderer extends FlexibleToolRenderer {
|
||||
// we're crazy, so.. render the arrow =D
|
||||
ItemStack ammo = ((ProjectileWeapon) item.getItem()).searchForAmmo(player, item); // we know it's a projectile weapon, it's a bow!
|
||||
if(ammo != null) {
|
||||
if(ammo.getItem() == Items.arrow)
|
||||
if(ammo.getItem() == Items.arrow || !(ammo.getItem() instanceof ArrowAmmo))
|
||||
dummy.returnStack = ArrowAmmo.vanillaArrow;
|
||||
else
|
||||
dummy.returnStack = ammo;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package tconstruct.weaponry.client.item;
|
||||
|
||||
import tconstruct.client.FlexibleToolRenderer;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import tconstruct.weaponry.ammo.BoltAmmo;
|
||||
import tconstruct.weaponry.entity.ArrowEntity;
|
||||
import tconstruct.weaponry.entity.BoltEntity;
|
||||
import tconstruct.weaponry.weapons.Crossbow;
|
||||
@@ -45,7 +47,10 @@ public class CrossbowRenderer extends FlexibleToolRenderer {
|
||||
//float progress = crossbow.getWindupProgress(item, player);
|
||||
float progress = 1f;
|
||||
dummy.returnStack = ammo;
|
||||
Render renderer = RenderManager.instance.getEntityClassRenderObject(ArrowEntity.class);
|
||||
if(!(ammo.getItem() instanceof BoltAmmo))
|
||||
dummy.returnStack = TinkerWeaponry.creativeBolt;
|
||||
|
||||
Render renderer = RenderManager.instance.getEntityClassRenderObject(BoltEntity.class);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
// adjust position
|
||||
|
||||
Reference in new issue
Block a user