reformatted all src files (#141)
This commit is contained in:
@@ -19,29 +19,25 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AEBaseEntityItem extends EntityItem
|
||||
{
|
||||
public AEBaseEntityItem( final World world )
|
||||
{
|
||||
super( world );
|
||||
}
|
||||
|
||||
public AEBaseEntityItem( final World world, final double x, final double y, final double z, final ItemStack stack )
|
||||
{
|
||||
super( world, x, y, z, stack );
|
||||
}
|
||||
public abstract class AEBaseEntityItem extends EntityItem {
|
||||
public AEBaseEntityItem(final World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity( final AxisAlignedBB region )
|
||||
{
|
||||
return this.world.getEntitiesWithinAABBExcludingEntity( this, region );
|
||||
}
|
||||
public AEBaseEntityItem(final World world, final double x, final double y, final double z, final ItemStack stack) {
|
||||
super(world, x, y, z, stack);
|
||||
}
|
||||
|
||||
protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity(final AxisAlignedBB region) {
|
||||
return this.world.getEntitiesWithinAABBExcludingEntity(this, region);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,14 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
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;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -32,140 +38,111 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public final class EntityChargedQuartz extends AEBaseEntityItem
|
||||
{
|
||||
public final class EntityChargedQuartz extends AEBaseEntityItem {
|
||||
|
||||
private int delay = 0;
|
||||
private int transformTime = 0;
|
||||
private int delay = 0;
|
||||
private int transformTime = 0;
|
||||
|
||||
@Reflected
|
||||
public EntityChargedQuartz( final World w )
|
||||
{
|
||||
super( w );
|
||||
}
|
||||
@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 );
|
||||
}
|
||||
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()
|
||||
{
|
||||
super.onUpdate();
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if( this.isDead || !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.isDead || !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 );
|
||||
this.delay = 0;
|
||||
}
|
||||
if (Platform.isClient() && this.delay > 30 && AEConfig.instance().isEnableEffects()) {
|
||||
AppEng.proxy.spawnEffect(EffectType.Lightning, this.world, this.posX, this.posY, this.posZ, null);
|
||||
this.delay = 0;
|
||||
}
|
||||
|
||||
this.delay++;
|
||||
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.posX);
|
||||
final int i = MathHelper.floor((this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D);
|
||||
final int k = MathHelper.floor(this.posZ);
|
||||
|
||||
IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) );
|
||||
final Material mat = state.getMaterial();
|
||||
IBlockState state = this.world.getBlockState(new BlockPos(j, i, k));
|
||||
final Material mat = state.getMaterial();
|
||||
|
||||
if( Platform.isServer() && mat.isLiquid() )
|
||||
{
|
||||
this.transformTime++;
|
||||
if( this.transformTime > 60 )
|
||||
{
|
||||
if( !this.transform() )
|
||||
{
|
||||
this.transformTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.transformTime = 0;
|
||||
}
|
||||
}
|
||||
if (Platform.isServer() && mat.isLiquid()) {
|
||||
this.transformTime++;
|
||||
if (this.transformTime > 60) {
|
||||
if (!this.transform()) {
|
||||
this.transformTime = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.transformTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean transform()
|
||||
{
|
||||
final ItemStack item = this.getItem();
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
private boolean transform() {
|
||||
final ItemStack item = this.getItem();
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
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 List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
|
||||
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 List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
|
||||
|
||||
EntityItem redstone = null;
|
||||
EntityItem netherQuartz = null;
|
||||
EntityItem redstone = null;
|
||||
EntityItem netherQuartz = null;
|
||||
|
||||
for( final Entity e : l )
|
||||
{
|
||||
if( e instanceof EntityItem && !e.isDead )
|
||||
{
|
||||
final ItemStack other = ( (EntityItem) e ).getItem();
|
||||
if( !other.isEmpty() )
|
||||
{
|
||||
if( ItemStack.areItemsEqual( other, new ItemStack( Items.REDSTONE ) ) )
|
||||
{
|
||||
redstone = (EntityItem) e;
|
||||
}
|
||||
for (final Entity e : l) {
|
||||
if (e instanceof EntityItem && !e.isDead) {
|
||||
final ItemStack other = ((EntityItem) e).getItem();
|
||||
if (!other.isEmpty()) {
|
||||
if (ItemStack.areItemsEqual(other, new ItemStack(Items.REDSTONE))) {
|
||||
redstone = (EntityItem) e;
|
||||
}
|
||||
|
||||
if( ItemStack.areItemsEqual( other, new ItemStack( Items.QUARTZ ) ) )
|
||||
{
|
||||
netherQuartz = (EntityItem) e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ItemStack.areItemsEqual(other, new ItemStack(Items.QUARTZ))) {
|
||||
netherQuartz = (EntityItem) e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( redstone != null && netherQuartz != null )
|
||||
{
|
||||
this.getItem().grow( -1 );
|
||||
redstone.getItem().grow( -1 );
|
||||
netherQuartz.getItem().grow( -1 );
|
||||
if (redstone != null && netherQuartz != null) {
|
||||
this.getItem().grow(-1);
|
||||
redstone.getItem().grow(-1);
|
||||
netherQuartz.getItem().grow(-1);
|
||||
|
||||
if( this.getItem().getCount() <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
if (this.getItem().getCount() <= 0) {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if( redstone.getItem().getCount() <= 0 )
|
||||
{
|
||||
redstone.setDead();
|
||||
}
|
||||
if (redstone.getItem().getCount() <= 0) {
|
||||
redstone.setDead();
|
||||
}
|
||||
|
||||
if( netherQuartz.getItem().getCount() <= 0 )
|
||||
{
|
||||
netherQuartz.setDead();
|
||||
}
|
||||
if (netherQuartz.getItem().getCount() <= 0) {
|
||||
netherQuartz.setDead();
|
||||
}
|
||||
|
||||
materials.fluixCrystal().maybeStack( 2 ).ifPresent( is ->
|
||||
{
|
||||
final EntityItem entity = new EntityItem( this.world, this.posX, this.posY, this.posZ, is );
|
||||
materials.fluixCrystal().maybeStack(2).ifPresent(is ->
|
||||
{
|
||||
final EntityItem entity = new EntityItem(this.world, this.posX, this.posY, this.posZ, is);
|
||||
|
||||
this.world.spawnEntity( entity );
|
||||
} );
|
||||
this.world.spawnEntity(entity);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,52 +24,44 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public final class EntityFloatingItem extends EntityItem
|
||||
{
|
||||
public final class EntityFloatingItem extends EntityItem {
|
||||
|
||||
private final ICanDie parent;
|
||||
private int superDeath = 0;
|
||||
private float progress = 0;
|
||||
private final ICanDie parent;
|
||||
private int superDeath = 0;
|
||||
private float progress = 0;
|
||||
|
||||
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.rotationYaw = 0;
|
||||
this.parent = parent;
|
||||
}
|
||||
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.rotationYaw = 0;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
// public boolean isEntityAlive()
|
||||
// public boolean isEntityAlive()
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if( !this.isDead && this.parent.isDead() )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (!this.isDead && this.parent.isDead()) {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if( this.superDeath > 100 )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
this.superDeath++;
|
||||
if (this.superDeath > 100) {
|
||||
this.setDead();
|
||||
}
|
||||
this.superDeath++;
|
||||
|
||||
this.setNoDespawn();
|
||||
}
|
||||
this.setNoDespawn();
|
||||
}
|
||||
|
||||
public void setProgress( final float progress )
|
||||
{
|
||||
this.progress = progress;
|
||||
if( this.progress > 0.99 )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
public void setProgress(final float progress) {
|
||||
this.progress = progress;
|
||||
if (this.progress > 0.99) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
float getProgress()
|
||||
{
|
||||
return this.progress;
|
||||
}
|
||||
float getProgress() {
|
||||
return this.progress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import appeng.api.implementations.items.IGrowableCrystal;
|
||||
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -29,170 +36,132 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.items.IGrowableCrystal;
|
||||
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public final class EntityGrowingCrystal extends EntityItem {
|
||||
|
||||
public final class EntityGrowingCrystal extends EntityItem
|
||||
{
|
||||
private int progress_1000 = 0;
|
||||
|
||||
private int progress_1000 = 0;
|
||||
public EntityGrowingCrystal(final World w) {
|
||||
super(w);
|
||||
}
|
||||
|
||||
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);
|
||||
this.setNoDespawn();
|
||||
}
|
||||
|
||||
public EntityGrowingCrystal( final World w, final double x, final double y, final double z, final ItemStack is )
|
||||
{
|
||||
super( w, x, y, z, is );
|
||||
this.setNoDespawn();
|
||||
}
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
if (!AEConfig.instance().isFeatureEnabled(AEFeature.IN_WORLD_PURIFICATION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_PURIFICATION ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
final ItemStack is = this.getItem();
|
||||
final Item gc = is.getItem();
|
||||
|
||||
final ItemStack is = this.getItem();
|
||||
final Item gc = is.getItem();
|
||||
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);
|
||||
|
||||
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 IBlockState state = this.world.getBlockState(new BlockPos(j, i, k));
|
||||
final Material mat = state.getMaterial();
|
||||
final IGrowableCrystal cry = (IGrowableCrystal) is.getItem();
|
||||
|
||||
final IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) );
|
||||
final Material mat = state.getMaterial();
|
||||
final IGrowableCrystal cry = (IGrowableCrystal) is.getItem();
|
||||
final float multiplier = cry.getMultiplier(state.getBlock(), mat);
|
||||
final int speed = (int) Math.max(1, this.getSpeed(j, i, k) * multiplier);
|
||||
|
||||
final float multiplier = cry.getMultiplier( state.getBlock(), mat );
|
||||
final int speed = (int) Math.max( 1, this.getSpeed( j, i, k ) * multiplier );
|
||||
final boolean isClient = Platform.isClient();
|
||||
|
||||
final boolean isClient = Platform.isClient();
|
||||
if (mat.isLiquid()) {
|
||||
if (isClient) {
|
||||
this.progress_1000++;
|
||||
} else {
|
||||
this.progress_1000 += speed;
|
||||
}
|
||||
} else {
|
||||
this.progress_1000 = 0;
|
||||
}
|
||||
|
||||
if( mat.isLiquid() )
|
||||
{
|
||||
if( isClient )
|
||||
{
|
||||
this.progress_1000++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.progress_1000 += speed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.progress_1000 = 0;
|
||||
}
|
||||
if (isClient) {
|
||||
int len = 40;
|
||||
|
||||
if( isClient )
|
||||
{
|
||||
int len = 40;
|
||||
if (speed > 2) {
|
||||
len = 20;
|
||||
}
|
||||
|
||||
if( speed > 2 )
|
||||
{
|
||||
len = 20;
|
||||
}
|
||||
if (speed > 90) {
|
||||
len = 15;
|
||||
}
|
||||
|
||||
if( speed > 90 )
|
||||
{
|
||||
len = 15;
|
||||
}
|
||||
if (speed > 150) {
|
||||
len = 10;
|
||||
}
|
||||
|
||||
if( speed > 150 )
|
||||
{
|
||||
len = 10;
|
||||
}
|
||||
if (speed > 240) {
|
||||
len = 7;
|
||||
}
|
||||
|
||||
if( speed > 240 )
|
||||
{
|
||||
len = 7;
|
||||
}
|
||||
if (speed > 360) {
|
||||
len = 3;
|
||||
}
|
||||
|
||||
if( speed > 360 )
|
||||
{
|
||||
len = 3;
|
||||
}
|
||||
if (speed > 500) {
|
||||
len = 1;
|
||||
}
|
||||
|
||||
if( speed > 500 )
|
||||
{
|
||||
len = 1;
|
||||
}
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
if (this.progress_1000 > 1000) {
|
||||
this.progress_1000 -= 1000;
|
||||
this.setItem(cry.triggerGrowth(is));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( this.progress_1000 > 1000 )
|
||||
{
|
||||
this.progress_1000 -= 1000;
|
||||
this.setItem( cry.triggerGrowth( is ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private int getSpeed(final int x, final int y, final int z) {
|
||||
final int per = 80;
|
||||
final float mul = 0.3f;
|
||||
|
||||
private int getSpeed( final int x, final int y, final int z )
|
||||
{
|
||||
final int per = 80;
|
||||
final float mul = 0.3f;
|
||||
int qty = 0;
|
||||
|
||||
int qty = 0;
|
||||
if (this.isAccelerated(x + 1, y, z)) {
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
|
||||
if( this.isAccelerated( x + 1, y, z ) )
|
||||
{
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
if (this.isAccelerated(x, y + 1, z)) {
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
|
||||
if( this.isAccelerated( x, y + 1, z ) )
|
||||
{
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
if (this.isAccelerated(x, y, z + 1)) {
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
|
||||
if( this.isAccelerated( x, y, z + 1 ) )
|
||||
{
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
if (this.isAccelerated(x - 1, y, z)) {
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
|
||||
if( this.isAccelerated( x - 1, y, z ) )
|
||||
{
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
if (this.isAccelerated(x, y - 1, z)) {
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
|
||||
if( this.isAccelerated( x, y - 1, z ) )
|
||||
{
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
if (this.isAccelerated(x, y, z - 1)) {
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
|
||||
if( this.isAccelerated( x, y, z - 1 ) )
|
||||
{
|
||||
qty += per + qty * mul;
|
||||
}
|
||||
return qty;
|
||||
}
|
||||
|
||||
return qty;
|
||||
}
|
||||
private boolean isAccelerated(final int x, final int y, final int z) {
|
||||
final TileEntity te = this.world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
private boolean isAccelerated( final int x, final int y, final int z )
|
||||
{
|
||||
final TileEntity te = this.world.getTileEntity( new BlockPos( x, y, z ) );
|
||||
|
||||
return te instanceof ICrystalGrowthAccelerator && ( (ICrystalGrowthAccelerator) te ).isPowered();
|
||||
}
|
||||
return te instanceof ICrystalGrowthAccelerator && ((ICrystalGrowthAccelerator) te).isPowered();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,36 +22,29 @@ package appeng.entity;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
|
||||
public final class EntityIds
|
||||
{
|
||||
private static final int TINY_TNT = 10;
|
||||
private static final int SINGULARITY = 11;
|
||||
private static final int CHARGED_QUARTZ = 12;
|
||||
private static final int GROWING_CRYSTAL = 13;
|
||||
public final class EntityIds {
|
||||
private static final int TINY_TNT = 10;
|
||||
private static final int SINGULARITY = 11;
|
||||
private static final int CHARGED_QUARTZ = 12;
|
||||
private static final int GROWING_CRYSTAL = 13;
|
||||
|
||||
private EntityIds()
|
||||
{
|
||||
}
|
||||
private EntityIds() {
|
||||
}
|
||||
|
||||
public static int get( final Class<? extends Entity> droppedEntity )
|
||||
{
|
||||
if( droppedEntity == EntityTinyTNTPrimed.class )
|
||||
{
|
||||
return TINY_TNT;
|
||||
}
|
||||
if( droppedEntity == EntitySingularity.class )
|
||||
{
|
||||
return SINGULARITY;
|
||||
}
|
||||
if( droppedEntity == EntityChargedQuartz.class )
|
||||
{
|
||||
return CHARGED_QUARTZ;
|
||||
}
|
||||
if( droppedEntity == EntityGrowingCrystal.class )
|
||||
{
|
||||
return GROWING_CRYSTAL;
|
||||
}
|
||||
public static int get(final Class<? extends Entity> droppedEntity) {
|
||||
if (droppedEntity == EntityTinyTNTPrimed.class) {
|
||||
return TINY_TNT;
|
||||
}
|
||||
if (droppedEntity == EntitySingularity.class) {
|
||||
return SINGULARITY;
|
||||
}
|
||||
if (droppedEntity == EntityChargedQuartz.class) {
|
||||
return CHARGED_QUARTZ;
|
||||
}
|
||||
if (droppedEntity == EntityGrowingCrystal.class) {
|
||||
return GROWING_CRYSTAL;
|
||||
}
|
||||
|
||||
throw new IllegalStateException( "Missing entity id: " + droppedEntity.getName() );
|
||||
}
|
||||
throw new IllegalStateException("Missing entity id: " + droppedEntity.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -31,124 +34,98 @@ 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;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public final class EntitySingularity extends AEBaseEntityItem
|
||||
{
|
||||
public final class EntitySingularity extends AEBaseEntityItem {
|
||||
|
||||
private static int randTickSeed = 0;
|
||||
private static int randTickSeed = 0;
|
||||
|
||||
@Reflected
|
||||
public EntitySingularity( final World w )
|
||||
{
|
||||
super( w );
|
||||
}
|
||||
@Reflected
|
||||
public EntitySingularity(final World w) {
|
||||
super(w);
|
||||
}
|
||||
|
||||
public EntitySingularity( final World w, final double x, final double y, final double z, final ItemStack is )
|
||||
{
|
||||
super( w, x, y, z, is );
|
||||
}
|
||||
public EntitySingularity(final World w, final double x, final double y, final double z, final ItemStack is) {
|
||||
super(w, x, y, z, is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom( final DamageSource src, final float dmg )
|
||||
{
|
||||
if( src.isExplosion() )
|
||||
{
|
||||
this.doExplosion();
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean attackEntityFrom(final DamageSource src, final float dmg) {
|
||||
if (src.isExplosion()) {
|
||||
this.doExplosion();
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom( src, dmg );
|
||||
}
|
||||
return super.attackEntityFrom(src, dmg);
|
||||
}
|
||||
|
||||
private void doExplosion()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
private void doExplosion() {
|
||||
if (Platform.isClient()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_SINGULARITY ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!AEConfig.instance().isFeatureEnabled(AEFeature.IN_WORLD_SINGULARITY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemStack item = this.getItem();
|
||||
final ItemStack item = this.getItem();
|
||||
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
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 List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
|
||||
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 List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
|
||||
|
||||
for( final Entity e : l )
|
||||
{
|
||||
if( e instanceof EntityItem )
|
||||
{
|
||||
final ItemStack other = ( (EntityItem) e ).getItem();
|
||||
if( !other.isEmpty() )
|
||||
{
|
||||
boolean matches = false;
|
||||
for( final ItemStack is : OreDictionary.getOres( "dustEnder" ) )
|
||||
{
|
||||
if( OreDictionary.itemMatches( other, is, false ) )
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (final Entity e : l) {
|
||||
if (e instanceof EntityItem) {
|
||||
final ItemStack other = ((EntityItem) 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check... other name.
|
||||
if (!matches) {
|
||||
for (final ItemStack is : OreDictionary.getOres("dustEnderPearl")) {
|
||||
if (OreDictionary.itemMatches(other, is, false)) {
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( matches )
|
||||
{
|
||||
while( item.getCount() > 0 && other.getCount() > 0 )
|
||||
{
|
||||
other.grow( -1 );
|
||||
;
|
||||
if( other.getCount() == 0 )
|
||||
{
|
||||
e.setDead();
|
||||
}
|
||||
if (matches) {
|
||||
while (item.getCount() > 0 && other.getCount() > 0) {
|
||||
other.grow(-1);
|
||||
if (other.getCount() == 0) {
|
||||
e.setDead();
|
||||
}
|
||||
|
||||
materials.qESingularity().maybeStack( 2 ).ifPresent( singularityStack ->
|
||||
{
|
||||
final NBTTagCompound cmp = Platform.openNbtData( singularityStack );
|
||||
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
|
||||
randTickSeed++;
|
||||
item.grow( -1 );
|
||||
materials.qESingularity().maybeStack(2).ifPresent(singularityStack ->
|
||||
{
|
||||
final NBTTagCompound cmp = Platform.openNbtData(singularityStack);
|
||||
cmp.setLong("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.posX, this.posY, this.posZ, singularityStack);
|
||||
this.world.spawnEntity(entity);
|
||||
});
|
||||
}
|
||||
|
||||
if( item.getCount() <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.getCount() <= 0) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,14 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.packets.PacketMockExplosion;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -41,166 +45,137 @@ import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.packets.PacketMockExplosion;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
|
||||
{
|
||||
public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData {
|
||||
|
||||
private static final float SIZE = .5f;
|
||||
private static final float SIZE = .5f;
|
||||
|
||||
@Reflected
|
||||
public EntityTinyTNTPrimed( final World w )
|
||||
{
|
||||
super( w );
|
||||
this.setSize( SIZE, SIZE );
|
||||
}
|
||||
@Reflected
|
||||
public EntityTinyTNTPrimed(final World w) {
|
||||
super(w);
|
||||
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( SIZE, SIZE );
|
||||
// this.yOffset = this.height / 2.0F;
|
||||
}
|
||||
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(SIZE, SIZE);
|
||||
// this.yOffset = this.height / 2.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
this.handleWaterMovement();
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
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.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;
|
||||
|
||||
if( this.onGround )
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -0.5D;
|
||||
}
|
||||
if (this.onGround) {
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
this.motionY *= -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 );
|
||||
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);
|
||||
|
||||
item.motionX = this.motionX;
|
||||
item.motionY = this.motionY;
|
||||
item.motionZ = this.motionZ;
|
||||
item.prevPosX = this.prevPosX;
|
||||
item.prevPosY = this.prevPosY;
|
||||
item.prevPosZ = this.prevPosZ;
|
||||
item.motionX = this.motionX;
|
||||
item.motionY = this.motionY;
|
||||
item.motionZ = this.motionZ;
|
||||
item.prevPosX = this.prevPosX;
|
||||
item.prevPosY = this.prevPosY;
|
||||
item.prevPosZ = this.prevPosZ;
|
||||
|
||||
this.world.spawnEntity( item );
|
||||
this.setDead();
|
||||
} );
|
||||
}
|
||||
this.world.spawnEntity(item);
|
||||
this.setDead();
|
||||
});
|
||||
}
|
||||
|
||||
if( this.getFuse() <= 0 )
|
||||
{
|
||||
this.setDead();
|
||||
if (this.getFuse() <= 0) {
|
||||
this.setDead();
|
||||
|
||||
if( !this.world.isRemote )
|
||||
{
|
||||
this.explode();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );
|
||||
}
|
||||
this.setFuse( this.getFuse() - 1 );
|
||||
}
|
||||
if (!this.world.isRemote) {
|
||||
this.explode();
|
||||
}
|
||||
} else {
|
||||
this.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
this.setFuse(this.getFuse() - 1);
|
||||
}
|
||||
|
||||
// override :P
|
||||
void explode()
|
||||
{
|
||||
this.world.playSound( null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F,
|
||||
( 1.0F + ( this.world.rand.nextFloat() - this.world.rand.nextFloat() ) * 0.2F ) * 32.9F );
|
||||
// override :P
|
||||
void explode() {
|
||||
this.world.playSound(null, this.posX, this.posY, this.posZ, 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() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.isInWater()) {
|
||||
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 List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity( this, area );
|
||||
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 List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, area);
|
||||
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate( this.world, ex, list, 0.2f * 2d );
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.world, ex, list, 0.2f * 2d);
|
||||
|
||||
for( final Entity e : list )
|
||||
{
|
||||
e.attackEntityFrom( DamageSource.causeExplosionDamage( ex ), 6 );
|
||||
}
|
||||
for (final Entity e : list) {
|
||||
e.attackEntityFrom(DamageSource.causeExplosionDamage(ex), 6);
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.TINY_TNT_BLOCK_DAMAGE ) )
|
||||
{
|
||||
this.posY -= 0.25;
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.TINY_TNT_BLOCK_DAMAGE)) {
|
||||
this.posY -= 0.25;
|
||||
|
||||
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 z = (int) ( this.posZ - 2 ); z <= this.posZ + 2; z++ )
|
||||
{
|
||||
final BlockPos point = new BlockPos( x, y, z );
|
||||
final IBlockState state = this.world.getBlockState( point );
|
||||
final Block block = state.getBlock();
|
||||
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 z = (int) (this.posZ - 2); z <= this.posZ + 2; z++) {
|
||||
final BlockPos point = new BlockPos(x, y, z);
|
||||
final IBlockState 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 ) ) );
|
||||
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)));
|
||||
|
||||
final float resistance = block.getExplosionResistance( this.world, point, this, ex );
|
||||
strength -= ( resistance + 0.3F ) * 0.11f;
|
||||
final float resistance = block.getExplosionResistance(this.world, point, this, ex);
|
||||
strength -= (resistance + 0.3F) * 0.11f;
|
||||
|
||||
if( strength > 0.01 )
|
||||
{
|
||||
if( block.getMaterial( state ) != Material.AIR )
|
||||
{
|
||||
if( block.canDropFromExplosion( ex ) )
|
||||
{
|
||||
block.dropBlockAsItemWithChance( this.world, point, state, 1.0F / 1.0f, 0 );
|
||||
}
|
||||
if (strength > 0.01) {
|
||||
if (block.getMaterial(state) != Material.AIR) {
|
||||
if (block.canDropFromExplosion(ex)) {
|
||||
block.dropBlockAsItemWithChance(this.world, point, state, 1.0F / 1.0f, 0);
|
||||
}
|
||||
|
||||
block.onBlockExploded( this.world, point, ex );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
block.onBlockExploded(this.world, point, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.posX, this.posY, this.posZ, 64, this.world, new PacketMockExplosion(this.posX, this.posY, this.posZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData( final ByteBuf data )
|
||||
{
|
||||
data.writeByte( this.getFuse() );
|
||||
}
|
||||
@Override
|
||||
public void writeSpawnData(final ByteBuf data) {
|
||||
data.writeByte(this.getFuse());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData( final ByteBuf data )
|
||||
{
|
||||
this.setFuse( data.readByte() );
|
||||
;
|
||||
}
|
||||
@Override
|
||||
public void readSpawnData(final ByteBuf data) {
|
||||
this.setFuse(data.readByte());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
package appeng.entity;
|
||||
|
||||
|
||||
public interface ICanDie
|
||||
{
|
||||
public interface ICanDie {
|
||||
|
||||
public boolean isDead();
|
||||
boolean isDead();
|
||||
|
||||
}
|
||||
|
||||
@@ -29,44 +29,35 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class RenderFloatingItem extends RenderEntityItem
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderFloatingItem extends RenderEntityItem {
|
||||
|
||||
public RenderFloatingItem( final RenderManager manager )
|
||||
{
|
||||
super( manager, Minecraft.getMinecraft().getRenderItem() );
|
||||
this.shadowOpaque = 0.0F;
|
||||
}
|
||||
public RenderFloatingItem(final RenderManager manager) {
|
||||
super(manager, Minecraft.getMinecraft().getRenderItem());
|
||||
this.shadowOpaque = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender( final EntityItem entityItem, final double x, final double y, final double z, final float yaw, final float partialTick )
|
||||
{
|
||||
if( entityItem instanceof EntityFloatingItem )
|
||||
{
|
||||
final EntityFloatingItem efi = (EntityFloatingItem) entityItem;
|
||||
if( efi.getProgress() > 0.0 )
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
@Override
|
||||
public void doRender(final EntityItem entityItem, final double x, final double y, final double z, final float yaw, final float partialTick) {
|
||||
if (entityItem instanceof EntityFloatingItem) {
|
||||
final EntityFloatingItem efi = (EntityFloatingItem) entityItem;
|
||||
if (efi.getProgress() > 0.0) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if( !( efi.getItem().getItem() instanceof ItemBlock ) )
|
||||
{
|
||||
GlStateManager.translate( 0, -0.3f, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.translate( 0, -0.2f, 0 );
|
||||
}
|
||||
if (!(efi.getItem().getItem() instanceof ItemBlock)) {
|
||||
GlStateManager.translate(0, -0.3f, 0);
|
||||
} else {
|
||||
GlStateManager.translate(0, -0.2f, 0);
|
||||
}
|
||||
|
||||
super.doRender( efi, x, y, z, yaw, 0 );
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.doRender(efi, x, y, z, yaw, 0);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBob()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,76 +31,68 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class RenderTinyTNTPrimed extends Render<EntityTinyTNTPrimed>
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTinyTNTPrimed extends Render<EntityTinyTNTPrimed> {
|
||||
|
||||
public RenderTinyTNTPrimed( final RenderManager p_i46134_1_ )
|
||||
{
|
||||
super( p_i46134_1_ );
|
||||
this.shadowSize = 0.5F;
|
||||
}
|
||||
public RenderTinyTNTPrimed(final RenderManager p_i46134_1_) {
|
||||
super(p_i46134_1_);
|
||||
this.shadowSize = 0.5F;
|
||||
}
|
||||
|
||||
@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();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate( (float) x, (float) y + 0.25F, (float) z );
|
||||
float f2;
|
||||
@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();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float) x, (float) y + 0.25F, (float) z);
|
||||
float f2;
|
||||
|
||||
if( tnt.getFuse() - life + 1.0F < 10.0F )
|
||||
{
|
||||
f2 = 1.0F - ( tnt.getFuse() - life + 1.0F ) / 10.0F;
|
||||
if (tnt.getFuse() - life + 1.0F < 10.0F) {
|
||||
f2 = 1.0F - (tnt.getFuse() - life + 1.0F) / 10.0F;
|
||||
|
||||
if( f2 < 0.0F )
|
||||
{
|
||||
f2 = 0.0F;
|
||||
}
|
||||
if (f2 < 0.0F) {
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
if( f2 > 1.0F )
|
||||
{
|
||||
f2 = 1.0F;
|
||||
}
|
||||
if (f2 > 1.0F) {
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
f2 *= f2;
|
||||
f2 *= f2;
|
||||
final float f3 = 1.0F + f2 * 0.3F;
|
||||
GlStateManager.scale( f3, f3, f3 );
|
||||
}
|
||||
f2 *= f2;
|
||||
f2 *= f2;
|
||||
final float f3 = 1.0F + f2 * 0.3F;
|
||||
GlStateManager.scale(f3, f3, f3);
|
||||
}
|
||||
|
||||
GlStateManager.scale( 0.5f, 0.5f, 0.5f );
|
||||
f2 = ( 1.0F - ( tnt.getFuse() - life + 1.0F ) / 100.0F ) * 0.8F;
|
||||
this.bindEntityTexture( tnt );
|
||||
GlStateManager.translate( -0.5F, -0.5F, 0.5F );
|
||||
blockrendererdispatcher.renderBlockBrightness( Blocks.TNT.getDefaultState(), tnt.getBrightness() );
|
||||
GlStateManager.translate( 0.0F, 0.0F, 1.0F );
|
||||
GlStateManager.scale(0.5f, 0.5f, 0.5f);
|
||||
f2 = (1.0F - (tnt.getFuse() - life + 1.0F) / 100.0F) * 0.8F;
|
||||
this.bindEntityTexture(tnt);
|
||||
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
|
||||
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), tnt.getBrightness());
|
||||
GlStateManager.translate(0.0F, 0.0F, 1.0F);
|
||||
|
||||
if( tnt.getFuse() / 5 % 2 == 0 )
|
||||
{
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc( 770, 772 );
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, f2 );
|
||||
GlStateManager.doPolygonOffset( -3.0F, -3.0F );
|
||||
GlStateManager.enablePolygonOffset();
|
||||
blockrendererdispatcher.renderBlockBrightness( Blocks.TNT.getDefaultState(), 1.0F );
|
||||
GlStateManager.doPolygonOffset( 0.0F, 0.0F );
|
||||
GlStateManager.disablePolygonOffset();
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
if (tnt.getFuse() / 5 % 2 == 0) {
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 772);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
|
||||
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
|
||||
GlStateManager.enablePolygonOffset();
|
||||
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 1.0F);
|
||||
GlStateManager.doPolygonOffset(0.0F, 0.0F);
|
||||
GlStateManager.disablePolygonOffset();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
super.doRender( tnt, x, y, z, unused, life );
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
super.doRender(tnt, x, y, z, unused, life);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture( final EntityTinyTNTPrimed entity )
|
||||
{
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(final EntityTinyTNTPrimed entity) {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user