MFF

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

    Cable ( Redstone/TripWire ) explosif

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8
    46 Messages 4 Publieurs 8.2k 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.
    • SCAREXS Hors-ligne
      SCAREX
      dernière édition par

      onNeighborBlockChange est une méthode du block appelée lorsqu’un block voisin est mis à jour.

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

        Cela me donne le même résultat. Je ne pense pas qu’il faut utilier de conditions mais bon, je sais ps faire autrement

        ​public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock, Entity entity) {
        if(onNeighborBlockChange(worldIn, pos, state, Blocks.fire)) {
        worldIn.createExplosion(entity, 0.5D, 0.5D, 0.5D, 0.5F, true);
        }
        
        }
        

        Et je pense que la condition est le seul moyen de faire ce que je veut faire ( Je ne veut pas que çela explose d’un coup, dès que l’on pose du feu, mais 3-4 sec après )

        Membre fantôme
        Je développe maintenant un jeu sur UnrealEngine4


        Contact :…

        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

          Je disais d’utiliser onNeighborBlockChange au lieu d’utiliser updateTick …

          Mon dieu mais sérieusement u_U
          Un peu de logique :

          ​
          public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock, Entity entity) {
          if(world.getBlockState(pos.east()).getBlock() == Blocks.fire || world.getBlockState(pos.weast()).getBlock() == Blocks.fire ||world.getBlockState(pos.north()).getBlock() == Blocks.fire ||world.getBlockState(pos.south()).getBlock() == Blocks.fire) {
          worldIn.createExplosion(entity, 0.5D, 0.5D, 0.5D, 0.5F, true);
          }
          
          }
          
          1 réponse Dernière réponse Répondre Citer 0
          • EryahE Hors-ligne
            Eryah
            dernière édition par

            @‘Eryah’:

            Cela me donne le même résultat. Je ne pense pas qu’il faut utilier de conditions mais bon, je sais ps faire autrement

            ​public void **onNeighborBlockChange**(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock, Entity entity) {
            if(onNeighborBlockChange(worldIn, pos, state, Blocks.fire)) {
            worldIn.createExplosion(entity, 0.5D, 0.5D, 0.5D, 0.5F, true);
            }
            
            }
            

            Et je pense que la condition est le seul moyen de faire ce que je veut faire ( Je ne veut pas que çela explose d’un coup, dès que l’on pose du feu, mais 3-4 sec après )

            Membre fantôme
            Je développe maintenant un jeu sur UnrealEngine4


            Contact :…

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

              Y’avait un bug sur mon bloc, je l’ai orrigé, et maintenant, je crash quand je lance mon jeu

              –-- Minecraft Crash Report ----
              // You're mean.
              
              Time: 08/07/15 19:17
              Description: There was a severe problem during mod loading that has caused the game to fail
              
              net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException: Don't know how to convert ut:rafined_gunpowder_wire[east=true,north=true,south=true,west=true] back into data…
              at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:225)
              at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:182)
              at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:171)
              at eryah.usefulthings.blocks.BRefinedGunpowder.register(BRefinedGunpowder.java:70)
              at eryah.usefulthings.UsefulthingsMod.preInit(UsefulthingsMod.java:263)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:537)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
              at com.google.common.eventbus.EventBus.post(EventBus.java:275)
              at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
              at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
              at com.google.common.eventbus.EventBus.post(EventBus.java:275)
              at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
              at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:527)
              at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:246)
              at net.minecraft.client.Minecraft.startGame(Minecraft.java:446)
              at net.minecraft.client.Minecraft.run(Minecraft.java:356)
              at net.minecraft.client.main.Main.main(Main.java:117)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
              at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
              at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
              at GradleStart.main(Unknown Source)
              Caused by: java.lang.IllegalArgumentException: Don't know how to convert ut:rafined_gunpowder_wire[east=true,north=true,south=true,west=true] back into data…
              at net.minecraft.block.Block.getMetaFromState(Block.java:272)
              at net.minecraftforge.fml.common.registry.GameData.registerBlock(GameData.java:839)
              at net.minecraftforge.fml.common.registry.GameData.registerBlock(GameData.java:801)
              at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:214)
              ... 43 more
              
              A detailed walkthrough of the error, its code path and all known details is as follows:
              ---------------------------------------------------------------------------------------
              
              -- System Details --
              Details:
              Minecraft Version: 1.8
              Operating System: Windows 8.1 (amd64) version 6.3
              Java Version: 1.8.0_45, Oracle Corporation
              Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
              Memory: 965743192 bytes (921 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
              JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
              IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
              FML: MCP v9.10 FML v8.99.8.1412 Minecraft Forge 11.14.1.1412 4 mods loaded, 4 mods active
              mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
              FML{8.99.8.1412} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed->Pre-initialized
              Forge{11.14.1.1412} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1412.jar) Unloaded->Constructed->Pre-initialized
              ut{Beta 1.0} [Useful Things] (bin) Unloaded->Constructed->Errored
              Loaded coremods (and transformers):
              GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.2.12420 Compatibility Profile Context 13.151.0.0' Renderer: 'AMD Radeon HD 8240'
              

              Membre fantôme
              Je développe maintenant un jeu sur UnrealEngine4


              Contact :…

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

                Tu as un problème avec les BlockStates, qu’as-tu modifié ?

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

                  non, Je ne souhaitait pas révéler le problème, car sinon on m’aurait crié dessus, et j’aurais perdu encore 2 points de réputation 😢 Mais bon, enfaite, mon ‘Bloc’ était le même item que l’item qui est censé posé le bloc.
                  En gros, l’Item1 est censé posé le Bloc1, mais le Bloc1 n’existait pas, et était enfaite l’Item1
                  Regarde le code de la poudre et tu comrpendra

                  Membre fantôme
                  Je développe maintenant un jeu sur UnrealEngine4


                  Contact :…

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

                    Effectivement, tu places le block de minecraft :

                    else if (Blocks.redstone_wire.canPlaceBlockAt(worldIn, blockpos1))
                    {
                    –stack.stackSize;
                    worldIn.setBlockState(blockpos1, Blocks.redstone_wire.getDefaultState());
                    return true;
                    }
                    

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

                      Non, sa c’est l’item.
                      Regarde le block.
                      public static Item rafined_gunpowder_wire;

                      Membre fantôme
                      Je développe maintenant un jeu sur UnrealEngine4


                      Contact :…

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

                        Et donc les nouvelles classes sont ?

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

                          Seul le bloc a changé, je changerai l’item plus tard

                          package eryah.usefulthings.blocks;
                          
                          import java.util.ArrayList;
                          import java.util.EnumSet;
                          import java.util.Iterator;
                          import java.util.Random;
                          import java.util.Set;
                          
                          import com.google.common.collect.Lists;
                          import com.google.common.collect.Sets;
                          
                          import net.minecraft.block.Block;
                          import net.minecraft.block.BlockRedstoneDiode;
                          import net.minecraft.block.BlockRedstoneRepeater;
                          import net.minecraft.block.BlockRedstoneWire;
                          import net.minecraft.block.material.Material;
                          import net.minecraft.block.properties.IProperty;
                          import net.minecraft.block.properties.PropertyBool;
                          import net.minecraft.block.properties.PropertyEnum;
                          import net.minecraft.block.properties.PropertyInteger;
                          import net.minecraft.block.state.BlockState;
                          import net.minecraft.block.state.IBlockState;
                          import net.minecraft.client.Minecraft;
                          import net.minecraft.client.resources.model.ModelResourceLocation;
                          import net.minecraft.entity.Entity;
                          import net.minecraft.init.Blocks;
                          import net.minecraft.init.Items;
                          import net.minecraft.item.Item;
                          import net.minecraft.util.AxisAlignedBB;
                          import net.minecraft.util.BlockPos;
                          import net.minecraft.util.EnumFacing;
                          import net.minecraft.util.EnumParticleTypes;
                          import net.minecraft.util.EnumWorldBlockLayer;
                          import net.minecraft.util.IStringSerializable;
                          import net.minecraft.util.MathHelper;
                          import net.minecraft.world.IBlockAccess;
                          import net.minecraft.world.World;
                          import net.minecraftforge.fml.common.registry.GameRegistry;
                          import net.minecraftforge.fml.relauncher.Side;
                          import net.minecraftforge.fml.relauncher.SideOnly;
                          import eryah.usefulthings.Reference;
                          import eryah.usefulthings.UsefulthingsMod;
                          import eryah.usefulthings.init.RafinedGunpowder;
                          
                          public class BRefinedGunpowder extends Block {
                          
                          public static final PropertyBool NORTH = PropertyBool.create("north");
                              public static final PropertyBool EAST = PropertyBool.create("east");
                              public static final PropertyBool SOUTH = PropertyBool.create("south");
                              public static final PropertyBool WEST = PropertyBool.create("west");
                              public static Block rafined_gunpowder_wire;   
                          
                              public BRefinedGunpowder(Material material)
                              {
                                  super(Material.circuits);
                                  this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
                                  this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
                                  this.setTickRandomly(true);
                              }
                          
                          public static void init()
                          {
                              rafined_gunpowder_wire = new BRefinedGunpowder(Material.circuits).setUnlocalizedName("rafined_gunpowder_wire").setCreativeTab(UsefulthingsMod.UTTab);
                          }
                          
                          public static void register()
                          {
                          GameRegistry.registerBlock(rafined_gunpowder_wire, rafined_gunpowder_wire.getUnlocalizedName().substring(5));
                          }
                          
                          public static void registerRenders()
                          {
                          registerRender(rafined_gunpowder_wire);
                          }
                          
                          public static void registerRender(Block block)
                          {
                          Item item = Item.getItemFromBlock(block);
                          Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
                          }
                          
                              public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
                              {
                                  return null;
                              }
                          
                              public boolean isOpaqueCube()
                              {
                                  return false;
                              }
                          
                              public boolean isFullCube()
                              {
                                  return false;
                              }
                          
                              @SideOnly(Side.CLIENT)
                              public EnumWorldBlockLayer getBlockLayer()
                              {
                                  return EnumWorldBlockLayer.TRANSLUCENT;
                              }
                          
                              public Item getItemDropped(IBlockState state, Random rand, int fortune)
                              {
                                  return Items.string;
                              }
                          
                              @SideOnly(Side.CLIENT)
                              public Item getItem(World worldIn, BlockPos pos)
                              {
                                  return Items.string;
                              }
                          
                              protected BlockState createBlockState()
                              {
                                  return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
                              }
                          
                          @Override
                          public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
                          return 200;
                          }
                          
                          @Override
                          public boolean isBurning(IBlockAccess world, BlockPos pos) {
                          return false;
                          }
                          
                          public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock, Entity entity) {
                          if(world.getBlockState(pos.east()).getBlock() == Blocks.fire || world.getBlockState(pos.west()).getBlock() == Blocks.fire ||world.getBlockState(pos.north()).getBlock() == Blocks.fire ||world.getBlockState(pos.south()).getBlock() == Blocks.fire) {
                          world.createExplosion(entity, 0.5D, 0.5D, 0.5D, 0.5F, true);
                          }
                          
                          }
                          
                          }
                          
                          

                          Membre fantôme
                          Je développe maintenant un jeu sur UnrealEngine4


                          Contact :…

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

                            La méthode est appelée ?

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

                              Euuh quelle méthode ?$
                              Je te rapelle que je crash avant d’avoir le menu, je crash prendent le chargement

                              Membre fantôme
                              Je développe maintenant un jeu sur UnrealEngine4


                              Contact :…

                              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

                                Il te manque la fonction public int getMetaFromState(IBlockState state)

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

                                  J’ai du raté, car la le bloc ne 'affiche pas, mais je crahs plus, déja, c’est bien 🙂
                                  Pour la méthode en plus, j’ai pris celle du tripwire, et je l’ai modifié

                                  ​ package eryah.usefulthings.blocks;
                                  
                                  import java.util.ArrayList;
                                  import java.util.EnumSet;
                                  import java.util.Iterator;
                                  import java.util.Random;
                                  import java.util.Set;
                                  
                                  import com.google.common.collect.Lists;
                                  import com.google.common.collect.Sets;
                                  
                                  import net.minecraft.block.Block;
                                  import net.minecraft.block.BlockRedstoneDiode;
                                  import net.minecraft.block.BlockRedstoneRepeater;
                                  import net.minecraft.block.BlockRedstoneWire;
                                  import net.minecraft.block.material.Material;
                                  import net.minecraft.block.properties.IProperty;
                                  import net.minecraft.block.properties.PropertyBool;
                                  import net.minecraft.block.properties.PropertyEnum;
                                  import net.minecraft.block.properties.PropertyInteger;
                                  import net.minecraft.block.state.BlockState;
                                  import net.minecraft.block.state.IBlockState;
                                  import net.minecraft.client.Minecraft;
                                  import net.minecraft.client.resources.model.ModelResourceLocation;
                                  import net.minecraft.entity.Entity;
                                  import net.minecraft.init.Blocks;
                                  import net.minecraft.init.Items;
                                  import net.minecraft.item.Item;
                                  import net.minecraft.util.AxisAlignedBB;
                                  import net.minecraft.util.BlockPos;
                                  import net.minecraft.util.EnumFacing;
                                  import net.minecraft.util.EnumParticleTypes;
                                  import net.minecraft.util.EnumWorldBlockLayer;
                                  import net.minecraft.util.IStringSerializable;
                                  import net.minecraft.util.MathHelper;
                                  import net.minecraft.world.IBlockAccess;
                                  import net.minecraft.world.World;
                                  import net.minecraftforge.fml.common.registry.GameRegistry;
                                  import net.minecraftforge.fml.relauncher.Side;
                                  import net.minecraftforge.fml.relauncher.SideOnly;
                                  import eryah.usefulthings.Reference;
                                  import eryah.usefulthings.UsefulthingsMod;
                                  import eryah.usefulthings.init.RafinedGunpowder;
                                  
                                  public class BRefinedGunpowder extends Block {
                                  
                                  public static final PropertyBool NORTH = PropertyBool.create("north");
                                      public static final PropertyBool EAST = PropertyBool.create("east");
                                      public static final PropertyBool SOUTH = PropertyBool.create("south");
                                      public static final PropertyBool WEST = PropertyBool.create("west");
                                      public static Block rafined_gunpowder_wire;   
                                  
                                      public BRefinedGunpowder(Material material)
                                      {
                                          super(Material.circuits);
                                          this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
                                          this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
                                          this.setTickRandomly(true);
                                      }
                                  
                                  public static void init()
                                  {
                                      rafined_gunpowder_wire = new BRefinedGunpowder(Material.circuits).setUnlocalizedName("rafined_gunpowder_wire").setCreativeTab(UsefulthingsMod.UTTab);
                                  }
                                  
                                  public static void register()
                                  {
                                  GameRegistry.registerBlock(rafined_gunpowder_wire, rafined_gunpowder_wire.getUnlocalizedName().substring(5));
                                  }
                                  
                                  public static void registerRenders()
                                  {
                                  registerRender(rafined_gunpowder_wire);
                                  }
                                  
                                  public static void registerRender(Block block)
                                  {
                                  Item item = Item.getItemFromBlock(block);
                                  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
                                  }
                                  
                                      public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
                                      {
                                          return null;
                                      }
                                  
                                      public boolean isOpaqueCube()
                                      {
                                          return false;
                                      }
                                  
                                      public boolean isFullCube()
                                      {
                                          return false;
                                      }
                                  
                                      @SideOnly(Side.CLIENT)
                                      public EnumWorldBlockLayer getBlockLayer()
                                      {
                                          return EnumWorldBlockLayer.TRANSLUCENT;
                                      }
                                  
                                      public Item getItemDropped(IBlockState state, Random rand, int fortune)
                                      {
                                          return Items.string;
                                      }
                                  
                                      @SideOnly(Side.CLIENT)
                                      public Item getItem(World worldIn, BlockPos pos)
                                      {
                                          return Items.string;
                                      }
                                  
                                      protected BlockState createBlockState()
                                      {
                                          return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
                                      }
                                  
                                  @Override
                                  public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
                                  return 200;
                                  }
                                  
                                  @Override
                                  public boolean isBurning(IBlockAccess world, BlockPos pos) {
                                  return false;
                                  }
                                  
                                  public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock, Entity entity) {
                                  if(world.getBlockState(pos.east()).getBlock() == Blocks.fire || world.getBlockState(pos.west()).getBlock() == Blocks.fire ||world.getBlockState(pos.north()).getBlock() == Blocks.fire ||world.getBlockState(pos.south()).getBlock() == Blocks.fire) {
                                  world.createExplosion(entity, 0.5D, 0.5D, 0.5D, 0.5F, true);
                                  }
                                  
                                  }
                                  
                                  public int getMetaFromState(IBlockState state)
                                     {
                                  int i = 0;
                                  
                                         if (((Boolean)state.getValue(EAST)).booleanValue())
                                         {
                                             i |= 1;
                                         }
                                  
                                         if (((Boolean)state.getValue(NORTH)).booleanValue())
                                         {
                                             i |= 2;
                                         }
                                  
                                         if (((Boolean)state.getValue(SOUTH)).booleanValue())
                                         {
                                             i |= 4;
                                         }
                                  
                                         if (((Boolean)state.getValue(WEST)).booleanValue())
                                         {
                                             i |= 8;
                                         }
                                  
                                         return i;
                                     }
                                  
                                  }
                                  
                                  

                                  Membre fantôme
                                  Je développe maintenant un jeu sur UnrealEngine4


                                  Contact :…

                                  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

                                    Il te manque surement les .json

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

                                      Effectivement, je les ais pas encore fait.
                                      Mais la je parle pas d’un bloc invisible, mais d’un bloc qui ne se place pas, je ne vois pas sa hitbox

                                      Membre fantôme
                                      Je développe maintenant un jeu sur UnrealEngine4


                                      Contact :…

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

                                        Avant de continuer je ne comprend pas pourquoi avoir fait 4 propriété bool… Sinon, regarde que la condition qui fait posé ton bloc soit bien appelé.

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

                                          Bon, toujours très étrange, je relance mon Ecplise arpès une mauvaise nuit de sommeil, et la MAGYYYY. Le bloc apparait.
                                          Bref, par contre, problème, bah sa n’explose toujours pas. J’ai même mis un println, fonctionne pas.
                                          Je pense que sa vient qu’il ,'y a pas le @Override.
                                          Mais je suis obligé de ne pas le mettre. L’explosion néccécite un paramètre Entity, non présent dans les paramètres de base de onNeighborBlockChange.

                                          ​public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock, Entity entity) {
                                          if(world.getBlockState(pos.east()).getBlock() == Blocks.fire || world.getBlockState(pos.west()).getBlock() == Blocks.fire ||world.getBlockState(pos.north()).getBlock() == Blocks.fire ||world.getBlockState(pos.south()).getBlock() == Blocks.fire) {
                                          world.createExplosion(entity, 0.5D, 0.5D, 0.5D, 0.5F, true);
                                          System.out.println("Test d'explosion");
                                          }
                                          
                                          }
                                          

                                          Membre fantôme
                                          Je développe maintenant un jeu sur UnrealEngine4


                                          Contact :…

                                          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

                                            …
                                            Si tu ajoutes Entity c’est normal que ta fonction ne sera pas appelé. Car elle n’existe pas.
                                            Retire le entity et dans createExplosion mets null à la place de entity. Cette fonction autorise que entity soit null.

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB