Jump to content

Choonster

Moderators
  • Posts

    5124
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. You need to extract the individual x/y/z coordinates from the BlockPos . How about you look at BlockPos and its parent class to see how that can be done?
  2. ForgeHooks.rayTraceEyes returns a MovingObjectPosition . I explained how to get the block position from the MovingObjectPosition in the same post I told you to use ForgeHooks.rayTraceEyes .
  3. ModItems.items is a collection of all of my mod's Item instances. Using Java 8's Stream API, I create a stream from that collection, filter out the items that have already had a model registered and then call registerItemModel(Item) for each remaining item. This registers the default model for the item, i.e. the inventory variant of the model with the item's registry name. The various overloads of ModModelManager#registerItemModel all boil down to registering the model with ModelBakery.registerItemVariants (so Minecraft loads it), creating an ItemMeshDefinition that returns a single constant ModelResourceLocation and registering it for an Item with ModelLoader.setCustomMeshDefinition (so Minecraft uses it for that Item ). This uses a single model for every metadata value of the Item . The various overloads of ModModelManager#registerItemModelForMeta all boil down to registering a ModelResourceLocation for a specific metadata value of the Item with ModelLoader.setCustomModelResourceLocation . This automatically calls ModelBakery.registerItemVariants . You don't have to, you can use regular item models in the same way (use multiple model paths with the inventory variant instead of a single model path with multiple variants). Forge added the option to use blockstates files for items a while back, so I wanted to try out the new feature.
  4. If you look at the MovingObjectPosition class in your IDE, you'll see that it doesn't have blockX / Y / Z fields. The position of the block that was hit is stored in the blockPos field as a BlockPos object which contains the individual coordinates. Entity#rayTrace is a client-only method, using it in common code like Item#onItemRightClick will crash the dedicated server. Use ForgeHooks.rayTraceEyes to ray-trace a custom distance, always ignoring liquids or use Item#getMovingObjectPositionFromPlayer to ray-trace the block reach distance (default is 5.0), optionally ignoring liquids. Like regular entities, weather effects should only be spawned on the server (when World#isRemote is false ). Don't bump your thread, especially if it's still on the first page. People will respond when they have something to say, bumping will only annoy them.
  5. A NullPointerException means that you tried to call a method or access a field of a null value. If you look at Item#getDamage (line 939), the only value that's having a method called or a field accessed is the stack argument. Item#getDamage is being called with null as its argument from LMLimoniteSword#onItemRightClick (line 26).
  6. You're trying to set a field of this.rightarm before you assign it a value, so it's still null . This causes the NullPointerException . To be honest, your code is a mess; it looks like it was generated by MCreator or a similar program: You have a bunch of random methods all over the place, some of which are doing absolutely nothing. You don't have a clear separation between common and client-only code. You're using global entity IDs and manually adding spawn eggs. Just use the overload of EntityRegistry.registerModEntity with the two additional int arguments and an egg will be added using those as the background/foreground colours. Global IDs aren't needed and will only cause problems.
  7. Override Item#getModel to return the ModelResourceLocation of the appropriate model based on the remaining use time (using the same logic as the vanilla bow). You can see an example of this here (model registration is here and here). Edit: Fix link tag.
  8. There's no crash in that log, it simply ends while the world is loading.
  9. The Entity#ticksExisted field is the number of ticks the entity has existed for. In your override of Entity#onEntityUpdate check if this is greater than or equal to 600 (30 seconds * 20 ticks/second = 600 ticks) and if it is, damage the entity using Entity#attackEntityFrom .
  10. Something is null on line 220 of the P.ModelPHead class (in the constructor). We're not telepathic, so we can't really tell you much more without seeing your code.
  11. Call the super method from your override of Entity#onEntityUpdate . This sets a lot of important values like the prevPosX / Y / Z fields, which are used for various rendering purposes.
  12. Be more specific. What doesn't like what? What's the error message and what part of the code is it for? If @Override gives you a compilation error, the method doesn't override a super method.
  13. Item#onItemRightClick doesn't have that signature, so you've created a new method that's never called instead of overriding the method that Minecraft calls. Always add the @Override annotation to override methods so you get a compilation error if it doesn't actually override a super method. I suggest using your IDE to auto-generate override methods, this way the override method will always have the correct signature and the @Override annotation.
  14. It took a while to get around to it, but I finally sat down and fixed your issues. I've submitted a pull request with my changes.
  15. Is your texture located at src/main/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_lmcreativetab.png?
  16. Have you put the mods in the right directory? Forge will load mods from the <GameDirectory>/mods and <GameDirectory>/mods/<MinecraftVersion> directories, where <GameDirectory> is the game directory set in the profile (this is the .minecraft directory by default) and <MinecraftVersion> is the Minecraft version (1.8.9 in this case). If you look at the launcher's Game Output tab or the FML log (<GameDirectory>/logs/fml-client-latest.log), you should see a line that says "Searching <GameDirectory>\mods for mods", this tells you where Forge is looking for mods.
  17. Ah, it looks like it's a bit tricky to render a baked model that isn't a Block or Item (since Minecraft rarely uses baked models for other things). You should be able to subscribe to ModelBakeEvent , load the model into an IModel using ModelLoader#getModel , bake it using IModel#bake (look at how this is used in ModelLoader#setupModelRegistry ) and then add it to the model registry with IRegistry#putObject . The ModelLoader and model registry are provided as fields of ModelBakeEvent . Look at RenderItemFrame#doRender to see how you can render an IBakedModel that doesn't belong to a Block or Item . I'm far from an expert in the model/rendering system, so I can't guarantee that this is correct.
  18. Oh, you have a JSON model that you want to render as an entity? I thought you had an entity model that you wanted to render as an item/block. It's certainly possible to render baked models as entities, look at RenderFallingBlock .
  19. Every TileEntity class must have a no-argument constructor.
  20. An Item is an item type. An ItemStack is an individual stack of an item, it contains an Item , a metadata value, an optional NBT compound tag and zero or more capabilities (added by Forge). You need to check that the fuel ItemStack 's Item ( ItemStack#getItem ) is the item form of Blocks.sponge ( Item.getItemFromBlock ) and that its metadata ( ItemStack#getMetadata ) is 0. These are two separate equality expressions.
  21. LayerArmorBase is the base class for the armour layer, LayerBipedArmor is used for all bipedal models. It uses one ModelBiped for the legs and one for the head, chest and boots. Zombies, Skeletons and Armor Stands use their own models instead of the base ModelBiped s. To use custom models for your own armour, you need to override Item#getArmorModel(EntityLivingBase, ItemStack, int, ModelBiped) to return a ModelBiped that renders your armour. I don't know much about rendering, so I can't help you much more than this.
  22. You probably can't, since entity models rely on raw OpenGL instructions. You can probably render a regular baked model for the simple parts and then render the entity model from a TESR . The enchanting table does something like this: the base is a baked model, the book is rendered from the TESR .
  23. Stick to one question per topic, don't replace the OP with a new question once you have the solution. This makes it harder for other people having the same problem to find the solution. To generate ore in non-stone blocks, use the WorldGenMinable(IBlockState, int, Predicate<IBlockState>) constructor. The Predicate determines whether the ore can replace a given IBlockState . Use BlockHelper.forBlock to create a Predicate that matches any state of the specified Block . The armour item models are in assets/minecraft/models/item with the other item models. Rendering armour on entity models is handled by LayerArmorBase and its subclasses, JSON models aren't used.
  24. 1 damage takes away 1 health. Each heart is 2 health. Like I said in my previous post, the arrow's base damage is multiplied by the magnitude of its motion vector to determine the actual damage. A decently charged arrow can easily have a velocity of 1.0, which results in a motion of roughly 2.97 when hitting a fairly close target. This is also a critical, which applies bonus damage. I said in my previous post that the base damage of the arrow is 20, it's actually 2.0 (I wasn't paying enough attention). The damage is actually rounded up after being multiplied with the motion, so 2.97 * 2.0 becomes 6 damage (before the critical bonus).
  25. To do something every tick from an Item , override Item#onUpdate . To store data for an Item , either use the NBT or the new Capability system.
×
×
  • Create New...

Important Information

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