MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Encore problème onUpdate

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    104 Messages 8 Publieurs 18.1k Vues 1 Watching
    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.
    • GabsG Hors-ligne
      Gabs
      dernière édition par

      @‘SCAREX’:

      Oui mais à quoi sert le PacketArrow alors ?

      D’ailleurs je ne comprends pas ce que tu veux faire avec ce code :

      if(stack != null){
         stack.setTagCompound(new NBTTagCompound()); // Tu supprimes tous les tags de l'item
         NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound(); // Ensuite tu récupères les tags (qui sont nuls désormais)
         stack.getTagCompound().setTag("key", nbt); // et tu mets les tags de l'item (qui sont nuls) dans un tag "key" dans l'item
         }
      

      [font=Ubuntu, sans-serifCitation de SCAREX: Est-ce que ce ne serai pas plus simple de modifier le metadata lorsqu’on appuie sur une touche et ensuite récupérer le metadata afin de savoir quelle sorte de flèche tirer ?]

      1 réponse Dernière réponse Répondre Citer 0
      • robin4002R Hors-ligne
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
        dernière édition par

        @‘robin4002’:

        Avec un outil ce n’est pas bon car le metadata est déjà utilisé pour l’usure de l’item.

        Au lieu de faire un setTag mets plutôt un integer qui correspond au mode de l’arc.

        1 réponse Dernière réponse Répondre Citer 0
        • GabsG Hors-ligne
          Gabs
          dernière édition par

          @‘robin4002’:

          @‘robin4002’:

          Avec un outil ce n’est pas bon car le metadata est déjà utilisé pour l’usure de l’item.

          Au lieu de faire un setTag mets plutôt un integer qui correspond au mode de l’arc.

          un integer qui correspond au mode de l’arc c’est a dire ? c’est quoi le mode de l’arc ?

          1 réponse Dernière réponse Répondre Citer 0
          • robin4002R Hors-ligne
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
            dernière édition par

            0 = normal
            1 = flèche de feu
            2 = autre truc
            etc …

            1 réponse Dernière réponse Répondre Citer 0
            • GabsG Hors-ligne
              Gabs
              dernière édition par

              @‘robin4002’:

              0 = normal
              1 = flèche de feu
              2 = autre truc
              etc …

              Ok^^

              J’ai fais ça:

              
              package net.legacymod.packets;
              
              import io.netty.buffer.ByteBuf;
              import net.legacymod.LegacyMod;
              import net.legacymod.gui.ClassesGUI;
              import net.minecraft.client.Minecraft;
              import net.minecraft.item.ItemStack;
              import net.minecraft.nbt.NBTTagCompound;
              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 PacketKey implements IMessage {
              
              public PacketKey(){
              
              }
              
              @Override
              public void fromBytes(ByteBuf buf) {
              
              }
              
              @Override
              public void toBytes(ByteBuf buf) {
              
              }
              
              public static class Handler implements IMessageHandler <packetkey, imessage="">{
              
                 public IMessage onMessage(PacketKey message, MessageContext ctx) {
              
                  ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack();
                  if(stack != null){
                  stack.setTagCompound(new NBTTagCompound());
                  NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound();
                  stack.getTagCompound().setInteger("key", 3);
                  System.out.println("packet");
                  }
                  return null;
              
                     }
                 }
              }
              
              

              Arc:

              
                         else if (!world.isRemote && stack.getTagCompound().getInteger("key") == 3)
                         {
                          LegacyMod.network.sendToServer(new PacketArrow(f * 2.0F, 3));
                          System.out.println("flèche en feu");
                          //stack.getTagCompound().setInteger("timer2", 0);
                         }
              
              

              console:

              
              [00:54:44] [Server thread/INFO]: floriangabet a rejoint la partie
              [00:54:45] [Client thread/INFO] [STDOUT]: [net.legacymod.proxy.ClientProxy:keyTestTyped2:91]: num pad 6
              [00:54:47] [Server thread/INFO] [STDOUT]: [net.legacymod.items.FlameBow:onPlayerStoppedUsing:142]: flèche normale
              
              

              Marche pas.</packetkey,>

              1 réponse Dernière réponse Répondre Citer 0
              • robin4002R Hors-ligne
                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                dernière édition par

                Pourquoi tu as encore PacketArrow ?
                Tu es déjà côté serveur, effectue directement le tire.

                Et on ne va pas avancer si tu donnes que des petits bouts de code …

                1 réponse Dernière réponse Répondre Citer 0
                • GabsG Hors-ligne
                  Gabs
                  dernière édition par

                  Ah oui exact.

                  Marche toujours pas, donc tien:

                  Arc:

                  
                  package net.legacymod.items;
                  
                  import cpw.mods.fml.relauncher.Side;
                  import cpw.mods.fml.relauncher.SideOnly;
                  import net.legacymod.LegacyMod;
                  import net.legacymod.packets.PacketArrow;
                  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.NBTBase;
                  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(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);
                             }
                  
                             else if (!world.isRemote && stack.getTagCompound().getInteger("key") == 3) // c'est ici le reste des else if je m'en charge une fois celui-ci opérationnel.
                             {
                          world.spawnEntityInWorld(entityarrow);
                              entityarrow.setFire(2 * 5);
                              System.out.println("flèche en feu");
                              //stack.getTagCompound().setInteger("timer2", 0);
                             }
                             else 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");
                             }
                         }
                     }
                  
                     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){
                  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);
                  }
                  
                  }
                  
                  

                  Proxy:

                  
                  package net.legacymod.proxy;
                  
                  import net.legacymod.LegacyMod;
                  import net.legacymod.items.ItemEpee3D;
                  import net.legacymod.mobs.EntityAlienMob;
                  import net.legacymod.mobs.RenderAlienMob;
                  import net.legacymod.mobs.alien;
                  import net.legacymod.packets.PacketClassesGUI;
                  import net.legacymod.packets.PacketKey;
                  import net.minecraft.client.Minecraft;
                  import net.minecraft.client.settings.KeyBinding;
                  import net.minecraft.entity.player.EntityPlayer;
                  import net.minecraft.item.ItemStack;
                  import net.minecraft.nbt.NBTTagCompound;
                  import net.minecraft.world.World;
                  import net.minecraftforge.client.IItemRenderer;
                  import net.minecraftforge.client.MinecraftForgeClient;
                  
                  import org.lwjgl.input.Keyboard;
                  
                  import cpw.mods.fml.client.registry.ClientRegistry;
                  import cpw.mods.fml.client.registry.RenderingRegistry;
                  import cpw.mods.fml.common.FMLCommonHandler;
                  import cpw.mods.fml.common.event.FMLInitializationEvent;
                  import cpw.mods.fml.common.event.FMLPreInitializationEvent;
                  import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                  import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
                  
                  public class ClientProxy extends CommonProxy{
                  
                      private static KeyBinding keyBindGUI;
                      public static KeyBinding keyBindSortG1;
                      public static KeyBinding keyBindSortG2;
                  
                  @Override
                     public void preInit(FMLPreInitializationEvent e)
                     {
                  
                     }
                  
                  @Override
                  public void init(FMLInitializationEvent e) {
                  RenderingRegistry.registerEntityRenderingHandler(EntityAlienMob.class, new RenderAlienMob(new alien(), 0.5F));
                  MinecraftForgeClient.registerItemRenderer(LegacyMod.epee, (IItemRenderer)new ItemEpee3D());
                  }
                  
                     public ClientProxy(){
                      FMLCommonHandler.instance().bus().register(this);
                      keyBindGUI = new KeyBinding("Choix de grade!", Keyboard.KEY_NUMPAD5, "key.categories.gameplay");
                         ClientRegistry.registerKeyBinding(keyBindGUI);
                  
                         keyBindSortG1 = new KeyBinding("Sort Guerrier 1", Keyboard.KEY_NUMPAD6, "key.categories.gameplay");
                         ClientRegistry.registerKeyBinding(keyBindSortG1);
                  
                         keyBindSortG2 = new KeyBinding("Sort Guerrier 2", Keyboard.KEY_NUMPAD7, "key.categories.gameplay");
                         ClientRegistry.registerKeyBinding(keyBindSortG2);
                     }
                  
                     @SubscribeEvent
                     public void onEvent(KeyInputEvent event)
                     {
                         if(keyBindGUI.isPressed())
                         {
                             keyTestTyped();
                         }
                     }
                  
                     private void keyTestTyped()
                     {
                         EntityPlayer player = Minecraft.getMinecraft().thePlayer;
                         World world = player.worldObj;
                         LegacyMod.network.sendToServer(new PacketClassesGUI());
                  
                     }
                  
                     @SubscribeEvent
                     public void onEvent2(KeyInputEvent event)
                     {
                         if(keyBindSortG1.isPressed())
                         {
                             keyTestTyped2();
                         }
                     }
                  
                     private void keyTestTyped2()
                     {
                      LegacyMod.network.sendToServer(new PacketKey());   
                      System.out.println("num pad 6");
                     }
                  
                  }
                  
                  

                  Packetkey:

                  
                  package net.legacymod.packets;
                  
                  import io.netty.buffer.ByteBuf;
                  import net.legacymod.LegacyMod;
                  import net.legacymod.gui.ClassesGUI;
                  import net.minecraft.client.Minecraft;
                  import net.minecraft.item.ItemStack;
                  import net.minecraft.nbt.NBTTagCompound;
                  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 PacketKey implements IMessage {
                  
                  public PacketKey(){
                  
                  }
                  
                  @Override
                  public void fromBytes(ByteBuf buf) {
                  
                  }
                  
                  @Override
                  public void toBytes(ByteBuf buf) {
                  
                  }
                  
                  public static class Handler implements IMessageHandler <packetkey, imessage="">{
                  
                     public IMessage onMessage(PacketKey message, MessageContext ctx) {
                  
                      ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack();
                      if(stack != null){
                      stack.setTagCompound(new NBTTagCompound());
                      NBTTagCompound nbt = (NBTTagCompound) stack.getTagCompound();
                      stack.getTagCompound().setInteger("key", 3);
                      System.out.println("packet");
                      }
                      return null;
                  
                         }
                     }
                  }
                  
                  ```</packetkey,>
                  1 réponse Dernière réponse Répondre Citer 0
                  • robin4002R Hors-ligne
                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                    dernière édition par

                    fais un print de stack.getTagCompound().getInteger(“key”) pour voir la valeur.

                    Le reste de ton code est aussi un gros bordel, tu devrais le réorganiser.

                    1 réponse Dernière réponse Répondre Citer 0
                    • GabsG Hors-ligne
                      Gabs
                      dernière édition par

                      @‘robin4002’:

                      fais un print de stack.getTagCompound().getInteger(“key”) pour voir la valeur.

                      Le reste de ton code est aussi un gros bordel, tu devrais le réorganiser.

                      Il est à 0 car le packet n’est pas envoyer j’ai mis un print dans mon packet dans les logs j’ai pas le print.

                      Pour le réorganiser c’est prévu!

                      edit:

                      J’ai rien dis j’ai mis un print dans frombyte:

                      [15:34:51] [Server thread/INFO] [STDOUT]: [net.legacymod.packets.PacketKey:fromBytes:23]: packet
                      

                      Mais le truc c’est que c’est toujours a 0

                      packet:

                      
                      public class PacketKey implements IMessage {
                      
                      public PacketKey(){
                      
                      }
                      
                      @Override
                      public void fromBytes(ByteBuf buf) {
                      System.out.println("packet");
                      }
                      
                      @Override
                      public void toBytes(ByteBuf buf) {
                      
                      }
                      
                      public static class Handler implements IMessageHandler <packetkey, imessage="">{
                      
                         public IMessage onMessage(PacketKey message, MessageContext ctx) {
                      
                          ItemStack stack = ctx.getServerHandler().playerEntity.inventory.getItemStack();
                          if(stack != null){
                          stack.setTagCompound(new NBTTagCompound());
                          stack.getTagCompound().setInteger("key", 3);
                          System.out.println("packet 2");
                          System.out.println(stack.getTagCompound().getInteger("key"));
                          }
                          return null;
                      
                             }
                         }
                      }
                      

                      log:

                      
                      [15:34:50] [Server thread/INFO]: floriangabet a rejoint la partie
                      [15:34:51] [Client thread/INFO] [STDOUT]: [net.legacymod.proxy.ClientProxy:keyTestTyped2:89]: num pad 6
                      [15:34:51] [Server thread/INFO] [STDOUT]: [net.legacymod.packets.PacketKey:fromBytes:23]: packet
                      [15:34:53] [Server thread/INFO] [STDOUT]: [net.legacymod.items.FlameBow:onPlayerStoppedUsing:144]: flèche normale
                      0
                      
                      ```</packetkey,>
                      1 réponse Dernière réponse Répondre Citer 0
                      • robin4002R Hors-ligne
                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                        dernière édition par

                        System.out.println(“packet 2”);
                        ne s’affiche pas.

                        Tu peux envoyer la ligne où tu as enregistré le paquet ?

                        1 réponse Dernière réponse Répondre Citer 0
                        • GabsG Hors-ligne
                          Gabs
                          dernière édition par

                          @‘robin4002’:

                          System.out.println(“packet 2”);
                          ne s’affiche pas.

                          Tu peux envoyer la ligne où tu as enregistré le paquet ?

                          Oui, 
                          tien:  ```java
                          network.registerMessage(PacketKey.Handler.class, PacketKey.class, 4, Side.SERVER);

                          1 réponse Dernière réponse Répondre Citer 0
                          • robin4002R Hors-ligne
                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                            dernière édition par

                            étrange, je ne vois pas pourquoi ça ne fonctionne pas.
                            Sinon envoies-moi un zip de ton dossier src.

                            1 réponse Dernière réponse Répondre Citer 0
                            • GabsG Hors-ligne
                              Gabs
                              dernière édition par

                              Mon src:

                              1 réponse Dernière réponse Répondre Citer 0
                              • robin4002R Hors-ligne
                                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                dernière édition par

                                La flèche de feu est ok, appuies sur 6 pour changer de mode.
                                En passant j’ai corrigé la convention Java et formaté ton code.

                                1 réponse Dernière réponse Répondre Citer 1
                                • GabsG Hors-ligne
                                  Gabs
                                  dernière édition par

                                  @‘robin4002’:

                                  La flèche de feu est ok, appuies sur 6 pour changer de mode.
                                  En passant j’ai corrigé la convention Java et formaté ton code.

                                  Super! merci c’est exactement se qui me fallait!

                                  Par contre j’ai un soucis,

                                  Je m’explique:

                                  Comme vous le savez très bien je veux faire un système de recharge pour chaque sort sur l’arc avec la fonction onUpdate.
                                  Le soucis est que cette fonction fait bug mon arc comme ceci: https://youtu.be/wThsb3Fi4jU
                                  Du coup pour évité ce problème je r’ajoute un world.isRemote comme ça:

                                  
                                   @Override
                                      public void onUpdate(ItemStack item, World world, Entity player, int slotIndex, boolean inHand)
                                      {
                                          if(!item.hasTagCompound())
                                          {
                                              item.setTagCompound(new NBTTagCompound());
                                          }
                                          if(world.isRemote) // Comme ça
                                          {
                                              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);
                                          }
                                      }
                                  

                                  Mais le soucis c’est que le world.isremote cause un soucis du coup les timers ils sont complètement faux j’ai fias un test sans le world.isremote avec le bug et la les timers marche.

                                  Du coup je vois pas du tout comment faire car même avec un !world.isRemote c’est le même soucis!

                                  J’espère que vous m’avez compris sinon faite le moi savoir!

                                  Merci en tout cas robin 😄

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • robin4002R Hors-ligne
                                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                    dernière édition par

                                    Faudrait voir si on peut désactiver la synchro du tag nbt.
                                    Car c’est ça qui fait ce bug visuel.

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • GabsG Hors-ligne
                                      Gabs
                                      dernière édition par

                                      D’acc je cherche de mon côté demain la je vais dodo !

                                      Edit:

                                      J’ai pas trouvé perso sur internet.

                                      C’est possible tu penses ?

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • BrokenSwingB Hors-ligne
                                        BrokenSwing Moddeurs confirmés Rédacteurs
                                        dernière édition par

                                        
                                        @Override
                                        public boolean getShareTag()
                                        {
                                        return false;
                                        }
                                        
                                        
                                        1 réponse Dernière réponse Répondre Citer 0
                                        • GabsG Hors-ligne
                                          Gabs
                                          dernière édition par

                                          @‘BrokenSwing’:

                                          
                                          @Override
                                          public boolean getShareTag()
                                          {
                                              return false;
                                          }
                                          
                                          

                                          Salut,

                                          J’ai ajouté cette fonction dans la classe de mon arc et j’ai ensuite enlever le world.isremote mais j’ai toujours le problème “visuel” comme dis robin.

                                          Je précise juste que ce bug influence aussi sur le “chargement” de l’arc c’est un peu compliqué a expliqué.

                                          Je sais pas si vous voyez se que je veux dire au pire vous avez mon src juste au dessus vous enlevez le if(world.isremote) dans la fonction onUpdate de l’arc et vous verrez par vous même.

                                          En tout cas merci quand même x) .

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • SCAREXS Hors-ligne
                                            SCAREX
                                            dernière édition par

                                            Je vais tester de mon côté, les sources n’ont pas été modifiées ?

                                            EDIT : j’ai pris les sources données par robin. Mis à part quelques petits trucs qui ne sont pas très correctes, le code est globalement bon. En revanche je n’est pas ton problème lorsque je test de mon côté, est-ce que tu testes sur cauldron ou quelque chose comme ça ?

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 2 / 6
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB