• Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes
  • S'inscrire
  • Se connecter
  • S'inscrire
  • Se connecter
  • Recherche
  • Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes

Résolu Encore problème onUpdate

1.7.x
1.7.10
8
104
16.1k
Charger plus de messages
  • Du plus ancien au plus récent
  • Du plus récent au plus ancien
  • Les plus votés
Répondre
  • Répondre à l'aide d'un nouveau sujet
Se connecter pour répondre
Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
  • Gabs
    Gabs dernière édition par 19 juil. 2016, 12:18

    Bonjour,
    J’ai encore un soucis avec ma fonction onUpdate.

    Voici ma fonction:

    public void onUpdate(ItemStack item, World world, Entity player, int slotIndex, boolean inHand) {
    if(!item.hasTagCompound() && !world.isRemote) {
          item.setTagCompound(new NBTTagCompound());
    }
    if(world.isRemote){
    int timer = !item.getTagCompound().hasKey("timer") ? 0 : item.getTagCompound().getInteger("timer");
    timer++;
    item.getTagCompound().setInteger("timer", timer);
    int timer2 = !item.getTagCompound().hasKey("timer2") ? 0 : item.getTagCompound().getInteger("timer2");
    timer2++;
    item.getTagCompound().setInteger("timer2", timer2);
    int timer3 = !item.getTagCompound().hasKey("timer3") ? 0 : item.getTagCompound().getInteger("timer3");
    timer3++;
    item.getTagCompound().setInteger("timer3", timer3);
    super.onUpdate(item, world, player, slotIndex, inHand);
    }
    }

    Cette fonction est utilisé dans une classe extends ItemBow .
    Le soucis est que je désire faire un timer pour différents sorts mais le problème est que le timer marche pas vraiment 😕 , je procède comme ceci:

    if(… && stack.getTagCompound().getInteger("timer") >= 20 * 20)
    {
    //Code
    stack.getTagCompound().setInteger("timer", 0);
    }

    A mon avis c’est world.isremote dans la fonction onUpdate car la flèche est lancée côté serveur et donc cela fait un conflit mais quand je met !world.isremote je rencontre le soucis de la dernière fois:  https://youtu.be/wThsb3Fi4jU

    Merci d’avance.

    1 réponse Dernière réponse Répondre Citer 0
    • LeBossMax2
      LeBossMax2 dernière édition par 19 juil. 2016, 12:57

      Je pence que tu ne devrais tout simplement ni mettre de condition world.isremote, ni mettre !world.isremote car le timer sert du coté client et du coté serveur.

      1 réponse Dernière réponse Répondre Citer 0
      • Gabs
        Gabs dernière édition par 19 juil. 2016, 15:26

        Oui mais si je les mets pas j’ai le problème de la vidéo.

        1 réponse Dernière réponse Répondre Citer 0
        • SCAREX
          SCAREX dernière édition par 19 juil. 2016, 18:00

          Techniquement c’est mieux de le mettre côté serveur et ensuite de synchroniser

          Site web contenant mes scripts : http://SCAREXgaming.github.io

          Pas de demandes de support par MP ni par skype SVP.
          Je n'accepte sur skype que l…

          1 réponse Dernière réponse Répondre Citer 0
          • Gabs
            Gabs dernière édition par 19 juil. 2016, 18:28

            @‘SCAREX’:

            Techniquement c’est mieux de le mettre côté serveur et ensuite de synchroniser

            Comme ça?

            1. **public** **void** onUpdate(ItemStack item, World world, Entity player, **int** slotIndex, **boolean** inHand) {
            2. **if**(!item.hasTagCompound() && !world.isRemote) {
            3.       item.setTagCompound(**new** NBTTagCompound());
            4. }
            5. **if**(!world.isRemote){
            6. **int** timer = !item.getTagCompound().hasKey("timer") ? 0 : item.getTagCompound().getInteger("timer");
            7. timer++;
            8. item.getTagCompound().setInteger("timer", timer);
            9. **int** timer2 = !item.getTagCompound().hasKey("timer2") ? 0 : item.getTagCompound().getInteger("timer2");
            10. timer2++;
            11. item.getTagCompound().setInteger("timer2", timer2);
            12. **int** timer3 = !item.getTagCompound().hasKey("timer3") ? 0 : item.getTagCompound().getInteger("timer3");
            13. timer3++;
            14. item.getTagCompound().setInteger("timer3", timer3);
            15. **super**.onUpdate(item, world, player, slotIndex, inHand);
            16. }
            17. }

            Si je fais ça j’ai encore le problème avec mon arc.

            1 réponse Dernière réponse Répondre Citer 0
            • SCAREX
              SCAREX dernière édition par 19 juil. 2016, 18:36

              En fait je vois pas le problème que pourrais causer ton code : tout ce que tu fais c’est incrémenter un timer, le problème vient d’autre part.

              Envoi la classe de l’item en entier

              Site web contenant mes scripts : http://SCAREXgaming.github.io

              Pas de demandes de support par MP ni par skype SVP.
              Je n'accepte sur skype que l…

              1 réponse Dernière réponse Répondre Citer 0
              • Gabs
                Gabs dernière édition par 19 juil. 2016, 18:45

                @‘SCAREX’:

                En fait je vois pas le problème que pourrais causer ton code : tout ce que tu fais c’est incrémenter un timer, le problème vient d’autre part.

                Envoi la classe de l’item en entier

                Tien:

                package net.legacymod.items;
                import cpw.mods.fml.relauncher.Side;
                import cpw.mods.fml.relauncher.SideOnly;
                import net.legacymod.LegacyMod;
                import net.legacymod.packets.Packet5Arrow;
                import net.legacymod.packets.PacketArrow;
                import net.legacymod.packets.PacketFireArrow;
                import net.legacymod.proxy.ClientProxy;
                import net.minecraft.client.renderer.texture.IIconRegister;
                import net.minecraft.creativetab.CreativeTabs;
                import net.minecraft.enchantment.Enchantment;
                import net.minecraft.enchantment.EnchantmentHelper;
                import net.minecraft.entity.Entity;
                import net.minecraft.entity.EntityLivingBase;
                import net.minecraft.entity.player.EntityPlayer;
                import net.minecraft.entity.projectile.EntityArrow;
                import net.minecraft.entity.projectile.EntityLargeFireball;
                import net.minecraft.init.Items;
                import net.minecraft.item.EnumAction;
                import net.minecraft.item.Item;
                import net.minecraft.item.ItemBow;
                import net.minecraft.item.ItemStack;
                import net.minecraft.nbt.NBTTagCompound;
                import net.minecraft.util.DamageSource;
                import net.minecraft.util.IIcon;
                import net.minecraft.util.Vec3;
                import net.minecraft.world.World;
                import net.minecraftforge.common.MinecraftForge;
                import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
                import net.minecraftforge.event.entity.player.ArrowLooseEvent;
                import net.minecraftforge.event.entity.player.ArrowNockEvent;
                public class FlameBow extends ItemBow {
                public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"};
                   @SideOnly(Side.CLIENT)
                   private IIcon[] iconArray;
                   public boolean isExplosive;
                   public FlameBow()
                   {
                       this.maxStackSize = 1;
                       this.setMaxDamage(1000);
                       this.setFull3D();
                       this.setCreativeTab(CreativeTabs.tabCombat);
                   }
                   /**
                    * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
                    */
                   public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int p_77615_4_)
                   {
                       int j = this.getMaxItemUseDuration(stack) - p_77615_4_;
                       ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j);
                       EntityLargeFireball fire = new EntityLargeFireball(world);
                       MinecraftForge.EVENT_BUS.post(event);
                       if (event.isCanceled())
                       {
                           return;
                       }
                       j = event.charge;
                       boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
                       if (flag || player.inventory.hasItem(Items.arrow))
                       {
                           float f = (float)j / 20.0F;
                           f = (f * f + f * 2.0F) / 3.0F;
                           if ((double)f < 0.1D)
                           {
                               return;
                           }
                           if (f > 1.0F)
                           {
                               f = 1.0F;
                           }
                           EntityArrow entityarrow = new EntityArrow(world, player, f * 2.0F);
                           EntityArrow entityarrow2 = new EntityArrow(world, player, f * 2.0F);
                           EntityArrow entityarrow3 = new EntityArrow(world, player, f * 2.0F);
                           EntityArrow entityarrow4 = new EntityArrow(world, player, f * 2.0F);
                           EntityArrow entityarrow5 = new EntityArrow(world, player, f * 2.0F);
                           if (f == 1.0F)
                           {
                               entityarrow.setIsCritical(true);
                           }
                           int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);
                           if (k > 0)
                           {
                               entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
                           }
                           int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);
                           if (l > 0)
                           {
                               entityarrow.setKnockbackStrength(l);
                           }
                           if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
                           {
                               entityarrow.setFire(100);
                           }
                           stack.damageItem(1, player);
                           world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
                           if (flag)
                           {
                               entityarrow.canBePickedUp = 2;
                           }
                           if(!world.isRemote && ClientProxy.keyBindSortG2.isPressed() && stack.getTagCompound().getInteger("timer") >= 1)
                           {
                            entityarrow.getEntityData().setBoolean("isExplosive", true);
                            LegacyMod.network.sendToServer(new PacketArrow(f * 2.0F));
                            System.out.println("flèche explosive");
                            stack.getTagCompound().setInteger("timer", 0);
                           }
                           if (!world.isRemote && ClientProxy.keyBindSortG1.isPressed())
                           {
                            LegacyMod.network.sendToServer(new PacketFireArrow(f * 2.0F));
                            System.out.println("flèche en feu");
                            stack.getTagCompound().setInteger("timer2", 0);
                           }
                           if (player.isSneaking() && !world.isRemote)
                           {
                          System.out.println("5 flèches");
                        LegacyMod.network.sendToServer(new Packet5Arrow(2.0F));
                            stack.getTagCompound().setInteger("timer3", 0);
                           }else if(!world.isRemote)
                           {
                            world.spawnEntityInWorld(entityarrow);
                            System.out.println("flèche normale");
                           }
                       }
                   }
                   public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_)
                   {
                       return p_77654_1_;
                   }
                   /**
                    * How long it takes to use or consume an item
                    */
                   public int getMaxItemUseDuration(ItemStack p_77626_1_)
                   {
                       return 72000;
                   }
                   /**
                    * returns the action that specifies what animation to play when the items is being used
                    */
                   public EnumAction getItemUseAction(ItemStack p_77661_1_)
                   {
                       return EnumAction.bow;
                   }
                   /**
                    * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
                    */
                   public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
                   {
                       ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
                       MinecraftForge.EVENT_BUS.post(event);
                       if (event.isCanceled())
                       {
                           return event.result;
                       }
                       if (p_77659_3_.capabilities.isCreativeMode || p_77659_3_.inventory.hasItem(Items.arrow))
                       {
                           p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
                       }
                       return p_77659_1_;
                   }
                   /**
                    * Return the enchantability factor of the item, most of the time is based on material.
                    */
                   public int getItemEnchantability()
                   {
                       return 1;
                   }
                   @SideOnly(Side.CLIENT)
                   public void registerIcons(IIconRegister p_94581_1_)
                   {
                       this.itemIcon = p_94581_1_.registerIcon(this.getIconString() + "_standby");
                       this.iconArray = new IIcon[bowPullIconNameArray.length];
                       for (int i = 0; i < this.iconArray.length; ++i)
                       {
                           this.iconArray* = p_94581_1_.registerIcon(this.getIconString() + "_" + bowPullIconNameArray*);
                       }
                   }
                   /**
                    * used to cycle through icons based on their used duration, i.e. for the bow
                    */
                   @SideOnly(Side.CLIENT)
                   public IIcon getItemIconForUseDuration(int p_94599_1_)
                   {
                       return this.iconArray[p_94599_1_];
                   }
                public void onUpdate(ItemStack item, World world, Entity player, int slotIndex, boolean inHand) {
                if(!item.hasTagCompound() && !world.isRemote) {
                      item.setTagCompound(new NBTTagCompound());
                }
                if(!world.isRemote){ // si tu met juste world.isRemote le bug avec l'arc disparait.
                int timer = !item.getTagCompound().hasKey("timer") ? 0 : item.getTagCompound().getInteger("timer");
                timer++;
                item.getTagCompound().setInteger("timer", timer);
                int timer2 = !item.getTagCompound().hasKey("timer2") ? 0 : item.getTagCompound().getInteger("timer2");
                timer2++;
                item.getTagCompound().setInteger("timer2", timer2);
                int timer3 = !item.getTagCompound().hasKey("timer3") ? 0 : item.getTagCompound().getInteger("timer3");
                timer3++;
                item.getTagCompound().setInteger("timer3", timer3);
                super.onUpdate(item, world, player, slotIndex, inHand);
                }
                }
                @Override//Prob ici
                   public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
                   {
                       if(usingItem != null && usingItem.getItem() == LegacyMod.FlameBow)
                       {
                           int k = usingItem.getMaxItemUseDuration() - useRemaining;
                           if(k >= 18)
                               return iconArray[2];
                           if(k > 13)
                               return iconArray[1];
                           if(k > 0)
                               return iconArray[0];
                       }
                       return getIconIndex(stack);
                }
                }
                1 réponse Dernière réponse Répondre Citer 0
                • SCAREX
                  SCAREX dernière édition par 19 juil. 2016, 19:32

                  if(!world.isRemote && ClientProxy.keyBindSortG2.isPressed() && stack.getTagCompound().getInteger(“timer”) >= 1)

                  traduction -> si on est côté serveur et que la touche bindSortG2 est appuyée côté client…

                  Ton code ne peut pas fonctionner, tu demande que ce soit côté serveur et côté client, fais du ménage dans ton code et après je t’aiderai car sinon c’est impossible

                  Site web contenant mes scripts : http://SCAREXgaming.github.io

                  Pas de demandes de support par MP ni par skype SVP.
                  Je n'accepte sur skype que l…

                  1 réponse Dernière réponse Répondre Citer 0
                  • Gabs
                    Gabs dernière édition par 19 juil. 2016, 21:55

                    @‘SCAREX’:

                    if(!world.isRemote && ClientProxy.keyBindSortG2.isPressed() && stack.getTagCompound().getInteger(“timer”) >= 1)

                    traduction -> si on est côté serveur et que la touche bindSortG2 est appuyée côté client…

                    Ton code ne peut pas fonctionner, tu demande que ce soit côté serveur et côté client, fais du ménage dans ton code et après je t’aiderai car sinon c’est impossible

                    Comment je peux faire pour ne avoir le conflit client serveur avec un !worldremote et un keybinpressed ? un packet ?

                    1 réponse Dernière réponse Répondre Citer 0
                    • AymericRed
                      AymericRed dernière édition par 19 juil. 2016, 22:01

                      Oui, un packet (comme pour l’arc et la flèche qui doit s’enflammer).

                      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                      1 réponse Dernière réponse Répondre Citer 0
                      • Gabs
                        Gabs dernière édition par 19 juil. 2016, 23:26

                        @‘AymericRed’:

                        Oui, un packet (comme pour l’arc et la flèche qui doit s’enflammer).

                        ok mais je dois mettre quoi cette fois si? un String ?
                        Et si vous avez un peu plus de détails je suis prenneur

                        1 réponse Dernière réponse Répondre Citer 0
                        • AymericRed
                          AymericRed dernière édition par 19 juil. 2016, 23:41

                          Ça dépend de ce qu’il y dans le if (je n’ai pas le temps de regarder là surtout que tapatalk n’aime pas les balises codes).

                          Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk

                          Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                          AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                          Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                          1 réponse Dernière réponse Répondre Citer 0
                          • Gabs
                            Gabs dernière édition par 20 juil. 2016, 13:20

                            D’acc j’attends ta réponse merci 🙂

                            1 réponse Dernière réponse Répondre Citer 0
                            • AymericRed
                              AymericRed dernière édition par 20 juil. 2016, 16:23

                              Tu envoies déjà un packet qui est censé lancer la flèche, or elle doit forcément être explosive donc tu as juste à faire ```java
                              entityarrow.getEntityData().setBoolean(“isExplosive”, true);

                              Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                              AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                              Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                              Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                              1 réponse Dernière réponse Répondre Citer 0
                              • Gabs
                                Gabs dernière édition par 20 juil. 2016, 17:29

                                @‘AymericRed’:

                                Tu envoies déjà un packet qui est censé lancer la flèche, or elle doit forcément être explosive donc tu as juste à faire ```java
                                entityarrow.getEntityData().setBoolean(“isExplosive”, true);

                                Ouaip je vais faire ça ok ^^ un switch case serrait bien pour les différentes flèches ?
                                Merci en tout cas 🙂

                                1 réponse Dernière réponse Répondre Citer 0
                                • AymericRed
                                  AymericRed dernière édition par 20 juil. 2016, 17:30

                                  Oui un switch serait bien 🙂

                                  Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                                  AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                                  Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • Gabs
                                    Gabs dernière édition par 20 juil. 2016, 17:48

                                    @‘AymericRed’:

                                    Oui un switch serait bien 🙂

                                    Ok donc c’est bon!

                                    J’ai ça comme code du coup:

                                     if(ClientProxy.keyBindSortG2.isPressed() && stack.getTagCompound().getInteger("timer") >= 20 * 20)
                                               {
                                                LegacyMod.network.sendToServer(new PacketArrow(f * 2.0F, 1));
                                                System.out.println("flèche explosive");
                                                stack.getTagCompound().setInteger("timer", 0);
                                               }
                                               if (ClientProxy.keyBindSortG1.isPressed())
                                               {
                                                LegacyMod.network.sendToServer(new PacketArrow(f * 2.0F, 3));
                                                System.out.println("flèche en feu");
                                                stack.getTagCompound().setInteger("timer2", 0);
                                               }
                                               if (player.isSneaking() && !world.isRemote)
                                               {
                                              System.out.println("5 flèches");
                                            LegacyMod.network.sendToServer(new PacketArrow(2.0F, 2));
                                                stack.getTagCompound().setInteger("timer3", 0);
                                               }else if(!world.isRemote)
                                               {
                                                world.spawnEntityInWorld(entityarrow);
                                                System.out.println("flèche normale");
                                               }
                                           }

                                    ça marche mais ça me lance a chaque fois 2 flèches exemple: flèche en feu et flèche normale sauf pour la flèche normale et les 5 flèches alors que mon packet et bien enregistrer côté serveur du coup faut a chaque if mettre !world.isremote mais y’a un conflit avec le keybinding comment je peux faire ??

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • Deleted
                                      Deleted dernière édition par 20 juil. 2016, 17:53

                                      File ta classe PacketArrow et l’endroit de ta classe principale où tu l’enregistres.

                                      Et puis c’est normal que plusieurs flèches différentes soienr envoyées alors que tu n’en souhaites qu’une seul, regarde un peu toutes tes conditions. Y’a plein de if à la suite, donc normal que tout ton code s’enchaîne à la lecture du code. Remplace les par des else if, si tu ne veux qu’une seule par type ne soit envoyée.

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • Gabs
                                        Gabs dernière édition par 20 juil. 2016, 19:13

                                        @‘Plaigon’:

                                        File ta classe PacketArrow et l’endroit de ta classe principale où tu l’enregistres.

                                        Et puis c’est normal que plusieurs flèches différentes soienr envoyées alors que tu n’en souhaites qu’une seul, regarde un peu toutes tes conditions. Y’a plein de if à la suite, donc normal que tout ton code s’enchaîne à la lecture du code. Remplace les par des else if, si tu ne veux qu’une seule par type ne soit envoyée.

                                        Tien:
                                        J’ai mis des else if c’est pareil
                                        Classe principale:

                                        network = NetworkRegistry.INSTANCE.newSimpleChannel("lc:");
                                        network.registerMessage(PacketClassesGUI.Handler.class, PacketClassesGUI.class, 0, Side.SERVER);
                                        network.registerMessage(PacketGuerrier.Handler.class, PacketGuerrier.class, 1, Side.SERVER);
                                        network.registerMessage(PacketArrow.Handler.class, PacketArrow.class, 2, Side.SERVER);
                                        network.registerMessage(PacketTitle.Handler.class, PacketTitle.class, 3, Side.CLIENT);

                                        PacketArrow:

                                        package net.legacymod.packets;
                                        import io.netty.buffer.ByteBuf;
                                        import net.minecraft.entity.player.EntityPlayer;
                                        import net.minecraft.entity.projectile.EntityArrow;
                                        import net.minecraft.util.Vec3;
                                        import cpw.mods.fml.common.network.simpleimpl.IMessage;
                                        import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
                                        import cpw.mods.fml.common.network.simpleimpl.MessageContext;
                                        public class PacketArrow implements IMessage{
                                        private float f1;
                                        private static int i;
                                            public PacketArrow(){ 
                                            }
                                            public PacketArrow(float f, int i) {
                                            this.f1 = f;
                                            this.i = i;
                                            }
                                            @Override
                                            public void fromBytes(ByteBuf buf) {
                                            f1 = buf.readFloat();
                                            i = buf.readInt();
                                            }
                                            @Override
                                            public void toBytes(ByteBuf buf) {
                                            buf.writeFloat(f1);
                                            buf.writeInt(i);
                                            }
                                            public static class Handler implements IMessageHandler <packetarrow, imessage="">{
                                                @Override
                                                public IMessage onMessage(PacketArrow message, MessageContext ctx) {
                                                EntityArrow entityarrow = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i);
                                                EntityArrow entityarrow2 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i);
                                                EntityArrow entityarrow3 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i);
                                                EntityArrow entityarrow4 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i);
                                                EntityArrow entityarrow5 = new EntityArrow(ctx.getServerHandler().playerEntity.worldObj, ctx.getServerHandler().playerEntity, message.f1 + message.i);
                                                switch(i)
                                                {
                                                case 1:
                                                {
                                                entityarrow.getEntityData().setBoolean("isExplosive", true);
                                                ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow);
                                                break;
                                                }
                                                case 2:
                                                {
                                                ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow);
                                                    ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow2);
                                                    ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow3);
                                                    ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow4);
                                                    ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow5);
                                                    Vec3 look = ctx.getServerHandler().playerEntity.getLookVec();
                                                    entityarrow.setPosition(
                                                    ctx.getServerHandler().playerEntity.posX + look.xCoord,
                                                    ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord,
                                                    ctx.getServerHandler().playerEntity.posZ + look.zCoord);
                                                    entityarrow2.setPosition(
                                                    ctx.getServerHandler().playerEntity.posX + 1 + look.xCoord,
                                                    ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord,
                                                    ctx.getServerHandler().playerEntity.posZ + look.zCoord);
                                                    entityarrow3.setPosition(
                                                    ctx.getServerHandler().playerEntity.posX + look.xCoord,
                                                    ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord,
                                                    ctx.getServerHandler().playerEntity.posZ + 1 + look.zCoord);
                                                    entityarrow4.setPosition(
                                                    ctx.getServerHandler().playerEntity.posX - 1 + look.xCoord,
                                                    ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord,
                                                    ctx.getServerHandler().playerEntity.posZ + look.zCoord);
                                                    entityarrow5.setPosition(
                                                    ctx.getServerHandler().playerEntity.posX + look.xCoord,
                                                    ctx.getServerHandler().playerEntity.posY + 1 + look.yCoord,
                                                    ctx.getServerHandler().playerEntity.posZ - 1 + look.zCoord);
                                                    break;
                                                }
                                                case 3:
                                                {
                                                ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(entityarrow);
                                                    entityarrow.setFire(2 * 5);
                                                    break;
                                                }
                                                default:
                                                break;
                                                }
                                                return null;
                                                }
                                            }
                                        }

                                        edit:
                                        Help?</packetarrow,>

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • Gabs
                                          Gabs dernière édition par 23 juil. 2016, 14:25

                                          Personne ne sait ?

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 6
                                          • 1 / 6
                                          18 sur 104
                                          • Premier message
                                            18/104
                                            Dernier message
                                          Design by Woryk
                                          Contact / Mentions Légales

                                          MINECRAFT FORGE FRANCE © 2018

                                          Powered by NodeBB