Navigation

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Bottle fluide

    Sans suite
    1.7.10
    3
    4
    873
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U
      Ultro Who last edited by

      Bonsoir,

      j’ai créer un nouveau fluide et j’aimerais que ce fluide soit récupérable avec des bottle vide j’ai chercher dans le code source de Mc mais sans succès.
      J’aimerais savoir aussi si il est possible de changer l’intérieur du fluide car quand on ce retrouve dans le fluide le render c’est le render de l’eau.

      1 Reply Last reply Reply Quote 0
      • N
        nargacu83 last edited by

        @‘Ultro Who’:

        Bonsoir,

        j’ai créer un nouveau fluide et j’aimerais que ce fluide soit récupérable avec des bottle vide j’ai chercher dans le code source de Mc mais sans succès.
        J’aimerais savoir aussi si il est possible de changer l’intérieur du fluide car quand on ce retrouve dans le fluide le render c’est le render de l’eau.

        Bonsoir,

        J’ai cherché dans le code source et j’y ai trouvé ce que tu cherchais :

        Attention ce code est tiré de la 1.10.2 mais tu devrais très facilement trouver le code dans la version 1.7.10

        Dans la classe ItemBucket dans les sources.

        
        /**
             * Called when the equipped item is right clicked.
             */
            public ActionResult <itemstack>onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
            {
                boolean flag = this.containedBlock == Blocks.AIR;
                RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, flag);
                ActionResult <itemstack>ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, raytraceresult);
                if (ret != null) return ret;
        
                if (raytraceresult == null)
                {
                    return new ActionResult(EnumActionResult.PASS, itemStackIn);
                }
                else if (raytraceresult.typeOfHit != RayTraceResult.Type.BLOCK)
                {
                    return new ActionResult(EnumActionResult.PASS, itemStackIn);
                }
                else
                {
                    BlockPos blockpos = raytraceresult.getBlockPos();
        
                    if (!worldIn.isBlockModifiable(playerIn, blockpos))
                    {
                        return new ActionResult(EnumActionResult.FAIL, itemStackIn);
                    }
                    else if (flag)
                    {
                        if (!playerIn.canPlayerEdit(blockpos.offset(raytraceresult.sideHit), raytraceresult.sideHit, itemStackIn))
                        {
                            return new ActionResult(EnumActionResult.FAIL, itemStackIn);
                        }
                        else
                        {
                            IBlockState iblockstate = worldIn.getBlockState(blockpos);
                            Material material = iblockstate.getMaterial();
        
                            if (material == Material.WATER && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) //ICI ON VERIFIE SI C'EST BIEN DE L'EAU ET QU'IL S'AGIT D'UNE SOURCE
                            {
                                worldIn.setBlockState(blockpos, Blocks.AIR.getDefaultState(), 11);
                                playerIn.addStat(StatList.getObjectUseStats(this));
                                playerIn.playSound(SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F);
                                return new ActionResult(EnumActionResult.SUCCESS, this.fillBucket(itemStackIn, playerIn, Items.WATER_BUCKET));
                            }
                            else if (material == Material.LAVA && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) /ICI ON VERIFIE SI C'EST BIEN DE LA LAVE ET QU'IL S'AGIT D'UNE SOURCE
                            {
                                playerIn.playSound(SoundEvents.ITEM_BUCKET_FILL_LAVA, 1.0F, 1.0F);
                                worldIn.setBlockState(blockpos, Blocks.AIR.getDefaultState(), 11);
                                playerIn.addStat(StatList.getObjectUseStats(this));
                                return new ActionResult(EnumActionResult.SUCCESS, this.fillBucket(itemStackIn, playerIn, Items.LAVA_BUCKET));
                            }
                            else
                            {
                                return new ActionResult(EnumActionResult.FAIL, itemStackIn);
                            }
                        }
                    }
                    else
                    {
                        boolean flag1 = worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
                        BlockPos blockpos1 = flag1 && raytraceresult.sideHit == EnumFacing.UP ? blockpos : blockpos.offset(raytraceresult.sideHit);
        
                        if (!playerIn.canPlayerEdit(blockpos1, raytraceresult.sideHit, itemStackIn))
                        {
                            return new ActionResult(EnumActionResult.FAIL, itemStackIn);
                        }
                        else if (this.tryPlaceContainedLiquid(playerIn, worldIn, blockpos1))
                        {
                            playerIn.addStat(StatList.getObjectUseStats(this));
                            return !playerIn.capabilities.isCreativeMode ? new ActionResult(EnumActionResult.SUCCESS, new ItemStack(Items.BUCKET)) : new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
                        }
                        else
                        {
                            return new ActionResult(EnumActionResult.FAIL, itemStackIn);
                        }
                    }
                }
            }
        
        ```</itemstack></itemstack>
        1 Reply Last reply Reply Quote 0
        • U
          Ultro Who last edited by

          Bonsoir nargacu83 j’ai beau regardez dans le code ci dessus mais je vois rien en rapport avec les bottles

          1 Reply Last reply Reply Quote 0
          • Superloup10
            Superloup10 Modérateurs last edited by

            C’est normal, il s’agit du code issus de la classe ItemBucket, mais si tu avais regardé en détail le code, tu aurais pourquoi il t’a donné ce code, à savoir un seau peut ramasser une source de liquide, hors c’est bien ce que tu veux faire avec ta bouteille ?

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Design by Woryk
            Contact / Mentions Légales / Faire un don

            MINECRAFT FORGE FRANCE © 2018

            Powered by NodeBB