public void setTexture( TextureAtlasSprite texture ) { for( EnumFacing face : EnumFacing.values() ) { this.textures.put( face, texture ); } }
public EnumFacing resultingRotate( EnumFacing facing ) { for( EnumFacing face : EnumFacing.values() ) { if( this.rotate( face ) == facing ) { return face; } } return null; }
ColorApplicatorBakedModel( IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright ) { this.baseModel = baseModel; this.transforms = map; // Put the tint indices in... Since this is an item model, we are ignoring rand this.generalQuads = this.fixQuadTint( null, texDark, texMedium, texBright ); this.quadsBySide = new EnumMap<>( EnumFacing.class ); for( EnumFacing facing : EnumFacing.values() ) { this.quadsBySide.put( facing, this.fixQuadTint( facing, texDark, texMedium, texBright ) ); } }
public EnumSet<EnumFacing> getAdjacentQuantumBridges() { final EnumSet<EnumFacing> set = EnumSet.noneOf( EnumFacing.class ); for( final EnumFacing d : EnumFacing.values() ) { final TileEntity te = this.world.getTileEntity( this.pos.offset( d ) ); if( te instanceof TileQuantumBridge ) { set.add( d ); } } return set; }
@Override public IBlockState getStateFromMeta( final int meta ) { EnumFacing facing = EnumFacing.values()[meta]; return this.getDefaultState().withProperty( FACING, facing ); }
@Override public IBlockState getStateFromMeta( final int meta ) { EnumFacing facing = EnumFacing.values()[meta]; return this.getDefaultState().withProperty( FACING, facing ); }
@Override public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) { EnumSet<EnumFacing> connections = EnumSet.noneOf( EnumFacing.class ); for( EnumFacing facing : EnumFacing.values() ) { if( this.isConnected( world, pos, facing ) ) { connections.add( facing ); } } IExtendedBlockState extState = (IExtendedBlockState) state; return extState.withProperty( STATE, new CraftingCubeState( connections ) ); }
public PacketClick( final ByteBuf stream ) { this.x = stream.readInt(); this.y = stream.readInt(); this.z = stream.readInt(); byte side = stream.readByte(); if( side != -1 ) { this.side = EnumFacing.values()[side]; } else { this.side = null; } this.hitX = stream.readFloat(); this.hitY = stream.readFloat(); this.hitZ = stream.readFloat(); this.hand = EnumHand.values()[stream.readByte()]; this.leftClick = stream.readBoolean(); }
@Override public void onUpdate(ItemStack tool, World world, Entity entity, int itemSlot, boolean isSelected) { if(isSelected && !world.isRemote && !ToolHelper.isBroken(tool)) { BlockPos pos = entity.getPosition(); // check light level at entity if(world.getLightFromNeighbors(pos) < 8) { for(BlockPos candidate : new BlockPos[]{pos, pos.up(), pos.north(), pos.east(), pos.south(), pos.west(), pos.down()}) { // addGlow tries all directions if the passed one doesn't work if(TinkerCommons.blockGlow.addGlow(world, candidate, EnumFacing.values()[random.nextInt(6)])) { EntityLivingBase entityLiving = null; if(entity instanceof EntityLivingBase) { entityLiving = (EntityLivingBase) entity; } if(!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).capabilities.isCreativeMode) { ToolHelper.damageTool(tool, 1, entityLiving); } return; } } } } } }
ImmutableMap.Builder<EnumFacing, ImmutableList<BakedQuad>> mapBuilder = ImmutableMap.builder(); for(EnumFacing facing : EnumFacing.values()) { mapBuilder.put(facing, ImmutableList.copyOf(quads.get(facing)));
@Override public void render( AEBaseTile te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ ) { if( !( te instanceof TileCableBusTESR ) ) { return; } TileCableBusTESR realTe = (TileCableBusTESR) te; for( EnumFacing facing : EnumFacing.values() ) { IPart part = realTe.getPart( facing ); if( part != null && part.requireDynamicRender() ) { part.renderDynamic( x, y, z, partialTicks, destroyStage ); } } } }
@Override public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) { EnumSet<EnumFacing> flushWith = EnumSet.noneOf( EnumFacing.class ); // Test every direction for another glass block for( EnumFacing facing : EnumFacing.values() ) { if( isGlassBlock( world, pos, facing ) ) { flushWith.add( facing ); } } GlassState glassState = new GlassState( pos.getX(), pos.getY(), pos.getZ(), flushWith ); IExtendedBlockState extState = (IExtendedBlockState) state; return extState.withProperty( GLASS_STATE, glassState ); }
for( EnumFacing facing : EnumFacing.values() )
private static EnumMap<EnumFacing, List<Vec3d>> generateCornersForFacings() { EnumMap<EnumFacing, List<Vec3d>> result = new EnumMap<>( EnumFacing.class ); for( EnumFacing facing : EnumFacing.values() ) { List<Vec3d> corners; float offset = ( facing.getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ) ? 0 : 1; switch( facing.getAxis() ) { default: case X: corners = Lists.newArrayList( new Vec3d( offset, 1, 1 ), new Vec3d( offset, 0, 1 ), new Vec3d( offset, 0, 0 ), new Vec3d( offset, 1, 0 ) ); break; case Y: corners = Lists.newArrayList( new Vec3d( 1, offset, 1 ), new Vec3d( 1, offset, 0 ), new Vec3d( 0, offset, 0 ), new Vec3d( 0, offset, 1 ) ); break; case Z: corners = Lists.newArrayList( new Vec3d( 0, 1, offset ), new Vec3d( 0, 0, offset ), new Vec3d( 1, 0, offset ), new Vec3d( 1, 1, offset ) ); break; } if( facing.getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ) { corners = Lists.reverse( corners ); } result.put( facing, ImmutableList.copyOf( corners ) ); } return result; }
private void renderModel(IBakedModel model, ItemStack stack, int color) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder worldrenderer = tessellator.getBuffer(); worldrenderer.begin(7, DefaultVertexFormats.ITEM); for (EnumFacing enumfacing : EnumFacing.values()) { renderQuads(worldrenderer, model.getQuads(null, enumfacing, 0), color, stack); } renderQuads(worldrenderer, model.getQuads(null, null, 0), color, stack); tessellator.draw(); }
@Override public void update() { int tier = 1; final EnumSet<EnumFacing> validEnergyReceivers = EnumSet.noneOf( EnumFacing.class ); for( EnumFacing facing : EnumFacing.values() ) { final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) ); if( te instanceof TileEnergyGenerator ) { tier++; } if( te != null && te.hasCapability( CapabilityEnergy.ENERGY, facing.getOpposite() ) ) { validEnergyReceivers.add( facing ); } } final int energyToInsert = IntMath.pow( BASE_ENERGY, tier ); for( EnumFacing facing : validEnergyReceivers ) { final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) ); final IEnergyStorage cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() ); if( cap.canReceive() ) { cap.receiveEnergy( energyToInsert, false ); } } }
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { for(EnumFacing dir : EnumFacing.values()) { TileEntity te = worldIn.getTileEntity(pos.offset(dir)); if(te instanceof IMasterLogic) {