1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
@@ -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;