Most of the 1.8 Port.
This commit is contained in:
@@ -23,14 +23,17 @@ import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
@@ -49,14 +52,14 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
this.setHardness( 4.2F );
|
||||
this.setFeature( EnumSet.of( AEFeature.PowerGen ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon( IBlockAccess w, int x, int y, int z, int s )
|
||||
public appeng.client.texture.IAESprite getIcon(IBlockAccess w, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
IIcon ico = super.getIcon( w, x, y, z, s );
|
||||
TileVibrationChamber tvc = this.getTileEntity( w, x, y, z );
|
||||
IAESprite ico = super.getIcon( w, pos, side );
|
||||
TileVibrationChamber tvc = this.getTileEntity( w, pos );
|
||||
|
||||
if( tvc != null && tvc.isOn && ico == this.getRendererInstance().getTexture( ForgeDirection.SOUTH ) )
|
||||
if( tvc != null && tvc.isOn && ico == this.getRendererInstance().getTexture( AEPartLocation.SOUTH ) )
|
||||
{
|
||||
return ExtraBlockTextures.BlockVibrationChamberFrontOn.getIcon();
|
||||
}
|
||||
@@ -65,7 +68,14 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onActivated(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
EntityPlayer player,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
@@ -74,10 +84,10 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
TileVibrationChamber tc = this.getTileEntity( w, x, y, z );
|
||||
TileVibrationChamber tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isSneaking() )
|
||||
{
|
||||
Platform.openGUI( player, tc, ForgeDirection.getOrientation( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -86,47 +96,51 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( World w, int x, int y, int z, Random r )
|
||||
public void randomDisplayTick(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
Random r )
|
||||
{
|
||||
if( !AEConfig.instance.enableEffects )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AEBaseTile tile = this.getTileEntity( w, x, y, z );
|
||||
AEBaseTile tile = this.getTileEntity( w, pos );
|
||||
if( tile instanceof TileVibrationChamber )
|
||||
{
|
||||
TileVibrationChamber tc = (TileVibrationChamber) tile;
|
||||
if( tc.isOn )
|
||||
{
|
||||
float f1 = x + 0.5F;
|
||||
float f2 = y + 0.5F;
|
||||
float f3 = z + 0.5F;
|
||||
float f1 = pos.getX() + 0.5F;
|
||||
float f2 = pos.getY() + 0.5F;
|
||||
float f3 = pos.getZ() + 0.5F;
|
||||
|
||||
ForgeDirection forward = tc.getForward();
|
||||
ForgeDirection up = tc.getUp();
|
||||
EnumFacing forward = tc.getForward();
|
||||
EnumFacing up = tc.getUp();
|
||||
|
||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
|
||||
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
|
||||
int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||
int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
|
||||
f1 += forward.offsetX * 0.6;
|
||||
f2 += forward.offsetY * 0.6;
|
||||
f3 += forward.offsetZ * 0.6;
|
||||
f1 += forward.getFrontOffsetX() * 0.6;
|
||||
f2 += forward.getFrontOffsetY() * 0.6;
|
||||
f3 += forward.getFrontOffsetZ() * 0.6;
|
||||
|
||||
float ox = r.nextFloat();
|
||||
float oy = r.nextFloat() * 0.2f;
|
||||
|
||||
f1 += up.offsetX * ( -0.3 + oy );
|
||||
f2 += up.offsetY * ( -0.3 + oy );
|
||||
f3 += up.offsetZ * ( -0.3 + oy );
|
||||
f1 += up.getFrontOffsetX() * ( -0.3 + oy );
|
||||
f2 += up.getFrontOffsetY() * ( -0.3 + oy );
|
||||
f3 += up.getFrontOffsetZ() * ( -0.3 + oy );
|
||||
|
||||
f1 += west_x * ( 0.3 * ox - 0.15 );
|
||||
f2 += west_y * ( 0.3 * ox - 0.15 );
|
||||
f3 += west_z * ( 0.3 * ox - 0.15 );
|
||||
|
||||
w.spawnParticle( "smoke", f1, f2, f3, 0.0D, 0.0D, 0.0D );
|
||||
w.spawnParticle( "flame", f1, f2, f3, 0.0D, 0.0D, 0.0D );
|
||||
w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
|
||||
w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user