Jump to content

laserflip

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by laserflip

  1. Thank you, so now I've that : Item who opens GUI : public class Livre1 extends Item { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(world.isRemote) { ModPhenix.proxy.openMyGui(); } return super.onItemRightClick(stack, world, player); } } ClientProxy : public class ClientProxy extends CommonProxy { public static int tesrRenderId; @Override public void registerRender() { MinecraftForge.EVENT_BUS.register(new TickClientHandler()); } @Override public void openMyGui() { Minecraft.getMinecraft().displayGuiScreen(new GuiLivre1()); } } CommonProxy : public class CommonProxy { public void registerRender() { } public void openMyGui() { } } GUI : public class GuiLivre1 extends GuiScreen { int guiWidth= 256; int guiHeight= 256; @Override public void drawScreen(int x, int y, float ticks ) { int guix =(width - guiWidth) /2 ; int guiy =(height - guiHeight) /2; mc.renderEngine.bindTexture(new ResourceLocation(ModPhenix.MODID,"textures/gui/guiLivre.png")); drawTexturedModalRect(guix, guiy, 0, 0, guiWidth, guiHeight); fontRendererObj.drawString("\u00a70" + "\u00a7o" + "Lever le voile du futur", guix + 17, guiy + 55, 0x404040 ); super.drawScreen(x, y, ticks); } @Override public boolean doesGuiPauseGame() { return false; } } It should be correct, I did what you tell me but it doesn't work..
  2. Thank you very much for the explanation and the link, so interesting. So right now I understand that I tried to display the GUI on the server instead of the client, but I don't know how to display on Client Side. I of course tried many things but it still doesn't work.. It should works like that, but it doesn't : @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(!world.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new GuiLivre1()); } return super.onItemRightClick(stack, world, player); }
  3. Hey guys, I made a simple GUI on an " on item right click ", it works perfectly in singleplayer but in multiplayer, nothing appears.. the GUI doesn't work but there's no error, crash or anything. Here is my item : package laserflip33.ordreduphenix.common; import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class Livre1 extends Item { @SideOnly(Side.CLIENT) public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(!world.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new GuiLivre1()); } return super.onItemRightClick(stack, world, player); } } And here is my GUI : package laserflip33.ordreduphenix.common; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import scala.swing.SingleRefCollection.Ref; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.util.ResourceLocation; public class GuiLivre1 extends GuiScreen { int guiWidth= 256; int guiHeight= 256; @Override public void drawScreen(int x, int y, float ticks ) { int guix =(width - guiWidth) /2 ; int guiy =(height - guiHeight) /2; mc.renderEngine.bindTexture(new ResourceLocation(ModPhenix.MODID,"textures/gui/guiLivre.png")); drawTexturedModalRect(guix, guiy, 0, 0, guiWidth, guiHeight); fontRendererObj.drawString("\u00a70" + "\u00a7o" + "Lever le voile du futur", guix + 17, guiy + 55, 0x404040 ); super.drawScreen(x, y, ticks); } @Override public boolean doesGuiPauseGame() { return false; } } Thank you very much for your help
  4. It's Item for the items list, but do you know what I have to put for the messages list?
  5. player.addChatComponentMessage don't send a random message
  6. Hello! I only know how give an random item on item right click but now I want to display a random chat message from a defined list. I have the code for give a random item, but I don't know for a chat message. public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(!world.isRemote) { Item[] randItems = new Item[]{ModPhenix.carte1, ModPhenix.carte2, ModPhenix.carte3}; player.setCurrentItemOrArmor(0, null); Item randItem = randItems[world.rand.nextInt(randItems.length)]; if (!player.inventory.addItemStackToInventory(new ItemStack(randItem))) { player.dropItem(randItem, 1); } Thanks for your help!
  7. Thanks I'll try your method.
  8. Yes, but how can I do this teleportation system (the coordinates input)
  9. I'll update on 1.7.10 but I won't work on 1.8. Then, when I asked someone for a code? " If you have any ideas... " It seems to me that ideas an code are not the same.
  10. Hello everyone. I would like to make an teleportation system. When the player press J, an GUI appear and he have to choose the x, y, z coordinates. When he click on the button " Teleport " or whatever, he's teleport to the chosen destination. But I have no idea for make this kind of GUI and for the teleportation system. I have already this code for my KeyBind (into my ClientProxy) : private static KeyBinding keyBindTest; public ClientProxy() { FMLCommonHandler.instance().bus().register(this); keyBindTest = new KeyBinding("modtest.key", Keyboard.KEY_J, "key.categories.gameplay"); ClientRegistry.registerKeyBinding(keyBindTest); } @SubscribeEvent public void onEvent(KeyInputEvent event) { if(keyBindTest.isPressed()) { keyTestTyped(); } } private void keyTestTyped() { Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentText("test")); } If you have any ideas... Best regards,
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.