Recherche une fonction
-
J’ai trouver sa est-ce-que c’est la fonction qui me faut ?
@SideOnly(Side.CLIENT) @Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { if(world.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new GuiMod()); } return super.onItemRightClick(item, world, player); }Je prend tu cette fonction player.openGui ou player.displayGuiScreen
-
@‘mathmatboy’:
J’ai trouver sa est-ce-que c’est la fonction qui me faut ?
@SideOnly(Side.CLIENT) @Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { if(world.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new GuiMod()); } return super.onItemRightClick(item, world, player); }Je prend tu cette fonction player.openGui ou player.displayGuiScreen
Ici tu es seulement côté client donc pas de problèmes.
-
Ouais c’est pour le client mais j’ai une erreur avec le return
The method onBlockRightClick(ItemStack, World, EntityPlayer) is undefined for the type Block
return super.onBlockRightClick(item, world, player); -
@‘mathmatboy’:
Ouais c’est pour le client mais j’ai une erreur avec le return
The method onBlockRightClick(ItemStack, World, EntityPlayer) is undefined for the type Block
return super.onBlockRightClick(item, world, player);Ton code est appelé sur un bloc ou un item ?
Si c’est un bloc :
onBlockActivated //Si c'est un Item : onItemRightClickIl existe d’autres fonctions mais elles sont moins recommandées.
-
Rien fonctionne.

-
@‘mathmatboy’:
Rien fonctionne.

Enlève l’annotation SideOnly.
Est-ce un Item ou un block ?
EDIT : Tu as les mauvais arguments, voici les bons : World, int (x), int (y), int (z), EntityPlayer (joueur), int (metadata), float (hit X), float (hit Y), float (hit Z).
-
C’est un block, merci de l’aide, j’go tester sa
EDIT c’est pire :

-
@‘mathmatboy’:
C’est un block, merci de l’aide, j’go tester sa
Petit conseil pour réécrire les fonctions : fait Alt + shift + s puis “override or implement methods”, grâce à çà tu n’auras plus de problèmes avec les arguments.
-
Merci je check sa
-
Problème résolu, pour ceux qui veule le code voila :
@SideOnly(Side.CLIENT) @Override public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if(p_149727_1_.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new GuiTeleporteur()); } return super.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); }