Jump to content

Maexx

Forge Modder
  • Posts

    41
  • Joined

  • Last visited

Everything posted by Maexx

  1. Don't do that… Look at a minecraft.jar in your normal minecraft installation - the classes, methods and fields there have weird names - that's because mojang obfuscate their code, so nobody can really get what it all means by just looking at it. MCP deobfuscates it when you install it, so you can look at the minecraft code and see what it means. But when you want to use your mod with a normal minecraft installation again, you need to reobfuscate it again, so all the class, method and field names fit. So basically what you have to do is run recompile.bat (or .sh when on a mac), that file should be in your mcp folder. Then run reobfuscate_srg.bat (or .sh when on a mac). After that, all your class files should end up in "[mcp-root]/reobf/minecraft/". You need to copy your image files there yourself. It all should work, assuming you have a normal mcp installation and all your mod files are in "[mcp-root]/src/minecraft". If they aren't, you have to copy them there.
  2. Did you recompile and reobfuscate your mod before using it in normal minecraft?
  3. I am the creator of the Buildcraft-Tools add-on (link on my signature), and I would like to have the modder status. Thanks, Max
  4. Awesome! If I only had known this before splitting all the textures…I did it with GIMPs "Guillotine" feature, wasn't that bad either, but this is much faster. Thanks!
  5. Hello all! In the mod I am working on I have many recipes that use similar Items. Right now I am registering the recipes all manually, but I wanted to automate it a bit by using Lists. I would just do several List<ItemStack> that all contain the Items that are similar to each other and then register them all at once with a while of for loop. So far, so good. But because I have also included some alternative Recipes using the Items of other mods, I have to add some Recipes during PostInit. That's why I'd like to register all recipes, including the "mod-vanilla" ones during PostInit, but that's not the way people usually do it. I know it works, but I don't know if there will be any disadvantages when doing that. I just want to make sure that nothing is going to get messed up, so if you know any disadvantages, or if you know for sure that everything will be fine, please tell me Thanks and Greetings, Max
  6. If you've done it with a block before, you've probably done a check for the Blocks TileEntity in the GuiHandler and probably also used it in the Container class, the item doesn't have a TileEntity of course. You'll have to leave that check out and change the Container class around a bit.
  7. I guess I'll go with replicating the potion effects then
  8. Hello all, In my mod I have it so that when pressing a key under special circumstances the player gets a potion effect, or rather a lot of effects. I've been searching for methods to add Potion Effects without the annoying GUI-Display (which shifts your Inventory over to the right) for quite a long time, but I haven't found anything good yet. I tried removing the effects as soon as you open the Inventory, but it has a tiny very annoying delay, I tried doing it with ".performEffect", which doesn't work for all potions, and I tried replicating the effects of the potions, but there are some (like Night-vision) that are pretty hard to do. I know where the Inventory Render gets called (InventoryEffectRenderer.displayDebuffEffects), but I can't hinder minecraft from doing it… Now my question, is there any good way to add potion effects without the display in the Inventory? Thanks, Max
  9. Weird…try adding a different effect, it should work if you've done everything correctly, again, I am using pretty much exactly the same code… And yes I know how to do key bindings, I'll explain it if you want
  10. I suggest checking it with System.out.println(player.capabilities.allowFlying); I am doing it this way too, and it is working (although I'm not adding flight), so the problem has to be there…
  11. So you want the player to only be able to fly when he has the full set of armor on ? Did you do it in the server-tick handler and did you put onPlayerTick in the TickStart function like I wrote ? See if you registered the TickHandler properly. If that doesn't work, try something different besides allowFlying, like adding potions, maybe that doesn't work that way with the flight…
  12. You should just be able to do something like this: private void onPlayerTick(EntityPlayer player){ if (player.getCurrentItemOrArmor(4) != null) { ItemStack helmet = player.getCurrentItemOrArmor(4); if (helmet.getItem() == YOUR_ITEM) { player.getFoodStats().setFoodLevel(20); } } }
  13. In your CommonProxy do this: public void registerServerTickHandler() { TickRegistry.registerTickHandler(new ServerTickHandler(), Side.SERVER); } and then call it at Init in your main mod method with "proxy.registerServerTickHandler();" The create the ServerTickHandler class from the CommonProxy, it should already have a bunch of stuff in it and implemet ITickHandler, then change it to the following : @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if (type.equals(EnumSet.of(TickType.PLAYER))) { onPlayerTick((EntityPlayer)tickData[0]); } } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER, TickType.SERVER); } Create a function in there called onPlayerTick like that: private void onPlayerTick(EntityPlayer player){} In there you can then check for the armor with "player.getCurrentItemOrArmor(4)" ore something similar. This will then get checked every tick Hope I could help
  14. You'll need to do it with a ServerTickHandler
  15. For enchants you can do it like jtomes123 said (with itemstack.addEnchantment), for potion effects you need to make a server-tick-handler and check if the player wears the armor, and then add the potion-effects to the player. You can't do it with "onUpdate" from your item, because that only gets called when the item is in the player-inventory, not when it's in the armor-inventory…
  16. I used VictorZombies method, and it works great I added the check for up and down and packed it into a playerUtil, so I can refer to it from everywhere Thanks a lot, Max
  17. Mhh…I guess there is no good way to do it, I'm gonna have to use camera angles
  18. Hi all, I need to make a tool that breaks a 3x3 area around the block you break. For that I need to know which side of the block the player is pointing at, but I haven't found a way to do it. I know that onItemUse has a way to do it, but I want to make the tool be used with the left mouse button, not with the right one. Is there any way to do that ? Thanks, Max
  19. Okay, so here is the updated "Tutorial". Sorry, it took quite long because I have lots of stuff to do IRL at the moment. I've written a mod just for this tutorial, I will post all the classes in spoilers here and put a little explaining text beneath them if necessary. The mod is just called Mod1. I've named the block "Crafter", so replace it in the corresponding places with your own block name. If you do everything like this, it should work fine. I am posting every class with imports, because at some places there are several possible imports that eclipse suggests you, but if you import the wrong thing it won't work. Main Mod Class: Just your old simple Main Class. Registering a Block and a TileEntity. The only 'new' thing is the GuiHandler. Block - Crafter This is just like a normal block, except it extends BlockContainer. It creates a TileEntity called TileCrafter, and the onBlockActivated opens the GUI, managed by the GuiHandler (we will get to it in a moment). If the player is sneaking, it won't open it. TileEntity - TileCrafter The TileEntity. You will get an Error at "ContainerCrafter.InputSlotNumber", but it will be fixed once the ContainerCrafter class is created and ready. GuiHandler This handles which Gui should be opened for which TileEntity. "getServerGuiElement" returns the Container class, "getClientGuiElement" the Gui class. GuiIDs This is just a class with a bunch of integers in it. You don't need it, but if you want to have more Guis and Inventories, it's beneficial, because you can just manage your Guis much easier. The numbers are mod-intern, so you can pretty much choose any. The Container - ContainerCrafter This is the Container class. It creates the slots for your items to go in. More Explanation here: The Gui - GuiCrafter This just draws the box. You have to replace "TEXTURE-PATH" with the Image for your Gui. Make sure the slots on the image match with the slot positions defined in the Container. If you copy the vanilla gui of the crafting table it should fit. fontRenderer.drawString("Crafter", 75, 6, 0x404040); draws the text on top of the gui, 75 and 6 are the coordinates, the other number is the color in hexadecimal notation. The Crafting Manager - CraftingManagerCrafter This tells the game what a Shapeless/Shaped recipe is in your crafting table. You add the recipes on top where the two example recipes are. Try if they work before you add any more. Recipe Sorter - RecipeSorterCrafter This makes sure everything is fine with your recipes. DONE! if i didn't forget anything This should work on single- and multiplayer. If I helped you with this, make sure to give me a "thank you"
  20. Hey, No Problem Just send me a private message with the errors (like the content of the class files, or just the stuff where the errors are in) and I will look into them EDIT: Once everything is sorted out I will post another kind of walkthrough or tutorial here for other people who want to make the same thing.
  21. Okay... Now, first of all in your class where you register an call the blocks and stuff (so probably your main mod class) do these, like you usually do: Just like the usual stuff. Create the TileEntity class, the block-class and the GuiHandler class. Also don't forget the LanguageRegistry for your block. In your Block Class: This is just like a basic block, except for onBlockActivated, which makes it open the gui. Watch out at this line: player.openGui(YOURMODCLASS.instance, 1, world, x, y, z); The "1" is the internal GuiID. If you plan to add more Guis, you should probably create an extra class, like GuiIDs ore something where you just store them as integers, like public static final int YOURBLOCK = 1; public static final int YOURBLOCK2 = 2; and then just call them with GuiIDs.YOURMODBLOCK in the line instead of 1. Now to the GuiHandler class, that you made when registering it in you main mod class: Note that the getClientGuiElement returns the GUI of your block and the getServerGuiElement returns the Container of your block. The gui is just the texture and text if you want it, where the container actually gives you the slots to put stuff in. Also, If you are using the GuiIDs class, instead of writing "case 1:" do "case GuiIDs.YOURBLOCK", so everything is controlled by the GuiIDs class if you want to change the guiIDs around. Now to the Container Class. Create it at first, just like eclipse should recommend you in your GuiHandler Class. If you have a normal 3x3 crafting table you can pretty much just copy it from the ContainerWorkbench class. If you have something different, like a 2x2, 3x1 or basically anything, you'll have to change some things. I'll explain it if you want. For now I recommend just copying the ContainerWorkbench.class The only thing you have to change is onCraftMatrixChanged: @Override public void onCraftMatrixChanged(IInventory par1IInventory){ craftResult.setInventorySlotContents(0, CraftingManagerYOURBLOCKNAME.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } Create the CraftingManagerYOURBLOCKNAME class, but worry about it later. First the GuiYOURBLOCK class: You don't have to draw a text at the top, but if you want, you probably have to play around with the x and y coordinates a bit. Now to the CraftingManagerYOURBLOCKNAME class: Now this is pretty much the same as the vanilla CraftingManager class, look at it to understand how it works. You just add the recipes at the top, with the same pattern. The recipe that's in there currently is just an example. You also need a RecipeSorter, as far as I know: NOW Take a breath. That should be it. I probably forgot something, so tell me if it works. I have not tested this code yet, but that should be it and it should work Don't forget to import all the needed stuff if you copy some code from here. I am in no way a pro at this, and there is probably some unnecessary stuff, but other people that view this will tell you, (and me)
  22. Yes, but if he wants to have custom recipes, he will have to have a RecipeSorter and CraftingManager as well, as far as I know…
  23. Make a normal Block class that extends BlockHalfSlab. Then public *YourName*Slab(int id, boolean slabtype){ super(id, slabtype, Material.rock); this.setCreativeTab(CreativeTabs.tabBlock); this.setRequiresSelfNotify(); //if you want to have metadata this.setLightOpacity(0);//Fixes most of the Halfslab lightning bugs } "Slabtype" is a boolean which defines weather it is a single slab or a double slab (like when you place two slabs on top of each other they connect), set it to false for it to be a single slab. If you want your single slabs to connect to double slabs you'll need to add a few things, but for a simple halfslab that should be all. Be carefull with metadata though, the slab stores weather it's on top or on the bottom with metadata, which means you can't have 16 different slabs in one BlockID, just 8 at max.
  24. Hi, I'd like to help you, but before I post unnecessary stuff that just fills the whole page, what classes do you already have ?
×
×
  • Create New...

Important Information

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