Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -38,6 +39,7 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
{
|
||||
|
||||
@@ -45,12 +47,12 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
int transformTime = 0;
|
||||
|
||||
@Reflected
|
||||
public EntityChargedQuartz(World w)
|
||||
public EntityChargedQuartz( World w )
|
||||
{
|
||||
super( w );
|
||||
}
|
||||
|
||||
public EntityChargedQuartz(World w, double x, double y, double z, ItemStack is)
|
||||
public EntityChargedQuartz( World w, double x, double y, double z, ItemStack is )
|
||||
{
|
||||
super( w, x, y, z, is );
|
||||
}
|
||||
@@ -60,10 +62,10 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
if( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
return;
|
||||
|
||||
if ( Platform.isClient() && this.delay > 30 && AEConfig.instance.enableEffects )
|
||||
if( Platform.isClient() && this.delay > 30 && AEConfig.instance.enableEffects )
|
||||
{
|
||||
CommonHelper.proxy.spawnEffect( EffectType.Lightning, this.worldObj, this.posX, this.posY, this.posZ, null );
|
||||
this.delay = 0;
|
||||
@@ -75,12 +77,12 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
int k = MathHelper.floor_double( this.posZ );
|
||||
|
||||
Material mat = this.worldObj.getBlock( j, i, k ).getMaterial();
|
||||
if ( Platform.isServer() && mat.isLiquid() )
|
||||
if( Platform.isServer() && mat.isLiquid() )
|
||||
{
|
||||
this.transformTime++;
|
||||
if ( this.transformTime > 60 )
|
||||
if( this.transformTime > 60 )
|
||||
{
|
||||
if ( !this.transform() )
|
||||
if( !this.transform() )
|
||||
this.transformTime = 0;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +95,7 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
ItemStack item = this.getEntityItem();
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
if ( materials.certusQuartzCrystalCharged().isSameAs( item ) )
|
||||
if( materials.certusQuartzCrystalCharged().isSameAs( item ) )
|
||||
{
|
||||
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( this.posX - 1, this.posY - 1, this.posZ - 1, this.posX + 1, this.posY + 1, this.posZ + 1 );
|
||||
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
|
||||
@@ -101,38 +103,38 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
EntityItem redstone = null;
|
||||
EntityItem netherQuartz = null;
|
||||
|
||||
for (Entity e : l)
|
||||
for( Entity e : l )
|
||||
{
|
||||
if ( e instanceof EntityItem && !e.isDead )
|
||||
if( e instanceof EntityItem && !e.isDead )
|
||||
{
|
||||
ItemStack other = ((EntityItem) e).getEntityItem();
|
||||
if ( other != null && other.stackSize > 0 )
|
||||
ItemStack other = ( (EntityItem) e ).getEntityItem();
|
||||
if( other != null && other.stackSize > 0 )
|
||||
{
|
||||
if ( Platform.isSameItem( other, new ItemStack( Items.redstone ) ) )
|
||||
if( Platform.isSameItem( other, new ItemStack( Items.redstone ) ) )
|
||||
redstone = (EntityItem) e;
|
||||
|
||||
if ( Platform.isSameItem( other, new ItemStack( Items.quartz ) ) )
|
||||
if( Platform.isSameItem( other, new ItemStack( Items.quartz ) ) )
|
||||
netherQuartz = (EntityItem) e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( redstone != null && netherQuartz != null )
|
||||
if( redstone != null && netherQuartz != null )
|
||||
{
|
||||
this.getEntityItem().stackSize--;
|
||||
redstone.getEntityItem().stackSize--;
|
||||
netherQuartz.getEntityItem().stackSize--;
|
||||
|
||||
if ( this.getEntityItem().stackSize <= 0 )
|
||||
if( this.getEntityItem().stackSize <= 0 )
|
||||
this.setDead();
|
||||
|
||||
if ( redstone.getEntityItem().stackSize <= 0 )
|
||||
if( redstone.getEntityItem().stackSize <= 0 )
|
||||
redstone.setDead();
|
||||
|
||||
if ( netherQuartz.getEntityItem().stackSize <= 0 )
|
||||
if( netherQuartz.getEntityItem().stackSize <= 0 )
|
||||
netherQuartz.setDead();
|
||||
|
||||
for ( ItemStack fluixCrystalStack : materials.fluixCrystal().maybeStack( 2 ).asSet() )
|
||||
for( ItemStack fluixCrystalStack : materials.fluixCrystal().maybeStack( 2 ).asSet() )
|
||||
{
|
||||
final EntityItem entity = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, fluixCrystalStack );
|
||||
|
||||
|
||||
@@ -18,21 +18,23 @@
|
||||
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
final public class EntityFloatingItem extends EntityItem
|
||||
{
|
||||
|
||||
public static int ageStatic = 0;
|
||||
|
||||
int superDeath = 0;
|
||||
private final Entity parent;
|
||||
int superDeath = 0;
|
||||
float progress = 0;
|
||||
|
||||
public EntityFloatingItem(Entity parent, World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) {
|
||||
public EntityFloatingItem( Entity parent, World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_ )
|
||||
{
|
||||
super( p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_, p_i1710_8_ );
|
||||
this.motionX = this.motionY = this.motionZ = 0.0d;
|
||||
this.hoverStart = 0.5f;
|
||||
@@ -45,21 +47,20 @@ final public class EntityFloatingItem extends EntityItem
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if ( !this.isDead && this.parent.isDead )
|
||||
if( !this.isDead && this.parent.isDead )
|
||||
this.setDead();
|
||||
|
||||
if ( this.superDeath > 100 )
|
||||
if( this.superDeath > 100 )
|
||||
this.setDead();
|
||||
this.superDeath++;
|
||||
|
||||
this.age = ageStatic;
|
||||
}
|
||||
|
||||
public void setProgress(float progress)
|
||||
public void setProgress( float progress )
|
||||
{
|
||||
this.progress = progress;
|
||||
if ( this.progress > 0.99 )
|
||||
if( this.progress > 0.99 )
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -35,16 +36,19 @@ import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntityGrowingCrystal extends EntityItem
|
||||
{
|
||||
|
||||
private int progress_1000 = 0;
|
||||
|
||||
public EntityGrowingCrystal(World w) {
|
||||
public EntityGrowingCrystal( World w )
|
||||
{
|
||||
super( w );
|
||||
}
|
||||
|
||||
public EntityGrowingCrystal(World w, double x, double y, double z, ItemStack is) {
|
||||
public EntityGrowingCrystal( World w, double x, double y, double z, ItemStack is )
|
||||
{
|
||||
super( w, x, y, z, is );
|
||||
}
|
||||
|
||||
@@ -53,16 +57,16 @@ final public class EntityGrowingCrystal extends EntityItem
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
if( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
return;
|
||||
|
||||
if ( this.age > 600 )
|
||||
if( this.age > 600 )
|
||||
this.age = 100;
|
||||
|
||||
ItemStack is = this.getEntityItem();
|
||||
Item gc = is.getItem();
|
||||
|
||||
if ( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue...
|
||||
if( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue...
|
||||
{
|
||||
int j = MathHelper.floor_double( this.posX );
|
||||
int i = MathHelper.floor_double( this.posY );
|
||||
@@ -77,40 +81,39 @@ final public class EntityGrowingCrystal extends EntityItem
|
||||
|
||||
boolean isClient = Platform.isClient();
|
||||
|
||||
if ( mat.isLiquid() )
|
||||
if( mat.isLiquid() )
|
||||
{
|
||||
if ( isClient )
|
||||
if( isClient )
|
||||
this.progress_1000++;
|
||||
else
|
||||
this.progress_1000 += speed;
|
||||
|
||||
}
|
||||
else
|
||||
this.progress_1000 = 0;
|
||||
|
||||
if ( isClient )
|
||||
if( isClient )
|
||||
{
|
||||
int len = 40;
|
||||
|
||||
if ( speed > 2 )
|
||||
if( speed > 2 )
|
||||
len = 20;
|
||||
|
||||
if ( speed > 90 )
|
||||
if( speed > 90 )
|
||||
len = 15;
|
||||
|
||||
if ( speed > 150 )
|
||||
if( speed > 150 )
|
||||
len = 10;
|
||||
|
||||
if ( speed > 240 )
|
||||
if( speed > 240 )
|
||||
len = 7;
|
||||
|
||||
if ( speed > 360 )
|
||||
if( speed > 360 )
|
||||
len = 3;
|
||||
|
||||
if ( speed > 500 )
|
||||
if( speed > 500 )
|
||||
len = 1;
|
||||
|
||||
if ( this.progress_1000 >= len )
|
||||
if( this.progress_1000 >= len )
|
||||
{
|
||||
this.progress_1000 = 0;
|
||||
CommonHelper.proxy.spawnEffect( EffectType.Vibrant, this.worldObj, this.posX, this.posY + 0.2, this.posZ, null );
|
||||
@@ -118,7 +121,7 @@ final public class EntityGrowingCrystal extends EntityItem
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( this.progress_1000 > 1000 )
|
||||
if( this.progress_1000 > 1000 )
|
||||
{
|
||||
this.progress_1000 -= 1000;
|
||||
this.setEntityItemStack( cry.triggerGrowth( is ) );
|
||||
@@ -127,39 +130,38 @@ final public class EntityGrowingCrystal extends EntityItem
|
||||
}
|
||||
}
|
||||
|
||||
private int getSpeed(int x, int y, int z)
|
||||
private int getSpeed( int x, int y, int z )
|
||||
{
|
||||
final int per = 80;
|
||||
final float mul = 0.3f;
|
||||
|
||||
int qty = 0;
|
||||
|
||||
if ( this.isAccelerated( x + 1, y, z ) )
|
||||
if( this.isAccelerated( x + 1, y, z ) )
|
||||
qty += per + qty * mul;
|
||||
|
||||
if ( this.isAccelerated( x, y + 1, z ) )
|
||||
if( this.isAccelerated( x, y + 1, z ) )
|
||||
qty += per + qty * mul;
|
||||
|
||||
if ( this.isAccelerated( x, y, z + 1 ) )
|
||||
if( this.isAccelerated( x, y, z + 1 ) )
|
||||
qty += per + qty * mul;
|
||||
|
||||
if ( this.isAccelerated( x - 1, y, z ) )
|
||||
if( this.isAccelerated( x - 1, y, z ) )
|
||||
qty += per + qty * mul;
|
||||
|
||||
if ( this.isAccelerated( x, y - 1, z ) )
|
||||
if( this.isAccelerated( x, y - 1, z ) )
|
||||
qty += per + qty * mul;
|
||||
|
||||
if ( this.isAccelerated( x, y, z - 1 ) )
|
||||
if( this.isAccelerated( x, y, z - 1 ) )
|
||||
qty += per + qty * mul;
|
||||
|
||||
return qty;
|
||||
}
|
||||
|
||||
private boolean isAccelerated(int x, int y, int z)
|
||||
private boolean isAccelerated( int x, int y, int z )
|
||||
{
|
||||
TileEntity te = this.worldObj.getTileEntity( x, y, z );
|
||||
|
||||
return te instanceof ICrystalGrowthAccelerator && ( ( ICrystalGrowthAccelerator ) te ).isPowered();
|
||||
return te instanceof ICrystalGrowthAccelerator && ( (ICrystalGrowthAccelerator) te ).isPowered();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
@Override
|
||||
public boolean attackEntityFrom( DamageSource src, float dmg )
|
||||
{
|
||||
if ( src.isExplosion() )
|
||||
if( src.isExplosion() )
|
||||
{
|
||||
this.doExplosion();
|
||||
return false;
|
||||
@@ -69,32 +69,32 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
|
||||
public void doExplosion()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return;
|
||||
|
||||
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
if( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
return;
|
||||
|
||||
ItemStack item = this.getEntityItem();
|
||||
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
if ( materials.singularity().isSameAs( item ) )
|
||||
if( materials.singularity().isSameAs( item ) )
|
||||
{
|
||||
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4 );
|
||||
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
|
||||
|
||||
for ( Entity e : l )
|
||||
for( Entity e : l )
|
||||
{
|
||||
if ( e instanceof EntityItem )
|
||||
if( e instanceof EntityItem )
|
||||
{
|
||||
ItemStack other = ( ( EntityItem ) e ).getEntityItem();
|
||||
if ( other != null )
|
||||
ItemStack other = ( (EntityItem) e ).getEntityItem();
|
||||
if( other != null )
|
||||
{
|
||||
boolean matches = false;
|
||||
for ( ItemStack is : OreDictionary.getOres( "dustEnder" ) )
|
||||
for( ItemStack is : OreDictionary.getOres( "dustEnder" ) )
|
||||
{
|
||||
if ( OreDictionary.itemMatches( other, is, false ) )
|
||||
if( OreDictionary.itemMatches( other, is, false ) )
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
@@ -102,11 +102,11 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
}
|
||||
|
||||
// check... other name.
|
||||
if ( !matches )
|
||||
if( !matches )
|
||||
{
|
||||
for ( ItemStack is : OreDictionary.getOres( "dustEnderPearl" ) )
|
||||
for( ItemStack is : OreDictionary.getOres( "dustEnderPearl" ) )
|
||||
{
|
||||
if ( OreDictionary.itemMatches( other, is, false ) )
|
||||
if( OreDictionary.itemMatches( other, is, false ) )
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
@@ -114,15 +114,15 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
}
|
||||
}
|
||||
|
||||
if ( matches )
|
||||
if( matches )
|
||||
{
|
||||
while ( item.stackSize > 0 && other.stackSize > 0 )
|
||||
while( item.stackSize > 0 && other.stackSize > 0 )
|
||||
{
|
||||
other.stackSize--;
|
||||
if ( other.stackSize == 0 )
|
||||
if( other.stackSize == 0 )
|
||||
e.setDead();
|
||||
|
||||
for ( ItemStack singularityStack : materials.qESingularity().maybeStack( 2 ).asSet() )
|
||||
for( ItemStack singularityStack : materials.qESingularity().maybeStack( 2 ).asSet() )
|
||||
{
|
||||
NBTTagCompound cmp = Platform.openNbtData( singularityStack );
|
||||
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
|
||||
@@ -134,7 +134,7 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
}
|
||||
}
|
||||
|
||||
if ( item.stackSize <= 0 )
|
||||
if( item.stackSize <= 0 )
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -42,15 +43,18 @@ import appeng.core.sync.packets.PacketMockExplosion;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
|
||||
{
|
||||
@Reflected
|
||||
public EntityTinyTNTPrimed(World w) {
|
||||
public EntityTinyTNTPrimed( World w )
|
||||
{
|
||||
super( w );
|
||||
this.setSize( 0.35F, 0.35F );
|
||||
}
|
||||
|
||||
public EntityTinyTNTPrimed(World w, double x, double y, double z, EntityLivingBase igniter) {
|
||||
public EntityTinyTNTPrimed( World w, double x, double y, double z, EntityLivingBase igniter )
|
||||
{
|
||||
super( w, x, y, z, igniter );
|
||||
this.setSize( 0.55F, 0.55F );
|
||||
this.yOffset = this.height / 2.0F;
|
||||
@@ -73,16 +77,16 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
|
||||
if ( this.onGround )
|
||||
if( this.onGround )
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
}
|
||||
|
||||
if ( this.isInWater() && Platform.isServer() ) // put out the fuse.
|
||||
if( this.isInWater() && Platform.isServer() ) // put out the fuse.
|
||||
{
|
||||
for ( ItemStack tntStack : AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack tntStack : AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
final EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, tntStack );
|
||||
|
||||
@@ -98,11 +102,11 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.fuse <= 0 )
|
||||
if( this.fuse <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
|
||||
if ( !this.worldObj.isRemote )
|
||||
if( !this.worldObj.isRemote )
|
||||
{
|
||||
this.explode();
|
||||
}
|
||||
@@ -117,49 +121,45 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
// override :P
|
||||
void explode()
|
||||
{
|
||||
this.worldObj.playSoundEffect( this.posX, this.posY, this.posZ, "random.explode", 4.0F,
|
||||
(1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 32.9F );
|
||||
this.worldObj.playSoundEffect( this.posX, this.posY, this.posZ, "random.explode", 4.0F, ( 1.0F + ( this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat() ) * 0.2F ) * 32.9F );
|
||||
|
||||
if ( this.isInWater() )
|
||||
if( this.isInWater() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Object e : this.worldObj.getEntitiesWithinAABBExcludingEntity( this,
|
||||
AxisAlignedBB.getBoundingBox( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 ) ))
|
||||
for( Object e : this.worldObj.getEntitiesWithinAABBExcludingEntity( this, AxisAlignedBB.getBoundingBox( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 ) ) )
|
||||
{
|
||||
if ( e instanceof Entity )
|
||||
if( e instanceof Entity )
|
||||
{
|
||||
((Entity) e).attackEntityFrom( DamageSource.setExplosionSource( null ), 6 );
|
||||
( (Entity) e ).attackEntityFrom( DamageSource.setExplosionSource( null ), 6 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.TinyTNTBlockDamage ) )
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.TinyTNTBlockDamage ) )
|
||||
{
|
||||
this.posY -= 0.25;
|
||||
Explosion ex = new Explosion( this.worldObj, this, this.posX, this.posY, this.posZ, 0.2f );
|
||||
|
||||
for (int x = (int) (this.posX - 2); x <= this.posX + 2; x++)
|
||||
for( int x = (int) ( this.posX - 2 ); x <= this.posX + 2; x++ )
|
||||
{
|
||||
for (int y = (int) (this.posY - 2); y <= this.posY + 2; y++)
|
||||
for( int y = (int) ( this.posY - 2 ); y <= this.posY + 2; y++ )
|
||||
{
|
||||
for (int z = (int) (this.posZ - 2); z <= this.posZ + 2; z++)
|
||||
for( int z = (int) ( this.posZ - 2 ); z <= this.posZ + 2; z++ )
|
||||
{
|
||||
Block block = this.worldObj.getBlock( x, y, z );
|
||||
if ( block != null && !block.isAir( this.worldObj, x, y, z ) )
|
||||
if( block != null && !block.isAir( this.worldObj, x, y, z ) )
|
||||
{
|
||||
float strength = (float) (2.3f - (((x + 0.5f) - this.posX) * ((x + 0.5f) - this.posX) + ((y + 0.5f) - this.posY) * ((y + 0.5f) - this.posY) + ((z + 0.5f) - this.posZ)
|
||||
* ((z + 0.5f) - this.posZ)));
|
||||
float strength = (float) ( 2.3f - ( ( ( x + 0.5f ) - this.posX ) * ( ( x + 0.5f ) - this.posX ) + ( ( y + 0.5f ) - this.posY ) * ( ( y + 0.5f ) - this.posY ) + ( ( z + 0.5f ) - this.posZ ) * ( ( z + 0.5f ) - this.posZ ) ) );
|
||||
|
||||
float resistance = block.getExplosionResistance( this, this.worldObj, x, y, z, this.posX, this.posY, this.posZ );
|
||||
strength -= (resistance + 0.3F) * 0.11f;
|
||||
strength -= ( resistance + 0.3F ) * 0.11f;
|
||||
|
||||
if ( strength > 0.01 )
|
||||
if( strength > 0.01 )
|
||||
{
|
||||
if ( block.getMaterial() != Material.air )
|
||||
if( block.getMaterial() != Material.air )
|
||||
{
|
||||
if ( block.canDropFromExplosion( ex ) )
|
||||
if( block.canDropFromExplosion( ex ) )
|
||||
{
|
||||
block.dropBlockAsItemWithChance( this.worldObj, x, y, z, this.worldObj.getBlockMetadata( x, y, z ), 1.0F / 1.0f, 0 );
|
||||
}
|
||||
@@ -167,7 +167,6 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
block.onBlockExploded( this.worldObj, x, y, z, ex );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,15 +177,14 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data)
|
||||
public void writeSpawnData( ByteBuf data )
|
||||
{
|
||||
data.writeByte( this.fuse );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf data)
|
||||
public void readSpawnData( ByteBuf data )
|
||||
{
|
||||
this.fuse = data.readByte();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
||||
@@ -31,34 +32,30 @@ import net.minecraft.item.ItemBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class RenderFloatingItem extends RenderItem
|
||||
{
|
||||
|
||||
public static DoubleBuffer buffer = ByteBuffer.allocateDirect( 8 * 4 ).asDoubleBuffer();
|
||||
|
||||
public RenderFloatingItem() {
|
||||
public RenderFloatingItem()
|
||||
{
|
||||
this.shadowOpaque = 0.0F;
|
||||
this.renderManager = RenderManager.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBob()
|
||||
public void doRender( EntityItem p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_ )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityItem p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
|
||||
{
|
||||
if ( p_76986_1_ instanceof EntityFloatingItem )
|
||||
if( p_76986_1_ instanceof EntityFloatingItem )
|
||||
{
|
||||
EntityFloatingItem efi = (EntityFloatingItem) p_76986_1_;
|
||||
if ( efi.progress > 0.0 )
|
||||
if( efi.progress > 0.0 )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if ( !(efi.getEntityItem().getItem() instanceof ItemBlock) )
|
||||
if( !( efi.getEntityItem().getItem() instanceof ItemBlock ) )
|
||||
GL11.glTranslatef( 0, -0.15f, 0 );
|
||||
|
||||
super.doRender( efi, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_ );
|
||||
@@ -67,4 +64,9 @@ public class RenderFloatingItem extends RenderItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBob()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -31,33 +32,41 @@ import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class RenderTinyTNTPrimed extends Render
|
||||
{
|
||||
|
||||
private final RenderBlocks blockRenderer = new RenderBlocks();
|
||||
|
||||
public RenderTinyTNTPrimed() {
|
||||
public RenderTinyTNTPrimed()
|
||||
{
|
||||
this.shadowSize = 0.5F;
|
||||
this.renderManager = RenderManager.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender( Entity tnt, double x, double y, double z, float unused, float life )
|
||||
{
|
||||
this.renderPrimedTNT( (EntityTinyTNTPrimed) tnt, x, y, z, life );
|
||||
}
|
||||
|
||||
public void renderPrimedTNT( EntityTinyTNTPrimed tnt, double x, double y, double z, float life )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( (float) x, (float) y - 0.25f, (float) z );
|
||||
float f2;
|
||||
|
||||
if ( tnt.fuse - life + 1.0F < 10.0F )
|
||||
if( tnt.fuse - life + 1.0F < 10.0F )
|
||||
{
|
||||
f2 = 1.0F - (tnt.fuse - life + 1.0F) / 10.0F;
|
||||
f2 = 1.0F - ( tnt.fuse - life + 1.0F ) / 10.0F;
|
||||
|
||||
if ( f2 < 0.0F )
|
||||
if( f2 < 0.0F )
|
||||
{
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
if ( f2 > 1.0F )
|
||||
if( f2 > 1.0F )
|
||||
{
|
||||
f2 = 1.0F;
|
||||
}
|
||||
@@ -69,11 +78,11 @@ public class RenderTinyTNTPrimed extends Render
|
||||
}
|
||||
|
||||
GL11.glScalef( 0.5f, 0.5f, 0.5f );
|
||||
f2 = (1.0F - (tnt.fuse - life + 1.0F) / 100.0F) * 0.8F;
|
||||
f2 = ( 1.0F - ( tnt.fuse - life + 1.0F ) / 100.0F ) * 0.8F;
|
||||
this.bindEntityTexture( tnt );
|
||||
this.blockRenderer.renderBlockAsItem( Blocks.tnt, 0, tnt.getBrightness( life ) );
|
||||
|
||||
if ( tnt.fuse / 5 % 2 == 0 )
|
||||
if( tnt.fuse / 5 % 2 == 0 )
|
||||
{
|
||||
GL11.glDisable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
@@ -91,15 +100,8 @@ public class RenderTinyTNTPrimed extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity tnt, double x, double y, double z, float unused, float life)
|
||||
{
|
||||
this.renderPrimedTNT( (EntityTinyTNTPrimed) tnt, x, y, z, life );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity)
|
||||
protected ResourceLocation getEntityTexture( Entity entity )
|
||||
{
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user