Jump to content

Choonster

Moderators
  • Posts

    5124
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. This belongs in Modder Support, it should be moved there soon. Are you definitely adding the recipe in the init phase (i.e. is the method that adds the recipe definitely handling FMLInitializationEvent )? In your preInit method, you create an instance of ItemBerry without registering it or giving it a name. You then call ItemBerry.init and ItemBerry.register , which creates and registers an instance of Item with the name "berry" . You should register models from your client proxy instead of just checking the side in your @Mod class. Use ModelLoader.setCustomModelResourceLocation / ModelLoader.setCustomMeshDefinition in preInit instead of the ItemModelMesher#register overloads in init. I would highly recommend creating a dedicated class to create, register and store your items (the same goes for blocks, entities, etc.) and a dedicated class to register your block/item models. You can see an example of what I mean here: I have registration classes in com.choonster.testmod3.init and my models are registered in com.choonster.testmod3.client.model.ModModelManager (called from the client proxy).
  2. Override Item#getAttributeModifiers(ItemStack) instead of Item#getItemAttributeModifiers() .
  3. Yes. Even in a LAN game, the players may be in separate dimensions to each other.
  4. Does this method have the @SubscribeEvent annotation? Have you registered an instance of the class on the appropriate event bus? Are you sure you want to deny using the block regardless of what type of interaction event is was and what the player was holding and what they clicked on? If this is for an item, consider overriding Item#onItemRightClick . This is called when the item is used to right click air.
  5. You can't assume that there's only one World loaded at any time and maintain a single list from WorldEvent.Load / Save . Each time a block is added or removed, you need to fetch the WorldSavedData for that World and add or remove the position from that instance's list. @ForgeSubscribe doesn't exist any more, use @SubscribeEvent . I suspect you misread the event handler tutorial you followed. You can use a for-each/enhanced for loop to iterate through a collection such as an array or list.
  6. My fluid models are working without issue: You can see my fluid creation code here, my model registration code here and my blockstates file here.
  7. Keep in mind that IDs for modded block/items are automatically assigned and will likely be different for every world, they're not a very reliable way to store persistent data. Registry names are a much more reliable identifier for blocks/items. RegistryNamespaced#getNameForObject can be called on Block.blockRegistry or Item.itemRegistry to get the registry name of a Block / Item respectively.
  8. Yes, that looks correct. Is your field a List or a List<Position> ? Always use generic types when they're available.
  9. You need to save the NBT list tag inside the provided NBT compound tag using NBTTagCompound#setTag in writeToNBT . If you're using generics properly, you shouldn't need to cast objects from your list to Position .
  10. Use Block#getDefaultState to get the default state of a block, then chain IBlockState#withProperty calls to get an IBlockState with the specified property values.
  11. World#getBlock and World#setBlock were replaced by World#getBlockState and World#setBlockState , respectively. These take a BlockPos instead of individual coordinates and take/return an IBlockState instead of a Block . Use IBlockState#getBlock to get the Block represented by a state. Use Block#getDefaultState to get the default state of a block, then chain IBlockState#withProperty calls to get an IBlockState with the specified property values.
  12. Yes, as long as you haven't installed any JAR mods (i.e. mods that you need to put into the Minecraft JAR).
  13. If the list is only maintained and checked on the server, won't it all be running in a single thread? Even if you needed to maintain the list on both sides, wouldn't each side have its own WorldSavedData instance(s) each only being accessed from a single thread?
  14. You can either save each position as an int array or a compound tag. You don't write to NBT every time a block is added/removed, Minecraft will call readFromNBT and writeToNBT for you.
  15. It looks like you're running OptiFine, which messes with a lot of stuff and occasionally breaks things. Can you reproduce this without any mods installed?
  16. The source download was renamed to MDK (Mod Development Kit), since it hasn't actually included any Forge or Minecraft source code since the switch to ForgeGradle. Forge's official documentation has a Getting Started page here that explains how to set up modern versions of Forge.
  17. Upload the logs/fml-client-latest.log file to Gist and link it here.
  18. You must create a class that extends WorldSavedData and store the data in each instance of that, yes. The page I linked in my first post explains this in more detail. You can't store the list in your Block class directly, since you don't have any way to load/save the data and can't easily separate each dimension's list.
  19. In general, instance methods will only be called if the instance was actually involved in whatever happened. This means that Block#onBlockAdded will only be called on the Block that was actually added to the world.
  20. You're missing a required library (log4j), which is almost certainly an issue with your launcher.
  21. That's not the issue here. You're passing an Object array containing the pattern strings and some of the ingredients followed by the rest of the ingredients, so essentially you end up with this: new ShapedOreRecipe(new ItemStack(tool), new Object[]{ "hXf", " X ", " I ", 'h', "hammer", 'f', "file" }, 'X', "ingot" + mat, 'P', "plate" + mat, 'R', "rod" + mat, 'I', "stickWood") What you want is this (every argument except the first will be wrapped in an array because this is a vararg method): new ShapedOreRecipe(new ItemStack(tool), "hXf", " X ", " I ", 'h', "hammer", 'f', "file", 'X', "ingot" + mat, 'P', "plate" + mat, 'R', "rod" + mat, 'I', "stickWood") You need to create a single array containing all the pattern strings and ingredients and pass that as the second argument of the constructor.
  22. I suggest you override Block#onBlockAdded (called after a block is added to the world) and Block#breakBlock (called when a block is removed from the world, make sure you call the super method so the TileEntity [if any] is removed). Use these to add and remove the block's position to your WorldSavedData .
  23. If you need a collection to store multiple types, you need to declare it using a common parent of those types. String and Character don't have any common parent apart from Object , so declare it as an array of Object s.
  24. ShapedOreRecipe expects the pattern to be 1-3 strings or an array of strings, you're passing an array of pattern strings and ingredients. You need to concatenate the pattern/ingredient array with the other ingredients.
×
×
  • Create New...

Important Information

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