Most of the 1.8 Port.

This commit is contained in:
AlgorithmX2
2015-06-15 19:44:59 -05:00
parent 17465e68e8
commit 38afde724b
824 changed files with 12120 additions and 9158 deletions
@@ -27,9 +27,9 @@ 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.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
import appeng.client.EffectType;
@@ -78,7 +78,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
int i = MathHelper.floor_double( this.posY );
int k = MathHelper.floor_double( this.posZ );
Material mat = this.worldObj.getBlock( j, i, k ).getMaterial();
Material mat = this.worldObj.getBlockState( new BlockPos( j, i, k ) ).getBlock().getMaterial();
if( Platform.isServer() && mat.isLiquid() )
{
this.transformTime++;
@@ -103,7 +103,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
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 );
AxisAlignedBB region = AxisAlignedBB.fromBounds( this.posX - 1, this.posY - 1, this.posZ - 1, this.posX + 1, this.posY + 1, this.posZ + 1 );
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
EntityItem redstone = null;
@@ -28,7 +28,6 @@ import net.minecraft.world.World;
public final class EntityFloatingItem extends EntityItem
{
public static int ageStatic = 0;
private final Entity parent;
int superDeath = 0;
float progress = 0;
@@ -58,7 +57,7 @@ public final class EntityFloatingItem extends EntityItem
}
this.superDeath++;
this.age = ageStatic;
this.setNoDespawn();
}
public void setProgress( float progress )
@@ -25,9 +25,9 @@ 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.BlockPos;
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;
@@ -50,6 +50,7 @@ public final class EntityGrowingCrystal extends EntityItem
public EntityGrowingCrystal( World w, double x, double y, double z, ItemStack is )
{
super( w, x, y, z, is );
this.setNoDespawn();
}
@Override
@@ -61,12 +62,7 @@ public final class EntityGrowingCrystal extends EntityItem
{
return;
}
if( this.age > 600 )
{
this.age = 100;
}
ItemStack is = this.getEntityItem();
Item gc = is.getItem();
@@ -76,7 +72,7 @@ public final class EntityGrowingCrystal extends EntityItem
int i = MathHelper.floor_double( this.posY );
int k = MathHelper.floor_double( this.posZ );
Block blk = this.worldObj.getBlock( j, i, k );
Block blk = this.worldObj.getBlockState( new BlockPos( j, i, k ) ).getBlock();
Material mat = blk.getMaterial();
IGrowableCrystal cry = (IGrowableCrystal) is.getItem();
@@ -194,7 +190,7 @@ public final class EntityGrowingCrystal extends EntityItem
private boolean isAccelerated( int x, int y, int z )
{
TileEntity te = this.worldObj.getTileEntity( x, y, z );
TileEntity te = this.worldObj.getTileEntity( new BlockPos( x, y, z ) );
return te instanceof ICrystalGrowthAccelerator && ( (ICrystalGrowthAccelerator) te ).isPowered();
}
@@ -30,7 +30,6 @@ 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.api.definitions.IMaterials;
import appeng.core.AEConfig;
@@ -85,7 +84,7 @@ public final class EntitySingularity extends AEBaseEntityItem
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 );
AxisAlignedBB region = AxisAlignedBB.fromBounds( this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4 );
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
for( Entity e : l )
@@ -20,21 +20,21 @@ package appeng.entity;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
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.item.EntityItem;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
import appeng.api.AEApi;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
@@ -57,7 +57,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
{
super( w, x, y, z, igniter );
this.setSize( 0.55F, 0.55F );
this.yOffset = this.height / 2.0F;
//this.yOffset = this.height / 2.0F;
}
/**
@@ -113,7 +113,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
}
else
{
this.worldObj.spawnParticle( "smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );
this.worldObj.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );
}
this.fuse--;
}
@@ -128,7 +128,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
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 ) ) )
for( Object e : this.worldObj.getEntitiesWithinAABBExcludingEntity( this, AxisAlignedBB.fromBounds( 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 )
{
@@ -139,7 +139,7 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
if( AEConfig.instance.isFeatureEnabled( AEFeature.TinyTNTBlockDamage ) )
{
this.posY -= 0.25;
Explosion ex = new Explosion( this.worldObj, this, this.posX, this.posY, this.posZ, 0.2f );
Explosion ex = new Explosion( this.worldObj, this, this.posX, this.posY, this.posZ, 0.2f, false, false );
for( int x = (int) ( this.posX - 2 ); x <= this.posX + 2; x++ )
{
@@ -147,12 +147,14 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
{
for( int z = (int) ( this.posZ - 2 ); z <= this.posZ + 2; z++ )
{
Block block = this.worldObj.getBlock( x, y, z );
if( block != null && !block.isAir( this.worldObj, x, y, z ) )
BlockPos point = new BlockPos( x,y,z);
IBlockState state = this.worldObj.getBlockState( point );
Block block = state.getBlock();
if( block != null && !block.isAir( this.worldObj, 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 resistance = block.getExplosionResistance( this, this.worldObj, x, y, z, this.posX, this.posY, this.posZ );
float resistance = block.getExplosionResistance( this.worldObj, point, this, ex );
strength -= ( resistance + 0.3F ) * 0.11f;
if( strength > 0.01 )
@@ -161,10 +163,10 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
{
if( block.canDropFromExplosion( ex ) )
{
block.dropBlockAsItemWithChance( this.worldObj, x, y, z, this.worldObj.getBlockMetadata( x, y, z ), 1.0F / 1.0f, 0 );
block.dropBlockAsItemWithChance( this.worldObj, point, state, 1.0F / 1.0f, 0 );
}
block.onBlockExploded( this.worldObj, x, y, z, ex );
block.onBlockExploded( this.worldObj, point, ex );
}
}
}
@@ -22,31 +22,37 @@ package appeng.entity;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@SideOnly( Side.CLIENT )
public class RenderFloatingItem extends RenderItem
public class RenderFloatingItem extends RenderEntityItem
{
public static DoubleBuffer buffer = ByteBuffer.allocateDirect( 8 * 4 ).asDoubleBuffer();
public RenderFloatingItem()
public RenderFloatingItem(RenderManager manager)
{
super(manager,Minecraft.getMinecraft().getRenderItem());
this.shadowOpaque = 0.0F;
this.renderManager = RenderManager.instance;
}
@Override
public void doRender( EntityItem entityItem, double x, double y, double z, float yaw, float partialTick )
public void doRender(
Entity entityItem,
double x,
double y,
double z,
float yaw,
float partialTick )
{
if( entityItem instanceof EntityFloatingItem )
{
@@ -19,42 +19,46 @@
package appeng.entity;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
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.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.client.render.IRenderHelper;
@SideOnly( Side.CLIENT )
public class RenderTinyTNTPrimed extends Render
{
private final RenderBlocks blockRenderer = new RenderBlocks();
private final IRenderHelper blockRenderer = new IRenderHelper();
public RenderTinyTNTPrimed()
{
public RenderTinyTNTPrimed(RenderManager p_i46134_1_)
{
super(p_i46134_1_);
this.shadowSize = 0.5F;
this.renderManager = RenderManager.instance;
}
@Override
public void doRender( Entity tnt, double x, double y, double z, float unused, float life )
{
this.renderPrimedTNT( (EntityTinyTNTPrimed) tnt, x, y, z, life );
this.renderPrimedTNT( (EntityTinyTNTPrimed) tnt, x, y, z, unused, life );
}
public void renderPrimedTNT( EntityTinyTNTPrimed tnt, double x, double y, double z, float life )
public void renderPrimedTNT( EntityTinyTNTPrimed tnt, double x, double y, double z, float unused, float life )
{
GL11.glPushMatrix();
GL11.glTranslatef( (float) x, (float) y - 0.25f, (float) z );
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float)x, (float)y + 0.5F, (float)z);
float f2;
if( tnt.fuse - life + 1.0F < 10.0F )
@@ -78,25 +82,32 @@ public class RenderTinyTNTPrimed extends Render
}
GL11.glScalef( 0.5f, 0.5f, 0.5f );
f2 = ( 1.0F - ( tnt.fuse - life + 1.0F ) / 100.0F ) * 0.8F;
this.bindEntityTexture( tnt );
this.blockRenderer.renderBlockAsItem( Blocks.tnt, 0, tnt.getBrightness( life ) );
f2 = (1.0F - (tnt.fuse - 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(life));
GlStateManager.translate(0.0F, 0.0F, 1.0F);
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 );
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();
}
GL11.glPopMatrix();
GlStateManager.popMatrix();
super.doRender(tnt, x, y, z, unused, life );
}
@Override