
AnonymousModder
Members-
Posts
46 -
Joined
-
Last visited
Everything posted by AnonymousModder
-
Here's the crash report for after I made the GuiHandler. Here's my GuiHandler class public class GuiHandler implements IGuiHandler{ public static void init(){ NetworkRegistry.INSTANCE.registerGuiHandler(PinesMod.modInstance, new GuiHandler()); } @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(6){ case 0: return new GuiJournalThree(); } return null; } } My Item class was in my previous reply.
-
Is this the correct code for the item class? Because it still crashes. public class ItemThirdJournal extends Item{ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { player.openGui(PinesMod.modInstance, 6, world, 0, 0, 0); return itemstack; } }
-
Still crashes.
-
Still doesn't work. Is there another way of doing this instead like the openGui? And if so, then how do I do it?
-
So I should make it return null?
-
I was able to get Minecraft to not crash upon opening it, however whenever I right click the item it crashes. Crash Report (Very self-explanatory)
-
I created a item that when you right click it opens a Gui and Minecraft crashes whenever it's loading. Here's the crash report Here's my item class public class ItemThirdJournal { public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { Minecraft.getMinecraft().displayGuiScreen(new GuiJournalThree()); return onItemRightClick(itemstack, world, player); } public Item setUnlocalizedName(String string) { return null; } } And here's my Gui class public class GuiJournalThree extends GuiScreen { private final int bookImageHeight = 192; private final int bookImageWidth = 192; private int currPage = 0; private static final int bookTotalPages = 2; private static ResourceLocation[] bookPageTextures = new ResourceLocation[bookTotalPages]; private static String[] stringPageText = new String[bookTotalPages]; private GuiButton buttonDone; private NextPageButton buttonNextPage; private NextPageButton buttonPreviousPage; public GuiJournalThree() { bookPageTextures[0] = new ResourceLocation(Reference.MOD_ID +":textures/gui/gnome_page.png"); bookPageTextures[1] = new ResourceLocation(Reference.MOD_ID +":textures/gui/leprecorn_page.png"); } @Override public void initGui() { // DEBUG System.out.println("GuiJournalThree initGUI()"); buttonList.clear(); buttonDone = new GuiButton(0, width / 2 + 2, 4 + bookImageHeight, 98, 20, I18n.format("gui.done", new Object[0])); buttonList.add(buttonDone); int offsetFromScreenLeft = (width - bookImageWidth) / 2; buttonList.add(buttonNextPage = new NextPageButton(1, offsetFromScreenLeft + 120, 156, true)); buttonList.add(buttonPreviousPage = new NextPageButton(2, offsetFromScreenLeft + 38, 156, false)); } @Override public void updateScreen() { buttonDone.visible = (currPage == bookTotalPages - 1); buttonNextPage.visible = (currPage < bookTotalPages - 1); buttonPreviousPage.visible = currPage > 0; } @Override public void drawScreen(int parWidth, int parHeight, float p_73863_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (currPage == 0) { mc.getTextureManager().bindTexture(bookPageTextures[0]); } else { mc.getTextureManager().bindTexture(bookPageTextures[1]); } int offsetFromScreenLeft = (width - bookImageWidth ) / 2; drawTexturedModalRect(offsetFromScreenLeft, 2, 0, 0, bookImageWidth, bookImageHeight); int widthOfString; String stringPageIndicator = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(currPage + 1), bookTotalPages}); widthOfString = fontRendererObj.getStringWidth(stringPageIndicator); fontRendererObj.drawString(stringPageIndicator, offsetFromScreenLeft - widthOfString + bookImageWidth - 44, 18, 0); fontRendererObj.drawSplitString(stringPageText[currPage], offsetFromScreenLeft + 36, 34, 116, 0); super.drawScreen(parWidth, parHeight, p_73863_3_); } @Override protected void mouseClickMove(int parMouseX, int parMouseY, int parLastButtonClicked, long parTimeSinceMouseClick) { } @Override protected void actionPerformed(GuiButton parButton) { if (parButton == buttonDone) { mc.displayGuiScreen((GuiScreen)new GuiJournalThree()); } else if (parButton == buttonNextPage) { if (currPage < bookTotalPages - 1) { ++currPage; } } else if (parButton == buttonPreviousPage) { if (currPage > 0) { --currPage; } } } @Override public void onGuiClosed() { } @Override public boolean doesGuiPauseGame() { return true; } @SideOnly(Side.CLIENT) static class NextPageButton extends GuiButton { private final boolean isNextButton; public NextPageButton(int parButtonId, int parPosX, int parPosY, boolean parIsNextButton) { super(parButtonId, parPosX, parPosY, 23, 13, ""); isNextButton = parIsNextButton; } } public boolean onBlockActivated(World parWorld, BlockPos parBlockPos, IBlockState parIBlockState, EntityPlayer parPlayer, EnumFacing parSide, float hitX, float hitY, float hitZ) { if (!parWorld.isRemote) { PinesMod.proxy.openMyGui(); } return true; } }
-
I'm trying to create an item that opens iron doors using onItemRightClick. I've tried to use pressure plates and levers to figure out how to tell the door to open but no matter what I can't find what I need. Can anyone help me with this?
-
That's exactly what I needed! Thank you!
-
This is how it's supposed to look: This is how it looks:
-
This has been a very frusterating problem for me. I'd really appreciate it if someone could help me with it.
-
I started my first mod a while ago and I used the MrCrayFish 1.8 modding tutorial to set up Eclipse with Forge. When I did what the tutorial told me it worked fine. Packages went inside other packages and all my Minecraft classes for the files in vanilla Minecraft were in the forgesSrc jar in the Referenced Libraries thing. Today I wanted to start my second mod and I went to the same video to get my workspace ready. When I opened up the workspace none of my packages went into another, and all my Minecraft calsses for vanilla monsters, blocks, items, etc. were on the complete outside in the MDKExample folder. I also didn't have the "Create class" and "Create package" shortcut icons on the top bar. I haven't modded in 1.7 but I think I've seen this setup in 1.7 modding tutorials. I'm completely confused on how this has happened. Does anybody know how to fix it? Or why this has happened?
-
Here's the food's class public class InfinitePizza { public static Item infinite_pizza; public static void init() { infinite_pizza = new ItemFood((int)2, 12.8f, false).setUnlocalizedName("infinite_pizza").setCreativeTab(PinesMod.tabPinesMod); } public static void register() { GameRegistry.registerItem(infinite_pizza, infinite_pizza.getUnlocalizedName().substring(5)); //"tile.infinite_pizza" } public static void registerRenders() { registerRender(infinite_pizza); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } public void onFoodEaten(ItemStack stack, World world, EntityPlayer player){ player.inventory.addItemStackToInventory(new ItemStack(InfinitePizza.infinite_pizza)); } }
-
I'm trying to create a food that every time you eat it you receive the same exact item, making it an infinite food, and guess what! It's not working! Here's my code: public static void onFoodEaten(ItemStack stack, World world, EntityPlayer player){ player.inventory.addItemStackToInventory(new ItemStack(InfinitePizza.infinite_pizza)); }
-
Solved! This whole time I had been putting the Pumpkin code allowing it to be orientable in the wrong class! I put it it the BlockTest class and it worked. Thanks!
-
Ohh, sorry about that. public class BlockTest extends Block { public BlockTest(Material materialIn) { super(materialIn); // TODO Auto-generated constructor stub } }
-
[Unsolved]Gradle 1.7.2 build failed with an exception
AnonymousModder replied to Hirvio's topic in ForgeGradle
Did you ever figure this out? -
I might have learned how to make blocks a bit differently than normal. That was what rendered my block, created my block, and created the item. Here's my model file { "parent": "block/orientable", "textures": { "top": "pm:blocks/jack_omelon_top", "front": "pm:blocks/jack_omelon", "side": "pm:blocks/jack_omelon_side" } } It also doesn't register it as orientable, claiming it's misspelled.
-
So how do I make it orientable?
-
I made a block like a pumpkin that has a face on only one side, but whenever I place the block down it faces north, no matter what. I have it set to "block/orientable" in the .json model file, and I've tried to copy over the code from the pumpkin class to make it work, but it doesn't. Here's my block class public class ModBlocks { public static Block jack_omelon; public static void init() { jack_omelon = new BlockTest(Material.gourd).setUnlocalizedName("jack_omelon").setCreativeTab(PinesMod.tabPinesMod).setHardness(1.0F).setLightLevel(2.0F); } public static void register() { GameRegistry.registerBlock(jack_omelon, jack_omelon.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(jack_omelon); } 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")); } }