public List<ItemStack> getFilter() { List<ItemStack> filter = new ArrayList<>(); for(EnumFacing dir : EnumFacing.HORIZONTALS) { List<EntityItemFrame> frames = world.getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1))); for(EntityItemFrame frame : frames) { EnumFacing orientation = frame.facingDirection; if(orientation == dir) filter.add(frame.getDisplayedItem()); } } return filter; }
@Override public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) { if (world.getBlockState(pos.offset(side)).getBlock() == this) { return false; } return super.shouldSideBeRendered(state, world, pos, side); }
@Override public void onPlayerDestroy(World world, BlockPos pos, IBlockState state) { // TE is already gone so best we can do is just notify everyone for(EnumFacing side : EnumFacing.VALUES) { world.notifyNeighborsOfStateChange(pos.offset(side), this, false); } super.onPlayerDestroy(world, pos, state); }
private boolean isConnected( IBlockAccess world, BlockPos pos, EnumFacing side ) { BlockPos adjacentPos = pos.offset( side ); return world.getBlockState( adjacentPos ).getBlock() instanceof BlockCraftingUnit; }
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir ) { final BlockPos test = pos.offset( dir ); return w.isSideSolid( test, dir.getOpposite(), false ); }
@SideOnly(Side.CLIENT) @Override public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) { Block block = world.getBlockState(pos.offset(side)).getBlock(); return block == this ? false : super.shouldSideBeRendered(state, world, pos, side); }
private boolean isCrankable( final World world, final BlockPos pos, final EnumFacing offset ) { final BlockPos o = pos.offset( offset ); final TileEntity te = world.getTileEntity( o ); return te instanceof ICrankable && ( (ICrankable) te ).canCrankAttach( offset.getOpposite() ); }
void swapSurroudings(TilePlatform tile, boolean empty) { for(EnumFacing dir : EnumFacing.VALUES) { BlockPos pos = tile.getPos().offset(dir); TileEntity tileAt = world.getTileEntity(pos); if(tileAt != null && tileAt instanceof TilePlatform) { TilePlatform platform = (TilePlatform) tileAt; if(empty ? platform.camoState != null : platform.camoState == null) swapSelfAndPass(platform, empty); } } }
public void onPlace(EntityLivingBase entity) { if(entity != null) { side = Arrays.asList(SIDES).indexOf(entity.getHorizontalFacing().getOpposite()); } world.notifyNeighborsOfStateChange(getPos().offset(SIDES[side].getOpposite()), getBlockType(), false); }
@Override public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor ) { if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) ) { this.refresh(); } }
@Override public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor ) { if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) ) { this.opacity = -1; this.getHost().markForUpdate(); } }
public boolean isSideValid( final EnumFacing side ) { final BlockPos p = this.pos.offset( side ); final IBlockState blk = this.world.getBlockState( p ); return blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ); }
@Override public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor ) { if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) ) { final TileEntity te = this.getHost().getTile(); final AEPartLocation side = this.getSide(); final BlockPos tePos = te.getPos().offset( side.getFacing() ); this.blocked = !w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ); } }
private int blockLight( final int emit ) { if( this.opacity < 0 ) { final TileEntity te = this.getTile(); this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.getSide().getFacing() ) ); } return (int) ( emit * ( this.opacity / 255.0f ) ); }
protected TileEntity getConnectedTE() { TileEntity self = this.getHost().getTile(); return this.getTileEntity( self, self.getPos().offset( this.getSide().getFacing() ) ); }
private void notifyNeighbors() { final World world = this.getTile().getWorld(); Platform.notifyBlocksOfNeighbors( world, this.getTile().getPos() ); // and this cause sometimes it can go thought walls. for( final EnumFacing face : EnumFacing.VALUES ) { Platform.notifyBlocksOfNeighbors( world, this.getTile().getPos().offset( face ) ); } }
private boolean isDense( final AEPartLocation of ) { final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( of.getFacing() ) ); if( te instanceof IGridHost ) { final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() ); return t.isDense(); } return false; }
protected InventoryAdaptor getHandler() { final TileEntity self = this.getHost().getTile(); final TileEntity target = this.getTileEntity( self, self.getPos().offset( this.getSide().getFacing() ) ); return InventoryAdaptor.getAdaptor( target, this.getSide().getFacing().getOpposite() ); }
private void updateState() { final boolean isOn = this.isLevelEmitterOn(); if( this.prevState != isOn ) { this.getHost().markForUpdate(); final TileEntity te = this.getHost().getTile(); this.prevState = isOn; Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos() ); Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos().offset( this.getSide().getFacing() ) ); } }
private void updateState() { final boolean isOn = this.isLevelEmitterOn(); if( this.prevState != isOn ) { this.getHost().markForUpdate(); final TileEntity te = this.getHost().getTile(); this.prevState = isOn; Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos() ); Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos().offset( this.getSide().getFacing() ) ); } }