Jump to content

SanAndreaP

Forge Modder
  • Posts

    1689
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SanAndreaP

  1. In your render file, you do renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, Blocks.stone.getBlockTextureFromSide(0)); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 0)); Do not call the method twice at the same time, basically you setup the tessellator, set the normal, add the vertices (that's what renderFaceYNeg and the like do) and then draw. If you add too many vertices (like you do by calling the method one after another) with the currently selected drawing method it throws this exception. Basically, what you have to do is a construct like this: tess.startDrawingQuads(); tess.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, Blocks.stone.getBlockTextureFromSide(0)); tess.draw(); tess.startDrawingQuads(); // no need to set the normal again if you call the same render face method renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 0)); tess.draw();
  2. Can you give us the new code you're using?
  3. does it get stuck after it hits something or during flight? Another question is what does your EntityArrow do different from the vanilla one? I see a lot of copied code. Can't you just extend the vanilla one and make your changes? Here's an example from my arrow entity: https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/entity/EntityAvisArrow.java
  4. I might see the problem, you're getting an arrow with a missing texture icon, because of this: new ResourceLocation(Core.modid.toLowerCase() + ":ObsidianInfusedArrowEntity") You can't use the ResourceLocation the same way as you would register icons (since they not only handle textures, but also sounds etc.) To use it properly, you have to specify a path to the file (with extension), so like: new ResourceLocation("baseFolder:textures/entity/myArrow.png") where baseFolder is the folder in the assets folder (here your mod id) and textures/entity/myArrow.png the path to the texture file: assets/baseFolder/textures/entity/myArrow.png
  5. the registerGlobalEntityId is not needed, you can omit that. Can you do a System.Out.Println("renderme"); in your doRender method and see if it gets called?
  6. No, within the bow class, you only instantiate it. You need to register the entity class like any other entity.
  7. You need to register your block with a metadata sensitive version of ItemBlock. When you use GameRegistry.registerBlock() for your sapling, use the version with the ItemBlock class parameter and use the ItemBlockWithMetadata class: GameRegistry.registerBlock(myBlockInstance, ItemBlockWithMetadata.class, "myBlockRegisteredName");
  8. The only thing left is now the class where you register the entity itself.
  9. You can reuse your code in renderWorldBlock, but instead of using renderStandardBlock, use renderBlockAsItem (with appropriate parameters, Block, metadata, colorMultiplier) But please note, if the block which is rendered by that method has a custom render ID as well, you need to render it directly. Here's an example, where the code needed (except line 25) is marked yellow: https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/util/client/RenderBlockGlowOverlay.java#L24-L61
  10. Does not matter where you bind the texture (as long as it's before the texture drawing) 1. Why do you have an Icon in your render file? It does not belong there. 2. Can we see how you registered your Arrow entity (and the render)?
  11. It renders nothing when you return true in shouldRender3DInInventory because you don't have anything in your method renderInventoryBlock You need to return true, but also do your own render inside inventories with renderInventoryBlock
  12. You have several func_xxxxx_x and field_xxxxx_x in there. ALWAYS rename them if you don't override them! Also ALWAYS add @Override to methods you intend to override, since it makes it obvious if the method signature changed during an MC update (e.g if a parameter is not an int anymore but now a float)
  13. This actually doesn't matter @OP: In which order do you instantiate the item and creativetab? Sounds to me you instantiate the item first and then the creativetab. We can't tell for sure as long as you don't show us your main mod file.
  14. We can't tell you what's wrong with your code if you don't tell us what error you're having.
  15. ALWAYS add @Override to methods you intend to override, you would see the signature of the method is wrong
  16. Use event.gui = new WhateverGui() It also states in the event's javadoc:
  17. If you make a field non-static, it means every instance of this class has its own copy of that field (basic java) If you want to access such fields, within the class use this.fieldName (you can actually omit the this., but it's better for code-readabiliy to have it) (basic java) For accessing it outside of the class, you need an instance of said class and access it with this instance with instanceName.fieldName (again, basic java) To get such an instance of a TileEntity, you need to use world.getTileEntity(x,y,z)
  18. https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/registry/CraftingRegistry.java#L175-L249 This is my implementation of it. Basically the getCraftingResult() should be self-explanatory. It returns the ItemStack which is the result of the crafting. Here you can check if the wood in a specific slot is a type of wood and return an ItemStack with the appropriate wood item. getRecipeOutput(), Here you can return a generic ItemStack, but you don't have to (I return null here) getRecipeSize() returns the needed size of the crafting grid (9 for a 3x3 grid, 4 for 2x2) matches() should check the crafting grid if the laid out recipe is the right one, and should return true if so.
  19. Well, there are some specific reasons to edit code, first would be that Forge doesn't provide a hook for a specific part of Minecraft, thus having to hack it in yourself (if the hack is worthy enough to be useful for other mods, you can then always submit a PR, though). The proper (and only really) way to edit Minecraft's source code is to utilize ASM, to manipulate the bytecode of classes directly, where your mod must be a coremod in order to use it. There are some tutorials out there for this kind of thing, and you can always look at either my coremod or any open-source coremod out there. However as a general rule, keep the edits at minimum.
  20. whoops, I meant --refresh-dependencies instead of --refreshDependencies
  21. Uhm, that's his signature...
  22. I use a different packet system, which seems complicated at first glance, but it's actually pretty easy to setup and use: https://github.com/SanAndreasP/SAPManagerPack/tree/master/java/de/sanandrew/core/manpack/mod/packet https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/mod/ModCntManPack.java You basically use the IPacket interface and implement it in your custom packet class. The ChannelHandler is registered in the mod class and everytime you send a packet, you reference it. Here's an example for this: https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/registry/ESPModRegistry.java # line 82: instantiate the ChannelHandler (you can also do this in the preInit, it doesn't matter where, but not on init / postInit) # line 121 - 125: register your custom packet classes (always after you've instantated the handler of course) # line 153: initialise the channelHandler # line 161: postInitialise the channelHandler https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/packet/PacketBCGUIAction.java # example for a packet class https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/client/gui/BiomeChanger/GuiBiomeChangerBase.java#L46-L47 # example for sending the packet (lines are marked yellow)
  23. Just reasoning and looking up. Eclipse (or any other reasonably good IDE really) has great features for this. I first open the Event class, right-click on the constructor and choose "Open Call hierarchy"), then I see when the event is exactly fired. I even see there which event bus to use (there are following event busses existing: for Minecraft Forge EVENT_BUS, TERRAIN_GEN_BUS and ORE_GEN_BUS; for FML it's only FMLCommonHandler.instance().bus() (and actually the mod loading events, which call your preInit, init etc.))
  24. How about going with those commands: gradlew clean gradlew cleanCache gradlew setupDecompWorkspace --refresh-dependencies gradlew eclipse It's basically how I do it everytime.
  25. The EntityInteractEvent (which Pardeep is using) actually runs twice because of server/client (1x server-call, 1x client-call) so for that you just check if worldObj.isRemote == true/false (true if you want client-side, grab the worldObj from the entity shipped by the event parameter) For any kind of block/item interaction (for blocks there are left/right-click, for items only right-click, this would be your case, delpi) there is AFAIK only the serverside interaction. For blocks, the event will always trigger 1x (either if you right-click or left-click the block). To check with which mouse button the player interacts with the block, use the event.action variable (either RIGHT_CLICK_BLOCK or LEFT_CLICK_BLOCK). Item interactions (right-click only here) is a special case where the event seems to fire either 1x or 2x. The 1x is when the player right-clicks with the item when he doesn't face a block (either no block in sight or block too far away). The 2x is if he does. In either case, the event will trigger with the event RIGHT_CLICK_AIR. the 2nd one will also fire with RIGHT_CLICK_BLOCK. I hope I could clarify some things
×
×
  • Create New...

Important Information

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