1.15 port
This commit is contained in:
@@ -22,18 +22,14 @@ package appeng.entity;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public abstract class AEBaseEntityItem extends EntityItem
|
||||
public abstract class AEBaseEntityItem extends ItemEntity
|
||||
{
|
||||
public AEBaseEntityItem( final World world )
|
||||
{
|
||||
super( world );
|
||||
}
|
||||
|
||||
public AEBaseEntityItem( final World world, final double x, final double y, final double z, final ItemStack stack )
|
||||
{
|
||||
|
||||
@@ -21,12 +21,12 @@ package appeng.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -38,7 +38,6 @@ import appeng.client.EffectType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -48,40 +47,34 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
private int delay = 0;
|
||||
private int transformTime = 0;
|
||||
|
||||
@Reflected
|
||||
public EntityChargedQuartz( final World w )
|
||||
{
|
||||
super( w );
|
||||
}
|
||||
|
||||
public EntityChargedQuartz( final World w, final double x, final double y, final double z, final ItemStack is )
|
||||
{
|
||||
super( w, x, y, z, is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
public void tick()
|
||||
{
|
||||
super.onUpdate();
|
||||
super.tick();
|
||||
|
||||
if( this.isDead || !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) )
|
||||
if( this.removed || !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( Platform.isClient() && this.delay > 30 && AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
AppEng.proxy.spawnEffect( EffectType.Lightning, this.world, this.posX, this.posY, this.posZ, null );
|
||||
AppEng.proxy.spawnEffect( EffectType.Lightning, this.world, this.getPosX(), this.getPosY(), this.getPosZ(), null );
|
||||
this.delay = 0;
|
||||
}
|
||||
|
||||
this.delay++;
|
||||
|
||||
final int j = MathHelper.floor( this.posX );
|
||||
final int i = MathHelper.floor( ( this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY ) / 2.0D );
|
||||
final int k = MathHelper.floor( this.posZ );
|
||||
final int j = MathHelper.floor( this.getPosX() );
|
||||
final int i = MathHelper.floor( ( this.getBoundingBox().minY + this.getBoundingBox().maxY ) / 2.0D );
|
||||
final int k = MathHelper.floor( this.getPosZ() );
|
||||
|
||||
IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) );
|
||||
BlockState state = this.world.getBlockState( new BlockPos( j, i, k ) );
|
||||
final Material mat = state.getMaterial();
|
||||
|
||||
if( Platform.isServer() && mat.isLiquid() )
|
||||
@@ -108,27 +101,28 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
|
||||
if( materials.certusQuartzCrystalCharged().isSameAs( item ) )
|
||||
{
|
||||
final AxisAlignedBB region = new AxisAlignedBB( this.posX - 1, this.posY - 1, this.posZ - 1, this.posX + 1, this.posY + 1, this.posZ + 1 );
|
||||
final AxisAlignedBB region = new AxisAlignedBB( this.getPosX() - 1, this.getPosY() - 1, this
|
||||
.getPosZ() - 1, this.getPosX() + 1, this.getPosY() + 1, this.getPosZ() + 1 );
|
||||
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
|
||||
|
||||
EntityItem redstone = null;
|
||||
EntityItem netherQuartz = null;
|
||||
ItemEntity redstone = null;
|
||||
ItemEntity netherQuartz = null;
|
||||
|
||||
for( final Entity e : l )
|
||||
{
|
||||
if( e instanceof EntityItem && !e.isDead )
|
||||
if( e instanceof ItemEntity && !e.removed )
|
||||
{
|
||||
final ItemStack other = ( (EntityItem) e ).getItem();
|
||||
final ItemStack other = ( (ItemEntity) e ).getItem();
|
||||
if( !other.isEmpty() )
|
||||
{
|
||||
if( ItemStack.areItemsEqual( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
{
|
||||
redstone = (EntityItem) e;
|
||||
redstone = (ItemEntity) e;
|
||||
}
|
||||
|
||||
if( ItemStack.areItemsEqual( other, new ItemStack( Items.QUARTZ ) ) )
|
||||
{
|
||||
netherQuartz = (EntityItem) e;
|
||||
netherQuartz = (ItemEntity) e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,24 +136,24 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
|
||||
if( this.getItem().getCount() <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
this.remove();
|
||||
}
|
||||
|
||||
if( redstone.getItem().getCount() <= 0 )
|
||||
{
|
||||
redstone.setDead();
|
||||
redstone.remove();
|
||||
}
|
||||
|
||||
if( netherQuartz.getItem().getCount() <= 0 )
|
||||
{
|
||||
netherQuartz.setDead();
|
||||
netherQuartz.remove();
|
||||
}
|
||||
|
||||
materials.fluixCrystal().maybeStack( 2 ).ifPresent( is ->
|
||||
{
|
||||
final EntityItem entity = new EntityItem( this.world, this.posX, this.posY, this.posZ, is );
|
||||
final ItemEntity entity = new ItemEntity( this.world, this.getPosX(), this.getPosY(), this.getPosZ(), is );
|
||||
|
||||
this.world.spawnEntity( entity );
|
||||
this.world.addEntity( entity );
|
||||
} );
|
||||
|
||||
return true;
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public final class EntityFloatingItem extends EntityItem
|
||||
public final class EntityFloatingItem extends ItemEntity
|
||||
{
|
||||
|
||||
private final ICanDie parent;
|
||||
@@ -34,8 +34,7 @@ public final class EntityFloatingItem extends EntityItem
|
||||
public EntityFloatingItem( final ICanDie parent, final World world, final double x, final double y, final double z, final ItemStack stack )
|
||||
{
|
||||
super( world, x, y, z, stack );
|
||||
this.motionX = this.motionY = this.motionZ = 0.0d;
|
||||
this.hoverStart = 0.5f;
|
||||
this.setMotion( 0, 0, 0 );
|
||||
this.rotationYaw = 0;
|
||||
this.parent = parent;
|
||||
}
|
||||
@@ -43,16 +42,16 @@ public final class EntityFloatingItem extends EntityItem
|
||||
// public boolean isEntityAlive()
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
public void tick()
|
||||
{
|
||||
if( !this.isDead && this.parent.isDead() )
|
||||
if( !this.removed && this.parent.isDead() )
|
||||
{
|
||||
this.setDead();
|
||||
this.remove();
|
||||
}
|
||||
|
||||
if( this.superDeath > 100 )
|
||||
{
|
||||
this.setDead();
|
||||
this.remove();
|
||||
}
|
||||
this.superDeath++;
|
||||
|
||||
@@ -64,7 +63,7 @@ public final class EntityFloatingItem extends EntityItem
|
||||
this.progress = progress;
|
||||
if( this.progress > 0.99 )
|
||||
{
|
||||
this.setDead();
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -38,16 +38,11 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class EntityGrowingCrystal extends EntityItem
|
||||
public final class EntityGrowingCrystal extends ItemEntity
|
||||
{
|
||||
|
||||
private int progress_1000 = 0;
|
||||
|
||||
public EntityGrowingCrystal( final World w )
|
||||
{
|
||||
super( w );
|
||||
}
|
||||
|
||||
public EntityGrowingCrystal( final World w, final double x, final double y, final double z, final ItemStack is )
|
||||
{
|
||||
super( w, x, y, z, is );
|
||||
@@ -55,9 +50,9 @@ public final class EntityGrowingCrystal extends EntityItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
public void tick()
|
||||
{
|
||||
super.onUpdate();
|
||||
super.tick();
|
||||
|
||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_PURIFICATION ) )
|
||||
{
|
||||
@@ -69,11 +64,11 @@ public final class EntityGrowingCrystal extends EntityItem
|
||||
|
||||
if( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue...
|
||||
{
|
||||
final int j = MathHelper.floor( this.posX );
|
||||
final int i = MathHelper.floor( ( this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY ) / 2.0D );
|
||||
final int k = MathHelper.floor( this.posZ );
|
||||
final int j = MathHelper.floor( this.getPosX() );
|
||||
final int i = MathHelper.floor( ( this.getBoundingBox().minY + this.getBoundingBox().maxY ) / 2.0D );
|
||||
final int k = MathHelper.floor( this.getPosZ() );
|
||||
|
||||
final IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) );
|
||||
final BlockState state = this.world.getBlockState( new BlockPos( j, i, k ) );
|
||||
final Material mat = state.getMaterial();
|
||||
final IGrowableCrystal cry = (IGrowableCrystal) is.getItem();
|
||||
|
||||
@@ -135,7 +130,7 @@ public final class EntityGrowingCrystal extends EntityItem
|
||||
if( this.progress_1000 >= len )
|
||||
{
|
||||
this.progress_1000 = 0;
|
||||
AppEng.proxy.spawnEffect( EffectType.Vibrant, this.world, this.posX, this.posY + 0.2, this.posZ, null );
|
||||
AppEng.proxy.spawnEffect( EffectType.Vibrant, this.world, this.getPosX(), this.getPosY() + 0.2, this.getPosZ(), null );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -23,13 +23,12 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
@@ -85,38 +84,18 @@ public final class EntitySingularity extends AEBaseEntityItem
|
||||
|
||||
if( materials.singularity().isSameAs( item ) )
|
||||
{
|
||||
final AxisAlignedBB region = new AxisAlignedBB( this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4 );
|
||||
final AxisAlignedBB region = new AxisAlignedBB( this.getPosX() - 4, this.getPosY() - 4, this.getPosZ() - 4, this.getPosX() + 4, this
|
||||
.getPosY() + 4, this.getPosZ() + 4 );
|
||||
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
|
||||
|
||||
for( final Entity e : l )
|
||||
{
|
||||
if( e instanceof EntityItem )
|
||||
if( e instanceof ItemEntity )
|
||||
{
|
||||
final ItemStack other = ( (EntityItem) e ).getItem();
|
||||
final ItemStack other = ( (ItemEntity) e ).getItem();
|
||||
if( !other.isEmpty() )
|
||||
{
|
||||
boolean matches = false;
|
||||
for( final ItemStack is : OreDictionary.getOres( "dustEnder" ) )
|
||||
{
|
||||
if( OreDictionary.itemMatches( other, is, false ) )
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check... other name.
|
||||
if( !matches )
|
||||
{
|
||||
for( final ItemStack is : OreDictionary.getOres( "dustEnderPearl" ) )
|
||||
{
|
||||
if( OreDictionary.itemMatches( other, is, false ) )
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( matches )
|
||||
{
|
||||
@@ -126,24 +105,25 @@ public final class EntitySingularity extends AEBaseEntityItem
|
||||
;
|
||||
if( other.getCount() == 0 )
|
||||
{
|
||||
e.setDead();
|
||||
e.remove();
|
||||
}
|
||||
|
||||
materials.qESingularity().maybeStack( 2 ).ifPresent( singularityStack ->
|
||||
{
|
||||
final NBTTagCompound cmp = Platform.openNbtData( singularityStack );
|
||||
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
|
||||
final CompoundNBT cmp = Platform.openNbtData( singularityStack );
|
||||
cmp.putLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
|
||||
randTickSeed++;
|
||||
item.grow( -1 );
|
||||
|
||||
final EntitySingularity entity = new EntitySingularity( this.world, this.posX, this.posY, this.posZ, singularityStack );
|
||||
this.world.spawnEntity( entity );
|
||||
final EntitySingularity entity = new EntitySingularity( this.world, this.getPosX(), this.getPosY(), this
|
||||
.getPosZ(), singularityStack );
|
||||
this.world.addEntity( entity );
|
||||
} );
|
||||
}
|
||||
|
||||
if( item.getCount() <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,23 +21,24 @@ package appeng.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.TNTEntity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.Explosion.Mode;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
@@ -50,70 +51,60 @@ import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
|
||||
public final class EntityTinyTNTPrimed extends TNTEntity implements IEntityAdditionalSpawnData
|
||||
{
|
||||
|
||||
private static final float SIZE = .5f;
|
||||
|
||||
@Reflected
|
||||
public EntityTinyTNTPrimed( final World w )
|
||||
public EntityTinyTNTPrimed( EntityType<? extends TNTEntity> type, World worldIn )
|
||||
{
|
||||
super( w );
|
||||
this.setSize( SIZE, SIZE );
|
||||
super( type, worldIn );
|
||||
this.preventEntitySpawning = true;
|
||||
}
|
||||
|
||||
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 LivingEntity igniter )
|
||||
{
|
||||
super( w, x, y, z, igniter );
|
||||
this.setSize( SIZE, SIZE );
|
||||
// this.yOffset = this.height / 2.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate()
|
||||
public void tick()
|
||||
{
|
||||
this.handleWaterMovement();
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.motionY -= 0.03999999910593033D;
|
||||
this.move( MoverType.SELF, this.motionX, this.motionY, this.motionZ );
|
||||
this.motionX *= 0.9800000190734863D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ *= 0.9800000190734863D;
|
||||
this.prevPosX = this.getPosX();
|
||||
this.prevPosY = this.getPosY();
|
||||
this.prevPosZ = this.getPosZ();
|
||||
this.setMotion( this.getMotion().subtract( 0, 0.03999999910593033D, 0 ) );
|
||||
this.move( MoverType.SELF, this.getMotion() );
|
||||
this.setMotion( this.getMotion().mul( 0.9800000190734863D, 0.9800000190734863D, 0.9800000190734863D ) );
|
||||
|
||||
if( this.onGround )
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
this.setMotion( this.getMotion().mul( 0.699999988079071D, 0.699999988079071D, -0.5D ) );
|
||||
}
|
||||
|
||||
if( this.isInWater() && Platform.isServer() ) // put out the fuse.
|
||||
{
|
||||
AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack ->
|
||||
{
|
||||
final EntityItem item = new EntityItem( this.world, this.posX, this.posY, this.posZ, tntStack );
|
||||
final ItemEntity item = new ItemEntity( this.world, this.getPosX(), this.getPosY(), this.getPosZ(), tntStack );
|
||||
|
||||
item.motionX = this.motionX;
|
||||
item.motionY = this.motionY;
|
||||
item.motionZ = this.motionZ;
|
||||
item.setMotion( this.getMotion() );
|
||||
item.prevPosX = this.prevPosX;
|
||||
item.prevPosY = this.prevPosY;
|
||||
item.prevPosZ = this.prevPosZ;
|
||||
|
||||
this.world.spawnEntity( item );
|
||||
this.setDead();
|
||||
this.world.addEntity( item );
|
||||
this.remove();
|
||||
} );
|
||||
}
|
||||
|
||||
if( this.getFuse() <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
this.remove();
|
||||
|
||||
if( !this.world.isRemote )
|
||||
{
|
||||
@@ -122,15 +113,16 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
}
|
||||
else
|
||||
{
|
||||
this.world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );
|
||||
this.world.addParticle( ParticleTypes.SMOKE, this.getPosX(), this.getPosY(), this.getPosZ(), 0.0D, 0.0D, 0.0D );
|
||||
}
|
||||
this.setFuse( this.getFuse() - 1 );
|
||||
}
|
||||
|
||||
// override :P
|
||||
void explode()
|
||||
@Override
|
||||
protected void explode()
|
||||
{
|
||||
this.world.playSound( null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F,
|
||||
this.world.playSound( null, this.getPosX(), this.getPosY(), this.getPosZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F,
|
||||
( 1.0F + ( this.world.rand.nextFloat() - this.world.rand.nextFloat() ) * 0.2F ) * 32.9F );
|
||||
|
||||
if( this.isInWater() )
|
||||
@@ -138,8 +130,9 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
return;
|
||||
}
|
||||
|
||||
final Explosion ex = new Explosion( this.world, this, this.posX, this.posY, this.posZ, 0.2f, false, false );
|
||||
final AxisAlignedBB area = new AxisAlignedBB( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 );
|
||||
final Explosion ex = new Explosion( this.world, this, this.getPosX(), this.getPosY(), this.getPosZ(), 0.2f, false, Mode.BREAK );
|
||||
final AxisAlignedBB area = new AxisAlignedBB( this.getPosX() - 1.5, this.getPosY() - 1.5f, this
|
||||
.getPosZ() - 1.5, this.getPosX() + 1.5, this.getPosY() + 1.5, this.getPosZ() + 1.5 );
|
||||
final List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity( this, area );
|
||||
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate( this.world, ex, list, 0.2f * 2d );
|
||||
@@ -151,23 +144,25 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.TINY_TNT_BLOCK_DAMAGE ) )
|
||||
{
|
||||
this.posY -= 0.25;
|
||||
this.setPosition( this.getPosX(), this.getPosY() - 0.25, this.getPosZ() );
|
||||
|
||||
for( int x = (int) ( this.posX - 2 ); x <= this.posX + 2; x++ )
|
||||
for( int x = (int) ( this.getPosX() - 2 ); x <= this.getPosX() + 2; x++ )
|
||||
{
|
||||
for( int y = (int) ( this.posY - 2 ); y <= this.posY + 2; y++ )
|
||||
for( int y = (int) ( this.getPosY() - 2 ); y <= this.getPosY() + 2; y++ )
|
||||
{
|
||||
for( int z = (int) ( this.posZ - 2 ); z <= this.posZ + 2; z++ )
|
||||
for( int z = (int) ( this.getPosZ() - 2 ); z <= this.getPosZ() + 2; z++ )
|
||||
{
|
||||
final BlockPos point = new BlockPos( x, y, z );
|
||||
final IBlockState state = this.world.getBlockState( point );
|
||||
final BlockState state = this.world.getBlockState( point );
|
||||
final Block block = state.getBlock();
|
||||
|
||||
if( block != null && !block.isAir( state, this.world, point ) )
|
||||
{
|
||||
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.getPosX() ) * ( ( x + 0.5f ) - this
|
||||
.getPosX() ) + ( ( y + 0.5f ) - this.getPosY() ) * ( ( y + 0.5f ) - this.getPosY() ) + ( ( z + 0.5f ) - this
|
||||
.getPosZ() ) * ( ( z + 0.5f ) - this.getPosZ() ) ) );
|
||||
|
||||
final float resistance = block.getExplosionResistance( this.world, point, this, ex );
|
||||
final float resistance = block.getExplosionResistance( state, this.world, point, this, ex );
|
||||
strength -= ( resistance + 0.3F ) * 0.11f;
|
||||
|
||||
if( strength > 0.01 )
|
||||
@@ -176,10 +171,10 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
{
|
||||
if( block.canDropFromExplosion( ex ) )
|
||||
{
|
||||
block.dropBlockAsItemWithChance( this.world, point, state, 1.0F / 1.0f, 0 );
|
||||
block.spawnDrops( state, this.world, point );
|
||||
}
|
||||
|
||||
block.onBlockExploded( this.world, point, ex );
|
||||
block.onBlockExploded( null, this.world, point, ex );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,19 +183,19 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
}
|
||||
}
|
||||
|
||||
AppEng.proxy.sendToAllNearExcept( null, this.posX, this.posY, this.posZ, 64, this.world, new PacketMockExplosion( this.posX, this.posY, this.posZ ) );
|
||||
AppEng.proxy.sendToAllNearExcept( null, this.getPosX(), this.getPosY(), this.getPosZ(), 64, this.world,
|
||||
new PacketMockExplosion( this.getPosX(), this.getPosY(), this.getPosZ() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData( final ByteBuf data )
|
||||
public void writeSpawnData( PacketBuffer buffer )
|
||||
{
|
||||
data.writeByte( this.getFuse() );
|
||||
buffer.writeByte( this.getFuse() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData( final ByteBuf data )
|
||||
public void readSpawnData( PacketBuffer additionalData )
|
||||
{
|
||||
this.setFuse( data.readByte() );
|
||||
;
|
||||
this.setFuse( additionalData.readByte() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,18 +24,18 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderEntityItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public class RenderFloatingItem extends RenderEntityItem
|
||||
{
|
||||
|
||||
public RenderFloatingItem( final RenderManager manager )
|
||||
{
|
||||
super( manager, Minecraft.getMinecraft().getRenderItem() );
|
||||
super( manager, Minecraft.getInstance().getRenderItem() );
|
||||
this.shadowOpaque = 0.0F;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class RenderFloatingItem extends RenderEntityItem
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if( !( efi.getItem().getItem() instanceof ItemBlock ) )
|
||||
if( !( efi.getItem().getItem() instanceof BlockItem ) )
|
||||
{
|
||||
GlStateManager.translate( 0, -0.3f, 0 );
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public class RenderTinyTNTPrimed extends Render<EntityTinyTNTPrimed>
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RenderTinyTNTPrimed extends Render<EntityTinyTNTPrimed>
|
||||
@Override
|
||||
public void doRender( final EntityTinyTNTPrimed tnt, final double x, final double y, final double z, final float unused, final float life )
|
||||
{
|
||||
final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate( (float) x, (float) y + 0.25F, (float) z );
|
||||
float f2;
|
||||
|
||||
Reference in New Issue
Block a user