Jump to content

Choonster

Moderators
  • Posts

    5160
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. For future reference: Any code that imports classes from the cpw.mods.fml.* packages was written for 1.7.10 or earlier. FML was moved to net.minecraftforge.fml.* in 1.8.
  2. Note that all subclasses of FMLNetworkEvent (e.g. ClientConnectedToServerEvent) are fired on a Netty thread rather than the main client/server thread, so methods that handle them must not directly interact with normal Minecraft classes. You need to use IThreadListener#addScheduledTask to run a task on the main thread where you can safely interact with normal Minecraft classes.
  3. You need to create your own implementations of IRecipe to handle adding orbs to and removing orbs from the staff. You can probably extend an existing IRecipe implementation like ShapedOreRecipe/ShapelessOreRecipe. Register your recipe classes with RecipeSorter and add instances of them to the recipe list using GameRegistry#addRecipe(IRecipe). Side note: There is no ICraftingHandler in any modern version of Forge. It looks like ICraftingHandler was a predecessor to events like PlayerEvent.ItemCraftedEvent and was removed in 1.7.2 (I never encountered it myself).
  4. Is this in your @Mod class? Are there any errors in the log? Post the testCommand class.
  5. ModelLoader methods must be called in preInit, they won't do anything if called in init or later. It looks like your assets aren't being loaded. Where is your assets folder located? It should be in src/main/resources. If it's still not working, post the FML log (logs/fml-client-latest.log in the game directory) using Gist/Pastebin.
  6. It sounds like you're only registering it on the client. You need to register your commands on both physical sides in FMLServerStartingEvent, which needs to be handled by a @Mod.EventHandler method in your @Mod class. If you're doing this and it's still not working, post your code.
  7. The vanilla FontRenderer supports 256 pages of 256 characters, which is the entirety of the Basic Multilingual Plane (BMP) and the full value range of a char. To support the full range of Unicode code points, you'll need to iterate through the code points of a String (represented as ints or pairs of chars) rather than the code units (represented as chars). In Java 8, CharSequence#codePoints returns an IntStream of a CharSequence's code points. You'll need to create your own page textures and glyph width file for code points outside of the BMP and arrays to store the page locations and glyph widths. You'll then need to override FontRenderer#renderUnicodeChar to do the same thing as the super method but use your page textures/glyph widths. You can then replace Minecraft#fontRenderer with an instance of your class.
  8. You're creating a new ModLeavesItem instance for the ModelLoader.setCustomModelResourceLocation call, don't do this. You need to use the ItemBlock you already registered. You can use Item.getItemFromBlock to get the Item form of a Block. Do you want your items to use the models defined by your blockstates variant or do you want them to use individual item models? If it's the former, use a ModelResourceLocation with the registry name as the domain and path and the variant name as the variant. If it's the latter, use a ModelResourceLocation with the item model's name as the domain and path and any variant name (it won't be used). I don't know why localisation wouldn't be working. Post the relevant code, and the contents and path of your lang file.
  9. I have an example of something similar here, here and here. I use a World capability (IChunkEnergyHolder) to store a Map containing the IChunkEnergy (which stores a single integer) for each chunk of the World. I use ChunkDataEvent.Load to read the IChunkEnergy from the chunk's NBT and store it in the Map, ChunkEvent.Load to create a default IChunkEnergy for the chunk if it doesn't have one and store it in the Map, ChunkDataEvent.Save to save the IChunkEnergy to the chunk's NBT and ChunkEvent.Unload to remove the IChunkEnergy from the Map. The capability doesn't actually save any data itself, it only exists to hold the Map at runtime. I use ChunkWatchEvent.Watch to send the IChunkEnergy to the client when a player starts watching a chunk. Whenever an IChunkEnergy's stored value changes, it's sent to all players watching the chunk.
  10. I don't think this is currently possible using the vanilla passive spawning system. When WorldEntitySpawner#findChunksForSpawning tries to spawn an entity, it calls WorldServer#canCreatureTypeSpawnHere and WorldEntitySpawner#canCreatureTypeSpawnAtLocation and only proceeds if they both return true. You can use WorldEvent.PotentialSpawns to change the result of the former, but the latter is hardcoded to check for water if the entity uses EntityLiving.SpawnPlacementType.IN_WATER and call Block#canCreatureSpawn (which calls (Block#isSideSolid with EnumFacing.UP) for any other EntityLiving.SpawnPlacementType. Lava isn't water or a solid block, so entities won't be spawned in it. I think Forge would need to add an event in WorldEntitySpawner#canCreatureTypeSpawnAtLocation to allow the result of the method to be changed.
  11. I suspect you're running into the discrepancy between EntityPlayerMP#getPosition and EntityPlayerSP#getPosition. The former adds 0.5 to the y coordinate and uses the x and z coordinates as-is, but the latter adds 0.5 to every coordinate. I don't really know why Mojang chose to do this. You'll likely want to use the BlockPos(Entity) constructor instead, this won't add any offsets to the entity's coordinates.
  12. Mod fluid Blocks implement IFluidBlock. If it's only working on one side, you're likely doing something wrong. Post your code.
  13. OkHttp depends on Okio, which you don't have.
  14. What do you mean by "crush"? Is the client crashing? Is it freezing? Post the code where you use the client. If it's crashing, post the crash report as well.
  15. That difference is what prevents it from being an override method. As this tutorial explains, override methods must have the same return type, number and type of parameters as the super method. You can return a subtype of the super method's return type, but the parameter types must be exactly the same.
  16. This isn't specific to Minecraft or Forge, this is basic Java knowledge which you should already have before starting to make a mod.
  17. Your method doesn't override any method from a parent class (it has the wrong argument types to override Block#onEntityCollidedWithBlock), so it's never called. If you'd annotated it with @Override, your IDE or the compiler would have told you this. I recommend using your IDE to auto-generate override methods with the correct signature and annotations. When updating a new version of Minecraft, I auto-generate override methods for any methods I was previously overriding that have changed signature and then move the body of the previous method into the new one. Side note: DamageSource instances should be treated as singletons (i.e. created once and then stored somewhere) unless there's additional data that changes each time the damage is done (e.g. the entities of EntityDamageSource/EntityDamageSourceIndirect).
  18. CraftingManager#addRecipe(ItemStack, Object...) converts Block ingredients to ItemStacks with OreDictionary.WILDCARD_VALUE as the metadata value, but CraftingManager#addShapelessRecipe converts Block ingredients to ItemStacks with 0 as the metadata value. The ore recipe constructors do the same: ShapedOreRecipe uses OreDictionary.WILDCARD_VALUE, ShapelessOreRecipe uses 0.
  19. I haven't used the new launcher yet, but I'd guess you already had a profile called "forge" and the installer didn't overwrite it. What you need to do is create a new profile and select the appropriate Forge version from the versions list.
  20. Which version of Forge did you download? What makes you think it's for 1.10.2? Can you post the URL you downloaded it from?
  21. The super method is the method with the same signature (name and parameters) in the super class (the one overridden by the current method).
  22. It was added in Forge 1.10.2-12.18.2.2107, make sure you're using either the Recommended or Latest version of Forge. The line that calls GlStateManager.scale. Only use the Grill instance stored in your TESR (the grill field) if the Grill argument (te) is null (i.e. it's being rendered in the inventory rather than the world).
  23. Look at BlockSkull or BlockBanner. You can see an example of a TileEntity's IFluidHandler being saved to an ItemStack's IFluidHandlerItem here.
  24. Did you try searching the Block class for "hardness" or "resistance"? If you did, you probably would have found Block#getBlockHardness and Block#getExplosionResistance(Entity)/Block#getExplosionResistance(World, BlockPos, Entity, Explosion). Block#getHardness shouldn't be called directly, you should call IBlockProperties#getBlockHardness instead (IBlockState extends IBlockProperties).
×
×
  • Create New...

Important Information

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