@Nonnull @Override public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) { state = state.getBlock().getActualState(state, world, pos); PropertyEnum<EnumDyeColor> prop = second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1; return new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getValue(prop).ordinal() - (second ? 8 : 0)); }
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color, final EntityPlayer who ) { try { return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who ); } catch( final Throwable ignored ) { } return false; }
@Override public float[] getColoredLight(IBlockAccess world, BlockPos pos) { int index = 0; BlockPos down = pos.down(); IBlockState state = world.getBlockState(down); if(state.getBlock() == Blocks.CONCRETE) index = state.getValue(BlockColored.COLOR).ordinal(); return VANILLA_SPECTRUM_COLORS[index]; }
@Override public void scroll( final EntityPlayer player, final ItemStack stack, final int dwheel ) { final EnumDyeColor color = getTapeColor( stack ); int next = color.ordinal() + ( dwheel < 0 ? -1 : 1 ); if ( next < 0 ) { next = EnumDyeColor.values().length - 1; } if ( next >= EnumDyeColor.values().length ) { next = 0; } final EnumDyeColor col = EnumDyeColor.values()[next]; setTapeColor( stack, col ); final PacketSetColor setColor = new PacketSetColor(); setColor.chatNotification = ChiselsAndBits.getConfig().chatModeNotification; setColor.newColor = col; setColor.type = ChiselToolType.TAPEMEASURE; NetworkRouter.instance.sendToServer( setColor ); ReflectionWrapper.instance.clearHighlightedStack(); }