Relocate Source to proper directory.

This commit is contained in:
AlgorithmX2
2014-09-23 19:26:27 -05:00
parent fe927ce65d
commit 386d18a059
785 changed files with 35585 additions and 35580 deletions
@@ -0,0 +1,120 @@
package appeng.entity;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.client.EffectType;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.util.Platform;
final public class EntityChargedQuartz extends EntityItem
{
int delay = 0;
int transformTime = 0;
public EntityChargedQuartz(World w) {
super( w );
}
public EntityChargedQuartz(World w, double x, double y, double z, ItemStack is) {
super( w, x, y, z, is );
}
@Override
public void onUpdate()
{
super.onUpdate();
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
return;
if ( Platform.isClient() && delay++ > 30 && AEConfig.instance.enableEffects )
{
CommonHelper.proxy.spawnEffect( EffectType.Lightning, worldObj, posX, posY, posZ, null );
delay = 0;
}
int j = MathHelper.floor_double( this.posX );
int i = MathHelper.floor_double( this.posY );
int k = MathHelper.floor_double( this.posZ );
Material mat = worldObj.getBlock( j, i, k ).getMaterial();
if ( Platform.isServer() && mat.isLiquid() )
{
transformTime++;
if ( transformTime > 60 )
{
if ( !transform() )
transformTime = 0;
}
}
else
transformTime = 0;
};
public boolean transform()
{
ItemStack item = getEntityItem();
if ( AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( item ) )
{
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1 );
List<Entity> l = worldObj.getEntitiesWithinAABBExcludingEntity( this, region );
EntityItem redstone = null;
EntityItem netherQuartz = null;
for (Entity e : l)
{
if ( e instanceof EntityItem && !e.isDead )
{
ItemStack other = ((EntityItem) e).getEntityItem();
if ( other != null && other.stackSize > 0 )
{
if ( Platform.isSameItem( other, new ItemStack( Items.redstone ) ) )
redstone = (EntityItem) e;
if ( Platform.isSameItem( other, new ItemStack( Items.quartz ) ) )
netherQuartz = (EntityItem) e;
}
}
}
if ( redstone != null && netherQuartz != null )
{
getEntityItem().stackSize--;
redstone.getEntityItem().stackSize--;
netherQuartz.getEntityItem().stackSize--;
if ( getEntityItem().stackSize <= 0 )
setDead();
if ( redstone.getEntityItem().stackSize <= 0 )
redstone.setDead();
if ( netherQuartz.getEntityItem().stackSize <= 0 )
netherQuartz.setDead();
List<ItemStack> i = new ArrayList();
i.add( AEApi.instance().materials().materialFluixCrystal.stack( 1 ) );
ItemStack Output = AEApi.instance().materials().materialFluixCrystal.stack( 2 );
worldObj.spawnEntityInWorld( new EntityItem( worldObj, posX, posY, posZ, Output ) );
return true;
}
}
return false;
}
}
@@ -0,0 +1,45 @@
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 Entity parent;
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_) {
super( p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_, p_i1710_8_ );
motionX = motionY = motionZ = 0.0d;
this.hoverStart = 0.5f;
this.rotationYaw = 0;
this.parent = parent;
}
// public boolean isEntityAlive()
public void onUpdate()
{
if ( !isDead && parent.isDead )
this.setDead();
if ( superDeath++ > 100 )
setDead();
this.age = ageStatic;
}
public void setProgress(float progress)
{
this.progress = progress;
if ( this.progress > 0.99 )
this.setDead();
}
}
@@ -0,0 +1,153 @@
package appeng.entity;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.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.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.util.Platform;
final public class EntityGrowingCrystal extends EntityItem
{
private int progress_1000 = 0;
public float getProgress()
{
return (float) progress_1000 / 1000.0f;
}
public EntityGrowingCrystal(World w) {
super( w );
}
public EntityGrowingCrystal(World w, double x, double y, double z, ItemStack is) {
super( w, x, y, z, is );
}
@Override
public void onUpdate()
{
super.onUpdate();
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
return;
if ( age > 600 )
age = 100;
ItemStack is = this.getEntityItem();
Item gc = is.getItem();
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 );
int k = MathHelper.floor_double( this.posZ );
Block blk = worldObj.getBlock( j, i, k );
Material mat = blk.getMaterial();
IGrowableCrystal cry = (IGrowableCrystal) is.getItem();
float multiplier = cry.getMultiplier( blk, mat );
int speed = (int) Math.max( 1, getSpeed( j, i, k ) * multiplier );
boolean isClient = Platform.isClient();
if ( mat.isLiquid() )
{
if ( isClient )
progress_1000++;
else
progress_1000 += speed;
}
else
progress_1000 = 0;
if ( isClient )
{
int len = 40;
if ( speed > 2 )
len = 20;
if ( speed > 90 )
len = 15;
if ( speed > 150 )
len = 10;
if ( speed > 240 )
len = 7;
if ( speed > 360 )
len = 3;
if ( speed > 500 )
len = 1;
if ( progress_1000 >= len )
{
progress_1000 = 0;
CommonHelper.proxy.spawnEffect( EffectType.Vibrant, worldObj, posX, posY + 0.2, posZ, null );
}
return;
}
else
{
if ( progress_1000 > 1000 )
{
progress_1000 -= 1000;
setEntityItemStack( cry.triggerGrowth( is ) );
}
}
}
}
private int getSpeed(int x, int y, int z)
{
final int per = 80;
final float mul = 0.3f;
int qty = 0;
if ( isAccel( x + 1, y, z ) )
qty += per + qty * mul;
if ( isAccel( x, y + 1, z ) )
qty += per + qty * mul;
if ( isAccel( x, y, z + 1 ) )
qty += per + qty * mul;
if ( isAccel( x - 1, y, z ) )
qty += per + qty * mul;
if ( isAccel( x, y - 1, z ) )
qty += per + qty * mul;
if ( isAccel( x, y, z - 1 ) )
qty += per + qty * mul;
return qty;
}
private boolean isAccel(int x, int y, int z)
{
TileEntity te = worldObj.getTileEntity( x, y, z );
if ( te instanceof ICrystalGrowthAccelerator )
return ((ICrystalGrowthAccelerator) te).isPowered();
return false;
}
}
@@ -0,0 +1,26 @@
package appeng.entity;
import net.minecraft.entity.Entity;
public class EntityIds
{
public static final int TINY_TNT = 10;
public static final int SINGULARITY = 11;
public static final int CHARGED_QUARTZ = 12;
public static final int GROWING_CRYSTAL = 13;
public static int get(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 RuntimeException( "Missing entity id: " + droppedEntity.getName() );
}
}
@@ -0,0 +1,113 @@
package appeng.entity;
import java.util.Date;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.util.Platform;
final public class EntitySingularity extends EntityItem
{
static private int randTickSeed = 0;
public EntitySingularity(World w) {
super( w );
}
public EntitySingularity(World w, double x, double y, double z, ItemStack is) {
super( w, x, y, z, is );
}
@Override
public boolean attackEntityFrom(DamageSource src, float dmg)
{
if ( src.isExplosion() )
{
doExplosion();
return false;
}
return super.attackEntityFrom( src, dmg );
}
public void doExplosion()
{
if ( Platform.isClient() )
return;
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
return;
ItemStack item = getEntityItem();
if ( AEApi.instance().materials().materialSingularity.sameAsStack( item ) )
{
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( posX - 4, posY - 4, posZ - 4, posX + 4, posY + 4, posZ + 4 );
List<Entity> l = worldObj.getEntitiesWithinAABBExcludingEntity( this, region );
for (Entity e : l)
{
if ( e instanceof EntityItem )
{
ItemStack other = ((EntityItem) e).getEntityItem();
if ( other != null )
{
boolean matches = false;
for (ItemStack is : OreDictionary.getOres( "dustEnder" ))
{
if ( OreDictionary.itemMatches( other, is, false ) )
{
matches = true;
break;
}
}
// check... other name.
if ( matches == false )
{
for (ItemStack is : OreDictionary.getOres( "dustEnderPearl" ))
{
if ( OreDictionary.itemMatches( other, is, false ) )
{
matches = true;
break;
}
}
}
if ( matches )
{
while (item.stackSize > 0 && other.stackSize > 0)
{
other.stackSize--;
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 );
item.stackSize--;
worldObj.spawnEntityInWorld( new EntitySingularity( worldObj, posX, posY, posZ, Output ) );
}
if ( item.stackSize <= 0 )
setDead();
}
}
}
}
}
}
}
@@ -0,0 +1,172 @@
package appeng.entity;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
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.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.core.sync.packets.PacketMockExplosion;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData
{
public EntityTinyTNTPrimed(World w) {
super( w );
this.setSize( 0.35F, 0.35F );
}
public EntityTinyTNTPrimed(World w, double x, double y, double z, EntityLivingBase ignitor) {
super( w, x, y, z, ignitor );
this.setSize( 0.55F, 0.55F );
this.yOffset = this.height / 2.0F;
}
/**
* 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.moveEntity( 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.isInWater() && Platform.isServer() ) // put out the fuse.
{
EntityItem item = new EntityItem( worldObj, this.posX, this.posY, this.posZ, AEApi.instance().blocks().blockTinyTNT.stack( 1 ) );
item.motionX = motionX;
item.motionY = motionY;
item.motionZ = motionZ;
item.prevPosX = this.prevPosX;
item.prevPosY = this.prevPosY;
item.prevPosZ = this.prevPosZ;
worldObj.spawnEntityInWorld( item );
this.setDead();
}
if ( this.fuse-- <= 0 )
{
this.setDead();
if ( !this.worldObj.isRemote )
{
this.explode();
}
}
else
{
this.worldObj.spawnParticle( "smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );
}
}
// 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 );
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 ) ))
{
if ( e instanceof Entity )
{
((Entity) e).attackEntityFrom( DamageSource.setExplosionSource( null ), 6 );
}
}
if ( AEConfig.instance.isFeatureEnabled( AEFeature.TinyTNTBlockDamage ) )
{
posY -= 0.25;
Explosion ex = new Explosion( worldObj, this, posX, posY, posZ, 0.2f );
for (int x = (int) (posX - 2); x <= posX + 2; x++)
{
for (int y = (int) (posY - 2); y <= posY + 2; y++)
{
for (int z = (int) (posZ - 2); z <= posZ + 2; z++)
{
Block block = worldObj.getBlock( x, y, z );
if ( block != null && !block.isAir( worldObj, x, y, z ) )
{
float strength = (float) (2.3f - (((x + 0.5f) - posX) * ((x + 0.5f) - posX) + ((y + 0.5f) - posY) * ((y + 0.5f) - posY) + ((z + 0.5f) - posZ)
* ((z + 0.5f) - posZ)));
float resistance = block.getExplosionResistance( this, worldObj, x, y, z, posX, posY, posZ );
strength -= (resistance + 0.3F) * 0.11f;
if ( strength > 0.01 )
{
if ( block.getMaterial() != Material.air )
{
if ( block.canDropFromExplosion( ex ) )
{
block.dropBlockAsItemWithChance( this.worldObj, x, y, z, this.worldObj.getBlockMetadata( x, y, z ), 1.0F / 1.0f, 0 );
}
block.onBlockExploded( this.worldObj, x, y, z, ex );
}
}
}
}
}
}
}
try
{
CommonHelper.proxy.sendToAllNearExcept( null, posX, posY, posZ, 64, this.worldObj, new PacketMockExplosion( posX, posY, posZ ) );
}
catch (IOException e1)
{
}
}
@Override
public void writeSpawnData(ByteBuf data)
{
data.writeByte( fuse );
}
@Override
public void readSpawnData(ByteBuf data)
{
fuse = data.readByte();
}
}
@@ -0,0 +1,52 @@
package appeng.entity;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderFloatingItem extends RenderItem
{
public static DoubleBuffer buffer = ByteBuffer.allocateDirect( 8 * 4 ).asDoubleBuffer();
public RenderFloatingItem() {
this.shadowOpaque = 0.0F;
this.renderManager = RenderManager.instance;
}
@Override
public boolean shouldBob()
{
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 )
{
EntityFloatingItem efi = (EntityFloatingItem) p_76986_1_;
if ( efi.progress > 0.0 )
{
GL11.glPushMatrix();
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_ );
GL11.glPopMatrix();
}
}
}
}
@@ -0,0 +1,87 @@
package appeng.entity;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderTinyTNTPrimed extends Render
{
private RenderBlocks blockRenderer = new RenderBlocks();
public RenderTinyTNTPrimed() {
this.shadowSize = 0.5F;
this.renderManager = RenderManager.instance;
}
public void renderPrimedTNT(EntityTinyTNTPrimed tnt, double x, double y, double z, float var1, float life)
{
GL11.glPushMatrix();
GL11.glTranslatef( (float) x, (float) y - 0.25f, (float) z );
float f2;
if ( (float) tnt.fuse - life + 1.0F < 10.0F )
{
f2 = 1.0F - ((float) tnt.fuse - life + 1.0F) / 10.0F;
if ( f2 < 0.0F )
{
f2 = 0.0F;
}
if ( f2 > 1.0F )
{
f2 = 1.0F;
}
f2 *= f2;
f2 *= f2;
float f3 = 1.0F + f2 * 0.3F;
GL11.glScalef( f3, f3, f3 );
}
GL11.glScalef( 0.5f, 0.5f, 0.5f );
f2 = (1.0F - ((float) 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 )
{
GL11.glDisable( GL11.GL_TEXTURE_2D );
GL11.glDisable( GL11.GL_LIGHTING );
GL11.glEnable( GL11.GL_BLEND );
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, f2 );
this.blockRenderer.renderBlockAsItem( Blocks.tnt, 0, 1.0F );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
GL11.glDisable( GL11.GL_BLEND );
GL11.glEnable( GL11.GL_LIGHTING );
GL11.glEnable( GL11.GL_TEXTURE_2D );
}
GL11.glPopMatrix();
}
@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderPrimedTNT( (EntityTinyTNTPrimed) par1Entity, par2, par4, par6, par8, par9 );
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return TextureMap.locationBlocksTexture;
}
}