Fixes #675 No disabled feature should log spam or crash anymore.
Deprecates the old usage of the AEItemDefinitions via the direct method access of * blocks() * parts() * items() * materials() and thus use the new re-direct via definitions(). All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
@@ -30,10 +30,12 @@ import net.minecraft.util.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.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
|
||||
final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
@@ -42,6 +44,7 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
int delay = 0;
|
||||
int transformTime = 0;
|
||||
|
||||
@Reflected
|
||||
public EntityChargedQuartz(World w)
|
||||
{
|
||||
super( w );
|
||||
@@ -88,7 +91,9 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
public boolean transform()
|
||||
{
|
||||
ItemStack item = this.getEntityItem();
|
||||
if ( AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( item ) )
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
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 );
|
||||
@@ -127,12 +132,17 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
|
||||
if ( netherQuartz.getEntityItem().stackSize <= 0 )
|
||||
netherQuartz.setDead();
|
||||
|
||||
ItemStack Output = AEApi.instance().materials().materialFluixCrystal.stack( 2 );
|
||||
this.worldObj.spawnEntityInWorld( new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, Output ) );
|
||||
for ( ItemStack fluixCrystalStack : materials.fluixCrystal().maybeStack( 2 ).asSet() )
|
||||
{
|
||||
final EntityItem entity = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, fluixCrystalStack );
|
||||
|
||||
this.worldObj.spawnEntityInWorld( entity );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,10 @@ 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;
|
||||
|
||||
|
||||
@@ -42,6 +44,7 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
|
||||
static private int randTickSeed = 0;
|
||||
|
||||
@Reflected
|
||||
public EntitySingularity( World w )
|
||||
{
|
||||
super( w );
|
||||
@@ -73,7 +76,10 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
return;
|
||||
|
||||
ItemStack item = this.getEntityItem();
|
||||
if ( AEApi.instance().materials().materialSingularity.sameAsStack( item ) )
|
||||
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
|
||||
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 );
|
||||
@@ -116,13 +122,16 @@ final public class EntitySingularity extends AEBaseEntityItem
|
||||
if ( other.stackSize == 0 )
|
||||
e.setDead();
|
||||
|
||||
ItemStack Output = AEApi.instance().materials().materialQESingularity.stack( 2 );
|
||||
NBTTagCompound cmp = Platform.openNbtData( Output );
|
||||
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
|
||||
randTickSeed++;
|
||||
item.stackSize--;
|
||||
for ( ItemStack singularityStack : materials.qESingularity().maybeStack( 2 ).asSet() )
|
||||
{
|
||||
NBTTagCompound cmp = Platform.openNbtData( singularityStack );
|
||||
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
|
||||
randTickSeed++;
|
||||
item.stackSize--;
|
||||
|
||||
this.worldObj.spawnEntityInWorld( new EntitySingularity( this.worldObj, this.posX, this.posY, this.posZ, Output ) );
|
||||
final EntitySingularity entity = new EntitySingularity( this.worldObj, this.posX, this.posY, this.posZ, singularityStack );
|
||||
this.worldObj.spawnEntityInWorld( entity );
|
||||
}
|
||||
}
|
||||
|
||||
if ( item.stackSize <= 0 )
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.Explosion;
|
||||
@@ -38,11 +39,12 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
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) {
|
||||
super( w );
|
||||
this.setSize( 0.35F, 0.35F );
|
||||
@@ -80,15 +82,20 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
|
||||
|
||||
if ( this.isInWater() && Platform.isServer() ) // put out the fuse.
|
||||
{
|
||||
EntityItem item = new EntityItem( this.worldObj, this.posX, this.posY, this.posZ, AEApi.instance().blocks().blockTinyTNT.stack( 1 ) );
|
||||
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.worldObj.spawnEntityInWorld( item );
|
||||
this.setDead();
|
||||
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 );
|
||||
|
||||
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.worldObj.spawnEntityInWorld( item );
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.fuse <= 0 )
|
||||
|
||||
Reference in New Issue
Block a user