1.8.8 + deleted all integration can be recovered later or something.
This commit is contained in:
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
|
||||
public class AEBaseSlabBlock extends BlockSlab implements IAEFeature
|
||||
{
|
||||
private final IFeatureHandler features;
|
||||
private final AEBaseBlock block;
|
||||
private final int meta;
|
||||
private AEBaseSlabBlock slabs;
|
||||
private AEBaseSlabBlock doubleSlabs;
|
||||
private final String name;
|
||||
|
||||
public AEBaseSlabBlock( final AEBaseBlock block, final int meta, final EnumSet<AEFeature> features, final boolean isDoubleSlab, final String name )
|
||||
{
|
||||
super( isDoubleSlab, block.getMaterial() );
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.name = name;
|
||||
this.setBlockName( "appliedenergistics2." + name );
|
||||
this.setHardness( block.getBlockHardness( null, 0, 0, 0 ) );
|
||||
this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F );
|
||||
this.setStepSound( block.stepSound );
|
||||
this.useNeighborBrightness = true;
|
||||
if( !this.field_150004_a )
|
||||
{
|
||||
this.doubleSlabs = new AEBaseSlabBlock( block, meta, features, true, name + ".double" ).setSlabs( this );
|
||||
}
|
||||
this.features = !this.field_150004_a ? new SlabBlockFeatureHandler( features, this ) : null;
|
||||
}
|
||||
|
||||
private AEBaseSlabBlock setSlabs( final AEBaseSlabBlock slabs )
|
||||
{
|
||||
this.slabs = slabs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AEBaseSlabBlock slabs()
|
||||
{
|
||||
return this.slabs;
|
||||
}
|
||||
|
||||
public AEBaseSlabBlock doubleSlabs()
|
||||
{
|
||||
return this.doubleSlabs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// Override to do stuff
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAESprite getIcon( final int dir, final int meta )
|
||||
{
|
||||
return this.block.getIcon( dir, this.meta );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String func_150002_b( final int p_150002_1_ )
|
||||
{
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( final IIconRegister reg )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped( final int meta, final Random rand, final int fortune )
|
||||
{
|
||||
return this.field_150004_a ? Item.getItemFromBlock( this.slabs ) : Item.getItemFromBlock( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock( final MovingObjectPosition target, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock( x, y, z );
|
||||
|
||||
if( block == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( block.field_150004_a )
|
||||
{
|
||||
block = this.slabs;
|
||||
}
|
||||
|
||||
final int meta = world.getBlockMetadata( x, y, z ) & 7;
|
||||
return new ItemStack( block, 1, meta );
|
||||
}
|
||||
|
||||
public String name()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,19 @@
|
||||
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.blocks.RenderQuartzTorch;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileLightDetector;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -36,16 +43,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.blocks.RenderQuartzTorch;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileLightDetector;
|
||||
|
||||
|
||||
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
|
||||
{
|
||||
|
||||
@@ -53,12 +50,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
{
|
||||
super( Material.circuits );
|
||||
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
setLightOpacity( 0 );
|
||||
setFullSize( false );
|
||||
setOpaque( false );
|
||||
|
||||
this.setTileEntity( TileLightDetector.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.LightDetector ) );
|
||||
setTileEntity( TileLightDetector.class );
|
||||
setFeature( EnumSet.of( AEFeature.LightDetector ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +69,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
public IBlockState getStateFromMeta(
|
||||
final int meta )
|
||||
{
|
||||
return this.getDefaultState();
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,13 +79,13 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(
|
||||
public int getWeakPower(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos,
|
||||
final IBlockState state,
|
||||
final EnumFacing side )
|
||||
{
|
||||
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
|
||||
if ( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
|
||||
{
|
||||
return ( (World) w ).getLightFromNeighbors( pos ) - 6;
|
||||
}
|
||||
@@ -105,7 +102,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
super.onNeighborChange( world, pos, neighbor );
|
||||
|
||||
final TileLightDetector tld = this.getTileEntity( world, pos );
|
||||
if( tld != null )
|
||||
if ( tld != null )
|
||||
{
|
||||
tld.updateLight();
|
||||
}
|
||||
@@ -134,10 +131,13 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
final EnumFacing forward,
|
||||
final EnumFacing up )
|
||||
{
|
||||
return this.canPlaceAt( w, pos, up.getOpposite() );
|
||||
return canPlaceAt( w, pos, up.getOpposite() );
|
||||
}
|
||||
|
||||
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
|
||||
private boolean canPlaceAt(
|
||||
final World w,
|
||||
final BlockPos pos,
|
||||
final EnumFacing dir )
|
||||
{
|
||||
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
final Entity thePlayer,
|
||||
final boolean b )
|
||||
{
|
||||
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||
final EnumFacing up = getOrientable( w, pos ).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
@@ -164,10 +164,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
final List<AxisAlignedBB> out,
|
||||
final Entity e )
|
||||
{/*
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
|
||||
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15, zOff
|
||||
* + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||
*/
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
|
||||
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
|
||||
* AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff +
|
||||
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x
|
||||
* + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,14 +179,16 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
final IBlockState state,
|
||||
final Block neighborBlock )
|
||||
{
|
||||
final EnumFacing up = this.getOrientable( w, pos ).getUp();
|
||||
if( !this.canPlaceAt( w, pos, up.getOpposite() ) )
|
||||
final EnumFacing up = getOrientable( w, pos ).getUp();
|
||||
if ( !canPlaceAt( w, pos, up.getOpposite() ) )
|
||||
{
|
||||
this.dropTorch( w, pos );
|
||||
dropTorch( w, pos );
|
||||
}
|
||||
}
|
||||
|
||||
private void dropTorch( final World w, final BlockPos pos )
|
||||
private void dropTorch(
|
||||
final World w,
|
||||
final BlockPos pos )
|
||||
{
|
||||
w.destroyBlock( pos, true );
|
||||
w.markBlockForUpdate( pos );
|
||||
@@ -195,9 +199,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
final World w,
|
||||
final BlockPos pos )
|
||||
{
|
||||
for( final EnumFacing dir : EnumFacing.VALUES )
|
||||
for ( final EnumFacing dir : EnumFacing.VALUES )
|
||||
{
|
||||
if( this.canPlaceAt( w, pos, dir ) )
|
||||
if ( canPlaceAt( w, pos, dir ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -212,7 +216,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
|
||||
public IOrientable getOrientable(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos )
|
||||
{
|
||||
return new MetaRotation( w, pos, true );
|
||||
}
|
||||
|
||||
@@ -18,33 +18,10 @@
|
||||
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
@@ -68,11 +45,32 @@ import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.networking.TileCableBusTESR;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
// TODO: MFR INTEGRATION
|
||||
//@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = IntegrationType.MFR )
|
||||
public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnection
|
||||
public class BlockCableBus extends AEBaseTileBlock // implements
|
||||
// IRedNetConnection
|
||||
{
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
@@ -82,8 +80,10 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
/**
|
||||
* Immibis MB Support.
|
||||
*
|
||||
* It will look for a field named ImmibisMicroblocks_TransformableBlockMarker or
|
||||
* ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc can be ignored.
|
||||
* It will look for a field named
|
||||
* ImmibisMicroblocks_TransformableBlockMarker or
|
||||
* ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc
|
||||
* can be ignored.
|
||||
*/
|
||||
@Reflected
|
||||
private static final boolean ImmibisMicroblocks_TransformableBlockMarker = true;
|
||||
@@ -91,12 +91,13 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
public BlockCableBus()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
setLightOpacity( 0 );
|
||||
setFullSize( setOpaque( false ) );
|
||||
|
||||
// this will actually be overwritten later through setupTile and the combined layers
|
||||
this.setTileEntity( TileCableBus.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
// this will actually be overwritten later through setupTile and the
|
||||
// combined layers
|
||||
setTileEntity( TileCableBus.class );
|
||||
setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,7 +107,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final IBlockState state,
|
||||
final Random rand )
|
||||
{
|
||||
this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
|
||||
cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +116,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final BlockPos pos,
|
||||
final BlockPos neighbor )
|
||||
{
|
||||
this.cb( w, pos ).onNeighborChanged();
|
||||
cb( w, pos ).onNeighborChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,13 +129,15 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(
|
||||
public int getWeakPower(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos,
|
||||
final IBlockState state,
|
||||
final EnumFacing side )
|
||||
{
|
||||
return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO: IS OPPOSITE!?
|
||||
return cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO:
|
||||
// IS
|
||||
// OPPOSITE!?
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,17 +153,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final IBlockState state,
|
||||
final Entity entityIn )
|
||||
{
|
||||
this.cb( w, pos ).onEntityCollision( entityIn );
|
||||
cb( w, pos ).onEntityCollision( entityIn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(
|
||||
public int getStrongPower(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos,
|
||||
final IBlockState state,
|
||||
final EnumFacing side )
|
||||
{
|
||||
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!?
|
||||
return cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO:
|
||||
// IS
|
||||
// OPPOSITE!?
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,27 +174,33 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final BlockPos pos )
|
||||
{
|
||||
final IBlockState block = world.getBlockState( pos );
|
||||
if( block != null && block.getBlock() != this )
|
||||
if ( block != null && block.getBlock() != this )
|
||||
{
|
||||
return block.getBlock().getLightValue( world, pos );
|
||||
}
|
||||
if( block == null )
|
||||
if ( block == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return this.cb( world, pos ).getLightValue();
|
||||
return cb( world, pos ).getLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLadder( final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity )
|
||||
public boolean isLadder(
|
||||
final IBlockAccess world,
|
||||
final BlockPos pos,
|
||||
final EntityLivingBase entity )
|
||||
{
|
||||
return this.cb( world, pos ).isLadder( entity );
|
||||
return cb( world, pos ).isLadder( entity );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid( final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||
public boolean isSideSolid(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side )
|
||||
{
|
||||
return this.cb( w, pos ).isSolidOnSide( side );
|
||||
return cb( w, pos ).isSolidOnSide( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,7 +208,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final World w,
|
||||
final BlockPos pos )
|
||||
{
|
||||
return this.cb( w, pos ).isEmpty();
|
||||
return cb( w, pos ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -207,10 +218,10 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final EntityPlayer player,
|
||||
final boolean willHarvest )
|
||||
{
|
||||
if( player.capabilities.isCreativeMode )
|
||||
if ( player.capabilities.isCreativeMode )
|
||||
{
|
||||
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
if( tile != null )
|
||||
if ( tile != null )
|
||||
{
|
||||
tile.disableDrops();
|
||||
}
|
||||
@@ -225,19 +236,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final BlockPos pos,
|
||||
EnumFacing side )
|
||||
{
|
||||
if( side == null )
|
||||
if ( side == null )
|
||||
{
|
||||
side = EnumFacing.UP;
|
||||
}
|
||||
|
||||
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
|
||||
return cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(
|
||||
final EnumWorldBlockLayer layer )
|
||||
{
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
|
||||
{
|
||||
return layer == EnumWorldBlockLayer.CUTOUT || layer == EnumWorldBlockLayer.TRANSLUCENT;
|
||||
}
|
||||
@@ -252,13 +263,13 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final BlockPos pos )
|
||||
{
|
||||
final Vec3 v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() );
|
||||
final SelectedPart sp = this.cb( world, pos ).selectPart( v3 );
|
||||
final SelectedPart sp = cb( world, pos ).selectPart( v3 );
|
||||
|
||||
if( sp.part != null )
|
||||
if ( sp.part != null )
|
||||
{
|
||||
return sp.part.getItemStack( PartItemStack.Pick );
|
||||
}
|
||||
else if( sp.facade != null )
|
||||
else if ( sp.facade != null )
|
||||
{
|
||||
return sp.facade.getItemStack();
|
||||
}
|
||||
@@ -268,45 +279,33 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public boolean addHitEffects( final World world, final MovingObjectPosition target, final EffectRenderer effectRenderer )
|
||||
public boolean addHitEffects(
|
||||
final World world,
|
||||
final MovingObjectPosition target,
|
||||
final EffectRenderer effectRenderer )
|
||||
{
|
||||
final Object object = this.cb( world, target.getBlockPos() );
|
||||
if( object instanceof IPartHost )
|
||||
final Object object = cb( world, target.getBlockPos() );
|
||||
if ( object instanceof IPartHost )
|
||||
{
|
||||
final IPartHost host = (IPartHost) object;
|
||||
|
||||
// TODO HIT EFFECTS
|
||||
/*
|
||||
* for( AEPartLocation side : AEPartLocation.values() )
|
||||
* {
|
||||
* IPart p = host.getPart( side );
|
||||
* TextureAtlasSprite ico = this.getIcon( p );
|
||||
* if( ico == null )
|
||||
* {
|
||||
* continue;
|
||||
* }
|
||||
* byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 );
|
||||
* for( int i1 = 0; i1 < b0; ++i1 )
|
||||
* {
|
||||
* for( int j1 = 0; j1 < b0; ++j1 )
|
||||
* {
|
||||
* for( int k1 = 0; k1 < b0; ++k1 )
|
||||
* {
|
||||
* double d0 = target.blockX + ( i1 + 0.5D ) / b0;
|
||||
* double d1 = target.blockY + ( j1 + 0.5D ) / b0;
|
||||
* double d2 = target.blockZ + ( k1 + 0.5D ) / b0;
|
||||
* double dd0 = target.hitVec.xCoord;
|
||||
* double dd1 = target.hitVec.yCoord;
|
||||
* double dd2 = target.hitVec.zCoord;
|
||||
* EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 -
|
||||
* target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX,
|
||||
* target.blockY, target.blockZ );
|
||||
* fx.setParticleIcon( ico );
|
||||
* effectRenderer.addEffect( fx );
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* for( AEPartLocation side : AEPartLocation.values() ) { IPart p =
|
||||
* host.getPart( side ); TextureAtlasSprite ico = this.getIcon( p );
|
||||
* if( ico == null ) { continue; } byte b0 = (byte) (
|
||||
* Platform.getRandomInt() % 2 == 0 ? 1 : 0 ); for( int i1 = 0; i1 <
|
||||
* b0; ++i1 ) { for( int j1 = 0; j1 < b0; ++j1 ) { for( int k1 = 0;
|
||||
* k1 < b0; ++k1 ) { double d0 = target.blockX + ( i1 + 0.5D ) / b0;
|
||||
* double d1 = target.blockY + ( j1 + 0.5D ) / b0; double d2 =
|
||||
* target.blockZ + ( k1 + 0.5D ) / b0; double dd0 =
|
||||
* target.hitVec.xCoord; double dd1 = target.hitVec.yCoord; double
|
||||
* dd2 = target.hitVec.zCoord; EntityDiggingFX fx = ( new
|
||||
* EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D,
|
||||
* d1 - target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 )
|
||||
* ).applyColourMultiplier( target.blockX, target.blockY,
|
||||
* target.blockZ ); fx.setParticleIcon( ico );
|
||||
* effectRenderer.addEffect( fx ); } } } }
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -319,39 +318,23 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final BlockPos pos,
|
||||
final EffectRenderer effectRenderer )
|
||||
{
|
||||
final Object object = this.cb( world, pos );
|
||||
if( object instanceof IPartHost )
|
||||
final Object object = cb( world, pos );
|
||||
if ( object instanceof IPartHost )
|
||||
{
|
||||
final IPartHost host = (IPartHost) object;
|
||||
|
||||
// TODO DESTROY EFFECTS
|
||||
/*
|
||||
* for( AEPartLocation side : AEPartLocation.values() )
|
||||
* {
|
||||
* IPart p = host.getPart( side );
|
||||
* TextureAtlasSprite ico = this.getIcon( p );
|
||||
* if( ico == null )
|
||||
* {
|
||||
* continue;
|
||||
* }
|
||||
* byte b0 = 3;
|
||||
* for( int i1 = 0; i1 < b0; ++i1 )
|
||||
* {
|
||||
* for( int j1 = 0; j1 < b0; ++j1 )
|
||||
* {
|
||||
* for( int k1 = 0; k1 < b0; ++k1 )
|
||||
* {
|
||||
* double d0 = x + ( i1 + 0.5D ) / b0;
|
||||
* double d1 = y + ( j1 + 0.5D ) / b0;
|
||||
* double d2 = z + ( k1 + 0.5D ) / b0;
|
||||
* EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z -
|
||||
* 0.5D, this, meta ) ).applyColourMultiplier( x, y, z );
|
||||
* fx.setParticleIcon( ico );
|
||||
* effectRenderer.addEffect( fx );
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* for( AEPartLocation side : AEPartLocation.values() ) { IPart p =
|
||||
* host.getPart( side ); TextureAtlasSprite ico = this.getIcon( p );
|
||||
* if( ico == null ) { continue; } byte b0 = 3; for( int i1 = 0; i1
|
||||
* < b0; ++i1 ) { for( int j1 = 0; j1 < b0; ++j1 ) { for( int k1 =
|
||||
* 0; k1 < b0; ++k1 ) { double d0 = x + ( i1 + 0.5D ) / b0; double
|
||||
* d1 = y + ( j1 + 0.5D ) / b0; double d2 = z + ( k1 + 0.5D ) / b0;
|
||||
* EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0
|
||||
* - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, meta )
|
||||
* ).applyColourMultiplier( x, y, z ); fx.setParticleIcon( ico );
|
||||
* effectRenderer.addEffect( fx ); } } } }
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -365,22 +348,24 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final IBlockState state,
|
||||
final Block neighborBlock )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.cb( w, pos ).onNeighborChanged();
|
||||
cb( w, pos ).onNeighborChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private ICableBusContainer cb( final IBlockAccess w, final BlockPos pos )
|
||||
private ICableBusContainer cb(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
ICableBusContainer out = null;
|
||||
|
||||
if( te instanceof TileCableBus )
|
||||
if ( te instanceof TileCableBus )
|
||||
{
|
||||
out = ( (TileCableBus) te ).getCableBus();
|
||||
}
|
||||
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
else if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
|
||||
{
|
||||
out = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getCableContainer( te );
|
||||
}
|
||||
@@ -404,7 +389,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
return this.cb( w, pos ).activate( player, new Vec3( hitX, hitY, hitZ ) );
|
||||
return cb( w, pos ).activate( player, new Vec3( hitX, hitY, hitZ ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,9 +411,9 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
|
||||
return cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
catch ( final Throwable ignored )
|
||||
{
|
||||
}
|
||||
return false;
|
||||
@@ -436,22 +421,27 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
|
||||
public void getCheckedSubBlocks(
|
||||
final Item item,
|
||||
final CreativeTabs tabs,
|
||||
final List<ItemStack> itemStacks )
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final BlockPos pos )
|
||||
public <T extends AEBaseTile> T getTileEntity(
|
||||
final IBlockAccess w,
|
||||
final BlockPos pos )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
|
||||
if( noTesrTile.isInstance( te ) )
|
||||
if ( noTesrTile.isInstance( te ) )
|
||||
{
|
||||
return (T) te;
|
||||
}
|
||||
|
||||
if( tesrTile != null && tesrTile.isInstance( te ) )
|
||||
if ( tesrTile != null && tesrTile.isInstance( te ) )
|
||||
{
|
||||
return (T) te;
|
||||
}
|
||||
@@ -460,18 +450,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
protected void setFeature(
|
||||
final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, getFeatureSubName() );
|
||||
setHandler( featureHandler );
|
||||
}
|
||||
|
||||
public void setupTile()
|
||||
{
|
||||
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() );
|
||||
this.setTileEntity( noTesrTile );
|
||||
setTileEntity( noTesrTile );
|
||||
GameRegistry.registerTileEntity( noTesrTile, "BlockCableBus" );
|
||||
if( Platform.isClient() )
|
||||
if ( Platform.isClient() )
|
||||
{
|
||||
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
|
||||
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
|
||||
@@ -492,9 +483,11 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
|
||||
// TODO MFR Integration
|
||||
// @Override
|
||||
// @Method( iname = IntegrationType.MFR )
|
||||
// public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side )
|
||||
// public RedNetConnectionType getConnectionType( World world, int x, int y,
|
||||
// int z, ForgeDirection side )
|
||||
// {
|
||||
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ?
|
||||
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf(
|
||||
// ForgeDirection.class ) ) ?
|
||||
// RedNetConnectionType.CableSingle : RedNetConnectionType.None;
|
||||
// }
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user