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.
This commit is contained in:
yueh 2016-10-24 13:11:01 +02:00
parent 0dcdc2e265
commit 581822b234
3 changed files with 30 additions and 67 deletions

View file

@ -49,17 +49,20 @@ import appeng.util.Platform;
public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
{ {
private static final float SIZE = .5f;
@Reflected @Reflected
public EntityTinyTNTPrimed( final World w ) public EntityTinyTNTPrimed( final World w )
{ {
super( 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 ) public EntityTinyTNTPrimed( final World w, final double x, final double y, final double z, final EntityLivingBase igniter )
{ {
super( w, x, y, z, igniter ); super( w, x, y, z, igniter );
this.setSize( 0.55F, 0.55F ); this.setSize( SIZE, SIZE );
// this.yOffset = this.height / 2.0F; // 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. 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 ); final EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, tntStack );
item.motionX = this.motionX; item.motionX = this.motionX;
@ -162,7 +164,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
if( strength > 0.01 ) if( strength > 0.01 )
{ {
if( block.getMaterial(state) != Material.AIR ) if( block.getMaterial( state ) != Material.AIR )
{ {
if( block.canDropFromExplosion( ex ) ) if( block.canDropFromExplosion( ex ) )
{ {
@ -190,6 +192,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
@Override @Override
public void readSpawnData( final ByteBuf data ) public void readSpawnData( final ByteBuf data )
{ {
this.setFuse( data.readByte() );; this.setFuse( data.readByte() );
;
} }
} }

View file

@ -52,7 +52,7 @@ public class RenderTinyTNTPrimed extends Render
{ {
final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate( (float) x, (float) y + 0.5F, (float) z ); GlStateManager.translate( (float) x, (float) y + 0.25F, (float) z );
float f2; float f2;
if( tnt.getFuse() - life + 1.0F < 10.0F ) if( tnt.getFuse() - life + 1.0F < 10.0F )

View file

@ -1,81 +1,41 @@
{ {
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", "parent": "block/block",
"elements": [ "elements": [
{ {
"from": [ 4, 0, 4 ],
"to": [ 12, 8, 12 ],
"faces": { "faces": {
"down": { "down": {
"texture": "#2", "texture": "#bottom",
"uv": [ "uv": [ 0, 0, 16, 16 ]
0.0,
0.0,
16.0,
16.0
]
}, },
"east": { "east": {
"texture": "#0", "texture": "#side",
"uv": [ "uv": [ 0, 0, 16, 16 ]
0.0,
0.0,
16.0,
16.0
]
}, },
"north": { "north": {
"texture": "#0", "texture": "#side",
"uv": [ "uv": [ 0, 0, 16, 16 ]
0.0,
0.0,
16.0,
16.0
]
}, },
"south": { "south": {
"texture": "#0", "texture": "#side",
"uv": [ "uv": [ 0, 0, 16, 16 ]
0.0,
0.0,
16.0,
16.0
]
}, },
"up": { "up": {
"texture": "#1", "texture": "#top",
"uv": [ "uv": [ 0, 0, 16, 16 ]
0.0,
0.0,
16.0,
16.0
]
}, },
"west": { "west": {
"texture": "#0", "texture": "#side",
"uv": [ "uv": [ 0, 0, 16, 16 ]
0.0,
0.0,
16.0,
16.0
]
} }
}, }
"from": [
4.0,
0.0,
4.0
],
"name": "Cube",
"to": [
12.0,
8.0,
12.0
]
} }
], ],
"parent": "block/block",
"textures": { "textures": {
"particle": "blocks/tnt_bottom", "particle": "blocks/tnt_side",
"0": "blocks/tnt_side", "side": "blocks/tnt_side",
"1": "blocks/tnt_top", "top": "blocks/tnt_top",
"2": "blocks/tnt_bottom" "bottom": "blocks/tnt_bottom"
} }
} }