Voici le crash , qui se produit quand on clique sur le bloc dont le nouveau code est :
| [font=Courier Newpublic class ]DofusCraftCraftingTable extends Block |
| { |
| |
| public static final PropertyDirection *FACING *= BlockHorizontal.*FACING*%(#cc7832)[; |
| ] private int level%(#cc7832)[; |
| ] |
| public DofusCraftCraftingTable(String unlocalizedName, String registryName) |
| { |
| super(Material.*WOOD*)%(#cc7832)[; |
| ] this.setDefaultState(this.blockState.getBaseState().withProperty(*FACING*, EnumFacing.*NORTH*))%(#cc7832)[; |
| ] this.setUnlocalizedName(unlocalizedName)%(#cc7832)[; |
| ] this.setRegistryName(new ResourceLocation(Reference.*MODID*, registryName))%(#cc7832)[; |
| ] this.setSoundType(SoundType.*WOOD*)%(#cc7832)[; |
| ] this.setCreativeTab(DofusCraftCore.*blocks*)%(#cc7832)[; |
| ] } |
| |
| @SuppressWarnings("deprecated") |
| public boolean isOpaqueCube(IBlockState state) |
| { |
| %(#cc7832)[return false; |
| ] } |
| |
| @SuppressWarnings("deprecated") |
| public boolean isFullCube(IBlockState state) |
| { |
| %(#cc7832)[return false; |
| ] } |
| |
| public boolean isPassable(IBlockAccess worldIn, BlockPos pos) |
| { |
| %(#cc7832)[return true; |
| ] } |
| |
| %(#bbb529)[@Override |
| ] public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) |
| { |
| |
| if( !world.isRemote ) |
| { |
| player.openGui(DofusCraftCore.*instance*, GuiHandler.*guiCraftingTableID*, world, pos.getX(), pos.getY(), pos.getZ())%(#cc7832)[; |
| ] IDofusCraftLevels cap = player.getCapability(DofusCraftLevelsProvider.*LEVEL_CAP*, null)%(#cc7832)[; |
| ] cap.setLevel(cap.getLevel() + 1)%(#cc7832)[; |
| ] this.level = cap.getLevel()%(#cc7832)[; |
| ] String message = String.*format*("Hello there, you have §7%d§r levels.", (int) cap.getLevel())%(#cc7832)[; |
| ] player.sendMessage(new TextComponentString(message))%(#cc7832)[; |
| ] } |
| if( world.isRemote ) |
| { |
| DofusCraftCore.*network*.sendTo(new PacketLevel(this.level), (EntityPlayerMP) player)%(#cc7832)[; |
| ] } |
| |
| %(#cc7832)[return true; |
| ] } |
| |
| @SuppressWarnings("deprecated") |
| public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) |
| { |
| return this.getDefaultState().withProperty(*FACING*, placer.getHorizontalFacing().getOpposite())%(#cc7832)[; |
| ] } |
| |
| public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) |
| { |
| worldIn.setBlockState(pos, state.withProperty(*FACING*, placer.getHorizontalFacing().getOpposite()), 2)%(#cc7832)[; |
| ] } |
| |
| @SuppressWarnings("deprecated") |
| public EnumBlockRenderType getRenderType(IBlockState state) |
| { |
| return EnumBlockRenderType.*MODEL*%(#cc7832)[; |
| ] } |
| |
| @SuppressWarnings("deprecated") |
| public IBlockState withRotation(IBlockState state, Rotation rot) |
| { |
| return state.withProperty(*FACING*, rot.rotate((EnumFacing) state.getValue(*FACING*)))%(#cc7832)[; |
| ] } |
| |
| @SuppressWarnings("deprecated") |
| %(#bbb529)[@Override |
| ] public IBlockState getStateFromMeta(int meta) |
| { |
| EnumFacing facing = EnumFacing.*getFront*(meta)%(#cc7832)[; |
| ] |
| if( facing.getAxis() == EnumFacing.Axis.*Y *) |
| { |
| facing = EnumFacing.*NORTH*%(#cc7832)[; |
| ] } |
| return getDefaultState().withProperty(*FACING*, facing)%(#cc7832)[; |
| ] } |
| |
| %(#bbb529)[@Override |
| ] public int getMetaFromState(IBlockState state) |
| { |
| return ((EnumFacing) state.getValue(*FACING*)).getIndex()%(#cc7832)[; |
| ] } |
| |
| protected BlockStateContainer createBlockState() |
| { |
| return new BlockStateContainer(this, new IProperty[]{*FACING*})%(#cc7832)[; |
| ] } |
| [Netty Server IO #1/ERROR] [FML]: NetworkDispatcher exception |
| java.io.IOException: Une connexion existante a dû être fermée par l’hôte distant |
| at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[?:1.8.0_131] |
| at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) ~[?:1.8.0_131] |
| at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.8.0_131] |
| at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[?:1.8.0_131] |
| at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[?:1.8.0_131] |
| at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:446) ~[UnpooledUnsafeDirectByteBuf.class:4.0.23.Final] |
| at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:881) ~[AbstractByteBuf.class:4.0.23.Final] |
| at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:225) ~[NioSocketChannel.class:4.0.23.Final] |
| at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [AbstractNioByteChannel$NioByteUnsafe.class:4.0.23.Final] |
| at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [NioEventLoop.class:4.0.23.Final] |
| at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [NioEventLoop.class:4.0.23.Final] |
| at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [NioEventLoop.class:4.0.23.Final] |
| at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [NioEventLoop.class:4.0.23.Final] |
| at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [SingleThreadEventExecutor$2.class:4.0.23.Final] |
| at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131] |
Cordialement ,