MFF

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

    Temps de recharge dans un onRightClickEvent

    Planifier Épinglé Verrouillé Déplacé Résolu 1.9.x et 1.10.x
    1.10.x
    49 Messages 5 Publieurs 6.8k 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.
    • DeletedD Hors-ligne
      Deleted
      dernière édition par

      Change le 2 * 20 par 30 * 20

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

        Ouais nickel! par contre j’ai un problème quand je met mon code dans une autre classe avec un autre timer mon "sors ne se lance jamais.
        Je pense que je le fait que il y est deux fonction onupdate dans la même classe fait un conflit et mon second timer ne marche pas ( celui avec le hitentity )

        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

          Code ?

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

            Tien:

            
            public class epee extends ItemSword {
            
            public epee(ToolMaterial p_i45356_1_) {
            super(p_i45356_1_);
            }
            @Override
            public void onUpdate(ItemStack item, World world, Entity player,
            int slotIndex, boolean inHand) {
            if (item.hasTagCompound())
            {
            if (item.stackTagCompound.getInteger("timer2") > 0)
            {
            item.stackTagCompound.setInteger("timer2",
            (int) (item.stackTagCompound.getInteger("timer2") + 1));
            }
            if (item.stackTagCompound.getInteger("timer2") >= (int) (45 * 20))
            {
            item.stackTagCompound.setInteger("timer2", 0);
            }
            }
            super.onUpdate(item, world, player, slotIndex, inHand);
            }
            
            public ItemStack onItemRightClick(ItemStack item, World world,
            EntityPlayer player) {
            if (!item.hasTagCompound())
            {
            item.setTagCompound(new NBTTagCompound());
            item.stackTagCompound.setInteger("timer2", 0);
            }
            if (item.stackTagCompound.getInteger("timer2") == 0
            && ServerProxy.RANK.get(player.getUniqueID()) == EnumRank.GUERRIER) {
            player.addPotionEffect(new PotionEffect(Potion.digSpeed.id,
            600, 0));
            item.stackTagCompound.setInteger("timer2", 1);// On le met à 1 pour
            // pouvoir rentrer
            // dans la condition
            // de onUpdate()
            world.playSoundAtEntity(player, "sounds/fireworks/blast_far1", 1, 1);
            // world.spawnParticle("smoke", (double)(player.posX),
            // (double)(player.posY), (double)(player.posZ), 0.0D, 0.0D, 0.0D);
            } else {
            if (world.isRemote)
            player.addChatComponentMessage(new ChatComponentTranslation(
            "Tu dois attendre que le sort se recharge !"));// On
            // indique
            // au
            // joueur
            // via
            // ce
            // message
            // si le
            // timer
            // n'est
            // pas
            // encore
            // arrivé
            // à la
            // limite
            // souhaitée
            }
            return item;
            }
            
            @SideOnly(Side.CLIENT)
            public boolean hasEffect(ItemStack item)
            {
            return item.hasTagCompound() ? (item.stackTagCompound.getInteger("timer2")
            == 0 ? true : false) : false;//On vérifie déjà si l'ItemStack a set un
            // NBTTagCompound si oui, on vérifie si Timer en fait partie et si il est
            //égal à 0, si oui, on return true à la méthode
            }
            
            public void addInformation(ItemStack item, EntityPlayer player, List list,
            boolean par4) {
            if(ServerProxy.RANK.get(player.getUniqueID()) == EnumRank.GUERRIER){
            list.add("§6Epee de guerrier !");
            list.add("§6Seul les plus puissants,");
            list.add("§6peuvent porter cette arme !");
            }else{
            list.add("§cVous n'êtes pas Guerrier");
            list.add("§cvous ne devez pas avoir");
            list.add("§ccette épée sur vous!");
            }
            }
            
            public void onUpdate2(ItemStack stack, World world, Entity entity, int slotIndex, boolean isInhand)
            {
            super.onUpdate(stack, world, entity, slotIndex, isInhand);
            if(!stack.hasTagCompound())
            stack.setTagCompound(new NBTTagCompound());
            
            int timer = !stack.getTagCompound().hasKey("timer") ? 0 : stack.getTagCompound().getInteger("timer");
            timer++;
            stack.getTagCompound().setInteger("timer", timer);
            
            System.out.println(stack.stackTagCompound.getInteger("timer"));
            }
            
                public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                {
                if(stack.getTagCompound().getInteger("timer") >= 30 * 20 && ClientProxy.keyBindSortG.isPressed())
                {
                target.setFire(20 * 20);
                target.attackEntityFrom(DamageSource.inFire, 5 * 2);
                stack.getTagCompound().setInteger("timer", 0);
                System.out.println("§c[Sort] §8Frappe foudroyante lancée!");
                EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
            ChatComponentText text1 = new ChatComponentText("§c[Sort] §8Frappe foudroyante lancée!");
            player1.addChatComponentMessage(text1);
            EntityPlayer player = Minecraft.getMinecraft().thePlayer;
                    MinecraftServer.getServer().getCommandManager().executeCommand(player, "weather lightning");
                }else if (stack.getTagCompound().getInteger("timer") != 30 * 20 && ClientProxy.keyBindSortG.isPressed()){
                System.out.println("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
            ChatComponentText text1 = new ChatComponentText("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
            player1.addChatComponentMessage(text1);
                }
                    return true;
                }
            
            }
            
            
            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

              Ta fonction onUpdate2 n’est jamais appelé.

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

                Ah bon?

                pour quoi alors dans cette classe ça marche ?

                
                public class test extends ItemSword{
                
                private static Minecraft mc;
                
                public test(ToolMaterial p_i45356_1_) {
                super(p_i45356_1_);
                // TODO Auto-generated constructor stub
                }
                
                public void onUpdate2(ItemStack stack, World world, Entity entity, int slotIndex, boolean isInhand)
                {
                super.onUpdate(stack, world, entity, slotIndex, isInhand);
                if(!stack.hasTagCompound())
                stack.setTagCompound(new NBTTagCompound());
                
                int timer = !stack.getTagCompound().hasKey("timer") ? 0 : stack.getTagCompound().getInteger("timer");
                timer++;
                stack.getTagCompound().setInteger("timer", timer);
                
                // System.out.println(stack.stackTagCompound.getInteger("timer"));
                }
                
                   public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                   {
                    if(stack.getTagCompound().getInteger("timer") >= 30 * 20 && ClientProxy.keyBindSortG.isPressed())
                    {
                    target.setFire(20 * 20);
                    target.attackEntityFrom(DamageSource.inFire, 5 * 2);
                    stack.getTagCompound().setInteger("timer", 0);
                    System.out.println("§c[Sort] §8Frappe foudroyante lancée!");
                    EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
                ChatComponentText text1 = new ChatComponentText("§c[Sort] §8Frappe foudroyante lancée!");
                player1.addChatComponentMessage(text1);
                    }else if (stack.getTagCompound().getInteger("timer") != 30 * 20 && ClientProxy.keyBindSortG.isPressed()){
                    System.out.println("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                    EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
                ChatComponentText text1 = new ChatComponentText("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                player1.addChatComponentMessage(text1);
                    }
                       return true;
                   }
                
                }
                
                

                Je n’ai pourtant rien changer

                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

                  Ajoute un print dans la fonction onUpdate2, je doute qu’il sera dans la console.

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

                    [23:16:11] [main/INFO] [GradleStart]: username: floriangabet
                    [23:16:11] [main/INFO] [GradleStart]: Extra: []
                    [23:16:11] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --username, floriangabet, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
                    [23:16:11] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
                    [23:16:11] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading
                    [23:16:11] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre
                    [23:16:11] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
                    [23:16:11] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
                    [23:16:11] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
                    [23:16:11] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
                    [23:16:11] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                    [23:16:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
                    [23:16:11] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
                    [23:16:12] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
                    [23:16:12] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
                    [23:16:12] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
                    [23:16:12] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
                    [23:16:12] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
                    [23:16:12] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
                    [23:16:12] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
                    [23:16:12] [main/INFO]: Setting user: floriangabet
                    [23:16:13] [Client thread/INFO]: LWJGL Version: 2.9.1
                    [23:16:13] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
                    [23:16:13] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized
                    [23:16:13] [Client thread/INFO] [FML]: Replaced 183 ore recipies
                    [23:16:13] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
                    [23:16:13] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\mods for mods
                    [23:16:13] [Client thread/INFO] [lc]: Mod lc is missing the required element 'name'. Substituting lc
                    [23:16:15] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
                    [23:16:15] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at CLIENT
                    [23:16:15] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at SERVER
                    [23:16:15] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip
                    [23:16:15] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
                    [23:16:15] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
                    [23:16:15] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
                    [23:16:15] [Client thread/INFO] [FML]: Applying holder lookups
                    [23:16:15] [Client thread/INFO] [FML]: Holder lookups applied
                    [23:16:15] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                    [23:16:15] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem…
                    [23:16:15] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL
                    [23:16:15] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
                    [23:16:15] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.
                    [23:16:16] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                    [23:16:16] [Sound Library Loader/INFO]: Sound engine started
                    [23:16:18] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas
                    [23:16:18] [Client thread/INFO]: Created: 256x256 textures/items-atlas
                    [23:16:18] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
                    [23:16:18] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip
                    [23:16:20] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas
                    [23:16:20] [Client thread/INFO]: Created: 256x256 textures/items-atlas
                    [23:16:20] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                    [23:16:20] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down…
                    [23:16:21] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]:     Author: Paul Lamb, www.paulscode.com
                    [23:16:21] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                    [23:16:21] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                    [23:16:21] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem…
                    [23:16:21] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL
                    [23:16:21] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
                    [23:16:21] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.
                    [23:16:21] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                    [23:16:21] [Sound Library Loader/INFO]: Sound engine started
                    [23:16:38] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10
                    [23:16:38] [Server thread/INFO]: Generating keypair
                    [23:16:38] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance
                    [23:16:38] [Server thread/INFO] [FML]: Applying holder lookups
                    [23:16:38] [Server thread/INFO] [FML]: Holder lookups applied
                    [23:16:38] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@143a4d5)
                    [23:16:38] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@143a4d5)
                    [23:16:38] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@143a4d5)
                    [23:16:38] [Server thread/INFO]: Preparing start region for level 0
                    [23:16:39] [Server thread/INFO]: Changing view distance to 8, from 10
                    [23:16:39] [Netty Client IO #0/INFO] [FML]: Server protocol version 1
                    [23:16:39] [Netty IO #1/INFO] [FML]: Client protocol version 1
                    [23:16:39] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.85.1291,lc@1.0,Forge@10.13.2.1291,mcp@9.05
                    [23:16:39] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT
                    [23:16:39] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER
                    [23:16:39] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established
                    [23:16:39] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
                    [23:16:39] [Server thread/INFO]: floriangabet[local:E:f2873c73] logged in with entity id 351 at (-112.00548187674536, 70.0, 213.7653439587637)
                    [23:16:39] [Server thread/INFO]: floriangabet joined the game
                    1411
                    1412
                    1413
                    1414
                    1412
                    1413
                    1414
                    1415
                    1415
                    1415
                    1416
                    1416
                    1417
                    1418
                    1418
                    1419
                    1419
                    1419
                    1420
                    1420
                    1421
                    1421
                    1422
                    1423
                    1424
                    1423
                    1424
                    1425
                    1425
                    1425
                    1426
                    1426
                    1427
                    1427
                    1428
                    1428
                    1429
                    1429
                    1430
                    1430
                    1431
                    1432
                    1432
                    1433
                    1434
                    1433
                    1434
                    1435
                    1435
                    1436
                    1436
                    1436
                    1437
                    1437
                    1438
                    1438
                    1439
                    1439
                    1440
                    1440
                    1441
                    1442
                    1443
                    1442
                    1443
                    1444
                    1444
                    1445
                    1445
                    1446
                    1446
                    1446
                    1447
                    1447
                    1448
                    1448
                    1449
                    1449
                    1450
                    1450
                    1451
                    1451
                    1452
                    1452
                    1453
                    1453
                    1454
                    1455
                    1456
                    1455
                    1456
                    1457
                    1457
                    1458
                    1458
                    1458
                    1459
                    1459
                    1460
                    1460
                    1461
                    1461
                    1462
                    1462
                    1463
                    1463
                    1464
                    1464
                    1465
                    1465
                    1466
                    1466
                    1467
                    1467
                    1468
                    1468
                    1469
                    1470
                    1470
                    1471
                    1471
                    1471
                    1472
                    1472
                    1473
                    1473
                    1474
                    1474
                    1475
                    1475
                    1476
                    1476
                    1477
                    1477
                    1478
                    1478
                    1479
                    1479
                    1480
                    1480
                    1481
                    1481
                    1482
                    1482
                    1483
                    1483
                    1484
                    1485
                    1486
                    1485
                    1486
                    1487
                    1487
                    1488
                    1488
                    1488
                    1489
                    1489
                    1490
                    1490
                    1491
                    1491
                    1492
                    1492
                    1493
                    1493
                    1494
                    1494
                    1495
                    1495
                    1496
                    1496
                    1497
                    1497
                    1498
                    1498
                    1499
                    1499
                    1500
                    1500
                    1501
                    1501
                    1502
                    1502
                    1503
                    1503
                    1504
                    1504
                    1505
                    1505
                    1506
                    1506
                    1507
                    1507
                    1508
                    1508
                    1509
                    1509
                    1510
                    1510
                    1511
                    1511
                    1512
                    1512
                    1513
                    1513
                    1514
                    1514
                    1515
                    1515
                    1516
                    1516
                    1517
                    1517
                    1518
                    1518
                    1519
                    1519
                    1520
                    1520
                    1521
                    1521
                    1522
                    1522
                    1523
                    1524
                    1525
                    1524
                    1525
                    1526
                    1526
                    1526
                    1527
                    1527
                    1528
                    1528
                    1529
                    1529
                    1530
                    1530
                    1531
                    1532
                    1532
                    1533
                    1533
                    1533
                    1534
                    1534
                    1535
                    1535
                    1536
                    1536
                    1537
                    1537
                    1538
                    1538
                    1539
                    1539
                    1540
                    1540
                    1541
                    1541
                    1542
                    1542
                    1543
                    1543
                    1544
                    1544
                    1545
                    1545
                    1546
                    1546
                    1547
                    1547
                    1548
                    1548
                    1549
                    1549
                    1550
                    1550
                    1551
                    1551
                    1552
                    1552
                    1553
                    1553
                    1554
                    1554
                    1555
                    1555
                    1556
                    1556
                    1557
                    1557
                    1558
                    1559
                    1560
                    1559
                    1560
                    1561
                    1561
                    1562
                    1562
                    1563
                    1563
                    1563
                    1564
                    1564
                    1564
                    1565
                    1566
                    1565
                    1567
                    1568
                    1568
                    1569
                    1569
                    1569
                    1570
                    1570
                    1571
                    1571
                    1572
                    1572
                    1573
                    1573
                    1574
                    1574
                    1575
                    1575
                    1576
                    1576
                    1577
                    1577
                    1578
                    1578
                    1579
                    1579
                    1580
                    1580
                    1581
                    1581
                    1582
                    1582
                    1583
                    1583
                    1584
                    1584
                    1585
                    1585
                    1586
                    1586
                    1587
                    1587
                    1588
                    1588
                    1589
                    1589
                    1590
                    1590
                    1591
                    1591
                    1592
                    1592
                    1593
                    1593
                    1594
                    1594
                    1595
                    1595
                    1596
                    1596
                    1597
                    1597
                    1598
                    1598
                    1599
                    1599
                    1600
                    1600
                    1601
                    1601
                    1602
                    1602
                    1603
                    1603
                    1604
                    1604
                    1605
                    1605
                    1606
                    1606
                    1607
                    1608
                    1608
                    1609
                    1609
                    1609
                    1610
                    1610
                    1611
                    1611
                    1612
                    1612
                    1613
                    1614
                    1614
                    1615
                    1615
                    1615
                    1616
                    1616
                    1617
                    1617
                    1618
                    1618
                    1619
                    1619
                    1620
                    1620
                    1621
                    1621
                    1622
                    1622
                    1623
                    1623
                    1624
                    1624
                    1625
                    1625
                    1626
                    1626
                    1627
                    1627
                    1628
                    1628
                    1629
                    1629
                    1630
                    1630
                    1631
                    1631
                    1632
                    1632
                    1633
                    1633
                    1634
                    1634
                    1635
                    1635
                    1636
                    1636
                    1637
                    1637
                    1638
                    1638
                    1639
                    1639
                    1640
                    1640
                    1641
                    1641
                    1642
                    1642
                    1643
                    1643
                    1644
                    1644
                    1645
                    1645
                    1646
                    1646
                    1647
                    1647
                    1648
                    1648
                    1649
                    1649
                    1650
                    1650
                    1651
                    1651
                    1652
                    1652
                    1653
                    1653
                    1654
                    1654
                    1655
                    1655
                    1656
                    1656
                    1657
                    1657
                    1658
                    1658
                    1659
                    1659
                    1660
                    1660
                    1661
                    1661
                    1662
                    1662
                    1663
                    1663
                    1664
                    1664
                    1665
                    1665
                    1666
                    1666
                    1667
                    1667
                    1668
                    1668
                    1669
                    1669
                    1670
                    1670
                    1671
                    1671
                    1672
                    1672
                    1673
                    1673
                    1674
                    1674
                    1675
                    1675
                    1676
                    1676
                    1677
                    1677
                    1678
                    1678
                    1679
                    1679
                    1680
                    1680
                    1681
                    1681
                    1682
                    1682
                    1683
                    1683
                    1684
                    1684
                    1685
                    1685
                    1686
                    1686
                    1687
                    1687
                    1688
                    1688
                    1689
                    1689
                    1690
                    1690
                    1691
                    1691
                    1692
                    1692
                    1693
                    1693
                    1694
                    1694
                    1695
                    1695
                    
                    

                    Enfin cela doit être surement un bug… sinon pour l’appeler je procèdes comment ?

                    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

                      Tu mets le code qui se trouve dans onUpdate2 dans la fonction onUpdate.

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

                        Ahhh ok j’ai compris en fait la fonction s’appelle onupdate et si tu la change elle n’est plus reconnu donc elle marche pas ok^^ merci 🙂

                        edit: Une dernière petit question on je peux avoir la liste des sons de minecraft? merci

                        world.playSoundAtEntity(player, “sound ???”, 1, 1);

                        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

                          Oui, dans le fichier sounds.json de minecraft.
                          Pour le trouver tu vas dans .minecraft/assets/indexes et tu ouvres le fichier 1.7.10.json (comme tu es en 1.7.10).
                          Dedans cherche sounds.json :

                          "minecraft/sounds.json": {
                          "hash": "fce0bb3e14ade7b292a7c1d5fa785533d8106d82",
                          "size": 34020
                          },
                          

                          son hash est fce0bb3e14ade7b292a7c1d5fa785533d8106d82, donc le fichier se trouve dans le dossier
                          .minecraft/assets/objects/fc
                          C’est le fichier fce0bb3e14ade7b292a7c1d5fa785533d8106d82
                          Il n’a pas d’extension mais tu peux quand même l’ouvre avec un éditeur de texte.
                          (Linux se base sous le type MIME contrairement à Windows qui se base sur les extensions, donc sous Linux le fichier est même directement reconnu comme fichier texte).

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

                            D’accord merci :).
                            Sinon j’ai une question

                            Si je veux faire que lorsque le joueur tape une entity (hitentity) toute les entity qui se trouve dans un rayon de 3 blocks (de l’entity que je viens de taper) prenne feu comment je peux faire ?

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

                              Tu dois te servir des AxisAlignedBB, regarde le tuto d’elias sur comment faire une entity qui régénère ses sous-fifres

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

                                D’acc merci 🙂
                                J’essaye ça!

                                edit:
                                j’ai un soucis a cette ligne: List list = worldObj.getEntitiesWithinAABB(EntityCreature.class, AxisAlignedBB.getAABBPool().getAABB(posX, posY, posZ, posX + 1, posY + 1, posZ + 1).expand(16D, 4D, 16D));

                                le soucis est a .getAABBPool() il me dis que il n’existe pas, possible car la version du tuto de elias est en 1.7.2 😕 .

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

                                  Il faut remplacer “getAABBPool().getAABB(…)” par “getBoundingBox(…)”, tu aurais pu regarder dans la classe pour trouver.

                                  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 1
                                  • GabsG Hors-ligne
                                    Gabs
                                    dernière édition par

                                    @‘AymericRed’:

                                    Il faut remplacer “getAABBPool().getAABB(…)” par “getBoundingBox(…)”, tu aurais pu regarder dans la classe pour trouver.

                                    Je l’avais vus m’ais j’étais pas sur x) Merci 🙂
                                    J’ai fais sa ça marche je reviens vers vous si j’ai un soucis! 
                                    Merci beaucoup 🙂

                                    
                                     public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                                       {
                                    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
                                    World worldObj = player.worldObj;
                                    
                                    double posX = attacker.posX;
                                    double posY = attacker.posY;
                                    double posZ = attacker.posZ;
                                    
                                    List list = worldObj.getEntitiesWithinAABB(EntityCreature.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1).expand(16D, 4D, 16D));
                                    for(int i = 0; i< list.size(); i++)
                                    {
                                    Entity entity = (Entity)list.get(i);
                                    if(!list.isEmpty())
                                    {
                                    if(!(entity instanceof EntityPlayer))
                                    {
                                    target.setDead(); //entity que tu tappe elle meurt
                                    entity.setDead(); // entity autour de toi qui meurt
                                    System.out.println(list);
                                    }
                                    }
                                    }
                                    return true;
                                    
                                    }
                                    
                                    
                                    1 réponse Dernière réponse Répondre Citer 0
                                    • GabsG Hors-ligne
                                      Gabs
                                      dernière édition par

                                      J’ai un problème pourquoi quand je fais:

                                      target.setFire(1 * 20);
                                      entity.setFire(1 * 20);

                                      le target prend feu mais pas les entity autour normal?

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

                                        Oui car le for parcourt toute les entitées proches, si tu veux que ça ne soit que la cible, il faut mettre target.setFire(…) en dehors du for le retirer.

                                        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
                                        • GabsG Hors-ligne
                                          Gabs
                                          dernière édition par

                                          Quoi??? j’ai pas compris la phrase.
                                          edit:
                                          J’ai fais ça mais c’est pareil:

                                          
                                           public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                                             {
                                          EntityPlayer player = Minecraft.getMinecraft().thePlayer;
                                          World worldObj = player.worldObj;
                                          
                                          double posX = attacker.posX;
                                          double posY = attacker.posY;
                                          double posZ = attacker.posZ;
                                          
                                          List list = worldObj.getEntitiesWithinAABB(EntityCreature.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1).expand(6D, 4D, 6D));
                                          target.setFire(1 * 20);
                                          for(int i = 0; i< list.size(); i++)
                                          {
                                          Entity entity = (Entity)list.get(i);
                                          if(!list.isEmpty())
                                          {
                                          
                                          entity.setFire(1 * 20);
                                          System.out.println(list);
                                          
                                          }
                                          }
                                          return true;
                                          
                                          
                                          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

                                            @‘floriangabet’:

                                            J’ai un problème pourquoi quand je fais:

                                            target.setFire(1 * 20);
                                            entity.setFire(1 * 20);

                                            le target prend feu mais les entity autour normal?

                                            Il manque un “pas” dans la phrase non ?

                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB