From 581822b234ab38f65bea2626ca300ec57b410c0f Mon Sep 17 00:00:00 2001 From: yueh Date: Mon, 24 Oct 2016 13:11:01 +0200 Subject: [PATCH] Fixes #2499: Tiny TNT model and hitbox not aligned. Fixes entity renderer translating it 1/4 block to high compared to the hitbox. Fixed the hitbox being either a bit too small or too large depending on the used constructor. Updated the model for tiny TNT to be a bit more compact. --- .../appeng/entity/EntityTinyTNTPrimed.java | 15 ++-- .../appeng/entity/RenderTinyTNTPrimed.java | 2 +- .../models/block/tiny_tnt.json | 80 +++++-------------- 3 files changed, 30 insertions(+), 67 deletions(-) diff --git a/src/main/java/appeng/entity/EntityTinyTNTPrimed.java b/src/main/java/appeng/entity/EntityTinyTNTPrimed.java index c8b898fc..029a47b5 100644 --- a/src/main/java/appeng/entity/EntityTinyTNTPrimed.java +++ b/src/main/java/appeng/entity/EntityTinyTNTPrimed.java @@ -49,17 +49,20 @@ import appeng.util.Platform; public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData { + + private static final float SIZE = .5f; + @Reflected public EntityTinyTNTPrimed( final World w ) { super( w ); - this.setSize( 0.35F, 0.35F ); + this.setSize( SIZE, SIZE ); } public EntityTinyTNTPrimed( final World w, final double x, final double y, final double z, final EntityLivingBase igniter ) { super( w, x, y, z, igniter ); - this.setSize( 0.55F, 0.55F ); + this.setSize( SIZE, SIZE ); // this.yOffset = this.height / 2.0F; } @@ -89,8 +92,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit if( this.isInWater() && Platform.isServer() ) // put out the fuse. { - AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack -> - { + AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack -> { final EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, tntStack ); item.motionX = this.motionX; @@ -162,7 +164,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit if( strength > 0.01 ) { - if( block.getMaterial(state) != Material.AIR ) + if( block.getMaterial( state ) != Material.AIR ) { if( block.canDropFromExplosion( ex ) ) { @@ -190,6 +192,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit @Override public void readSpawnData( final ByteBuf data ) { - this.setFuse( data.readByte() );; + this.setFuse( data.readByte() ); + ; } } diff --git a/src/main/java/appeng/entity/RenderTinyTNTPrimed.java b/src/main/java/appeng/entity/RenderTinyTNTPrimed.java index d66f6c4c..33f075e1 100644 --- a/src/main/java/appeng/entity/RenderTinyTNTPrimed.java +++ b/src/main/java/appeng/entity/RenderTinyTNTPrimed.java @@ -52,7 +52,7 @@ public class RenderTinyTNTPrimed extends Render { final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); - GlStateManager.translate( (float) x, (float) y + 0.5F, (float) z ); + GlStateManager.translate( (float) x, (float) y + 0.25F, (float) z ); float f2; if( tnt.getFuse() - life + 1.0F < 10.0F ) diff --git a/src/main/resources/assets/appliedenergistics2/models/block/tiny_tnt.json b/src/main/resources/assets/appliedenergistics2/models/block/tiny_tnt.json index 2432186b..f3ea85d4 100644 --- a/src/main/resources/assets/appliedenergistics2/models/block/tiny_tnt.json +++ b/src/main/resources/assets/appliedenergistics2/models/block/tiny_tnt.json @@ -1,81 +1,41 @@ { - "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/block", "elements": [ { + "from": [ 4, 0, 4 ], + "to": [ 12, 8, 12 ], "faces": { "down": { - "texture": "#2", - "uv": [ - 0.0, - 0.0, - 16.0, - 16.0 - ] + "texture": "#bottom", + "uv": [ 0, 0, 16, 16 ] }, "east": { - "texture": "#0", - "uv": [ - 0.0, - 0.0, - 16.0, - 16.0 - ] + "texture": "#side", + "uv": [ 0, 0, 16, 16 ] }, "north": { - "texture": "#0", - "uv": [ - 0.0, - 0.0, - 16.0, - 16.0 - ] + "texture": "#side", + "uv": [ 0, 0, 16, 16 ] }, "south": { - "texture": "#0", - "uv": [ - 0.0, - 0.0, - 16.0, - 16.0 - ] + "texture": "#side", + "uv": [ 0, 0, 16, 16 ] }, "up": { - "texture": "#1", - "uv": [ - 0.0, - 0.0, - 16.0, - 16.0 - ] + "texture": "#top", + "uv": [ 0, 0, 16, 16 ] }, "west": { - "texture": "#0", - "uv": [ - 0.0, - 0.0, - 16.0, - 16.0 - ] + "texture": "#side", + "uv": [ 0, 0, 16, 16 ] } - }, - "from": [ - 4.0, - 0.0, - 4.0 - ], - "name": "Cube", - "to": [ - 12.0, - 8.0, - 12.0 - ] + } } ], - "parent": "block/block", "textures": { - "particle": "blocks/tnt_bottom", - "0": "blocks/tnt_side", - "1": "blocks/tnt_top", - "2": "blocks/tnt_bottom" + "particle": "blocks/tnt_side", + "side": "blocks/tnt_side", + "top": "blocks/tnt_top", + "bottom": "blocks/tnt_bottom" } }