Jump to content

Choonster

Moderators
  • Posts

    5161
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. You can't compare ItemStacks using Object#equals, you need to use one of the static equality methods in the ItemStack class. You shouldn't be creating a new ItemStack at all, though. You need to get the ItemStack key from the Iterator and check its Item, metadata and NBT as appropriate to determine whether it should be removed. Iterator<E> is a generic type, don't use it (or any other generic type) without specifying its type argument.
  2. Calling Map#remove with a new ItemStack on a Map with ItemStack keys won't do anything. ItemStack doesn't override Object#equals or Object#hashCode, so two ItemStacks are only considered to be the same key if they're the same object. Map#remove will only work here if you call it with an ItemStack object that's already a key in the Map.
  3. It should probably be fired just before the second if statement in WorldEntitySpawner.canCreatureTypeSpawnAtLocation. The event should include the EntityLiving.SpawnPlacementType, World, BlockPos and IBlockState and have an Event.Result that controls the behaviour (like LivingSpawnEvent.CheckSpawn). An alternative would be to add a method to EntityLiving.SpawnPlacementType that takes the World, BlockPos and IBlockState and returns a nullable Boolean or Optional<Boolean> functioning similar to Event.Result (allow, deny, default). You'd then need to add a field to EntityLiving.SpawnPlacementType to hold a delegate function for the method to call (like EnumEnchantmentType#canEnchantItem/EnumEnchantmentType#delegate). A Function<Triple<World, BlockPos, IBlockState>> would work, though it's a bit ugly.
  4. It was renamed to net.minecraft.util.text.translation.I18n and deprecated, because the server shouldn't be translating things (the dedicated server can only translate to en_US). Use net.minecraft.client.resources.I18n from the client instead (or send a TextComponentTranslation, which will translate to the client's locale). This hasn't changed. Override Block#hasTileEntity(IBlockState) to return true for any state that has a TileEntity and override Block#createTileEntity to create an return an instance of the TileEntity for the provided state. Which methods do you want to know about? Try looking at the TileEntity class or vanilla extensions of it. MCPBot can tell you the SRG name of a field/method in a specific version and also tell you the current MCP name of an SRG name. This issue tracker documents most renamed field/methods. Again, look at vanilla examples like BlockCactus or BlockBasePressurePlate. Store the block's bounding boxes as AABB fields. Override Block#getBoundingBox to return your Block's main bounding box, Block#getCollisionBoundingBox to return your Block's collision bounding box (if it's different to the main bounding box) and Block#getSelectedBoundingBox to return your Block's selection bounding box offset by the BlockPos (if it's different to the main bounding box). If your Block has multiple collision bounding boxes, override Block#addCollisionBoxToList (the instance method) to call Block.addCollisionBoxToList (the static method) for each bounding box. Entity#getRidingEntity returns the entity being ridden by this. Entity#getPassengers returns the entities riding this.
  5. Create a new instance of your IWorldEventListener for each World and store the World in a field. ServerWorldEventHandler and RenderGlobal both do this.
  6. Which clients need which data and when? If a client always needs to know a particular value (e.g to render it on a HUD), send a packet to any relevant players when they log in and when the value changes. If a client only needs to know the value in a GUI, you can probably sync it through the Container (either using the built-in syncing packets or your own). If a bank account is only ever linked to one player, consider storing a player's bank account(s) in a player Capability instead of using World Saved Data.
  7. Are there any errors in the log?
  8. Your WorldSavedData class must have a constructor that takes a single String argument.
  9. You're using the blocks Field twice and casting the value of the second call to List<Template.EntityInfo> instead of using the entities Field. This will throw a ClassCastException at runtime. It also looks like you're not actually using the size Field. I recommend following Java naming conventions by using CONSTANT_CASE for constant fields.
  10. Set the tint index for each model face you want to be coloured at runtime and register an IBlockColor for the Block that returns the appropriate colour for each tint index depending on the location. Look at BlockColors for vanilla examples.
  11. Use ReflectionHelper.findField or ReflectionHelper.findMethod to get a Field/Method object for the field/method and store it in a private static final field. You'll need to provide both the MCP and SRG names of the field/method. Use Field#get or Field#set to get or set the value of a field. If it's an instance field, pass the instance as the first argument. If it's a static field, pass null as the first argument instead. Use Method#invoke to call a method. If it's an instance method, pass the instance as the first argument. If it's a static method, pass null as the first argument instead. Pass the method's arguments as the vararg argument.
  12. That's the correct way to create a ResourceLocation, assuming your shuriken texture is located at assets/<modid>/textures/items/shuriken.png. It's not directly related to your issue, but I noticed that you're extending the raw Render type instead of specifying its generic type argument. If you specify the type argument as EntityShuriken, you can delete the getEntityTexture(Entity) and doRender(Entity, ...) methods, since the getEntityTexture(EntityShuriken) and doRender(EntityShuriken, ...) methods will override the corresponding super methods. If you want your entity to render as an item model (like snowballs, ender pearls, eggs, etc.), you can use or extend RenderSnowball.
  13. IRenderFactory#createRenderFor is called from the RenderManager constructor, before the RenderManager instance is stored in the Minecraft#renderManager field (used by Minecraft#getRenderManager). This means you're passing null as the RenderManager argument of your RenderShuriken constructor, so Render#bindTexture throws a NullPointerException when it tries to get the RenderManager#renderEngine field from it. You need to use the RenderManager instance passed as an argument to IRenderFactory#createRenderFor instead of trying to get it from Minecraft. This is also a general guideline you should follow: Use the data you've been given rather than trying to get the data yourself (unless you have a specific reason not to).
  14. Even if they only run on older versions of Minecraft, the models produced by them should work in 1.11.2.
  15. You can try Tabula or Qubble.
  16. You need to handle the random chance and random amounts yourself: generate a random number for the amount of soil and add a stack of that much soil to the list (or that many stacks of 1 soil), then generate a random number for the rock drop chance and add a rock to the drops list if it's within the 10% range.
  17. You can do exactly the same thing as you would in BreakEvent, just add drops to the list instead of manually spawning them as entities.
  18. PlayerTickEvent is fired for all players (even on the client side), not just the client player. If you want to do something every tick on the client, use ClientTickEvent.
  19. I'm not too sure, sorry. I don't know all that much about rendering.
  20. You should be able to use FontRenderer#drawSplitString or FontRenderer#listFormattedStringToWidth for this.
  21. If you're developing a mod and you have a class that extends ItemAxe, you need to use the ItemAxe(ToolMaterial, float, float) constructor for non-vanilla ToolMaterials. The ItemAxe(ToolMaterial) constructor only works for vanilla ToolMaterials because it uses the ordinal as an array index.
  22. 1.6.4 is no longer supported by Forge, you won't get any help with it here.
  23. A task that was scheduled with IThreadListener#addScheduledTask is throwing an ArrayIndexOutOfBoundsException, but I can't tell you where it's being thrown from because you didn't post the full stack trace. Either post the full stack trace/crash report in a code block (the <> button) or post the full FML log (logs/fml-client-latest.log) using Gist or Pastebin. Alternatively, read it yourself and figure out why the exception is being thrown and what you can do to stop it.
  24. If you click "Show all downloads" on the Forge download page, you'll see a full list of downloads with an i icon next to each download link. Hover over this and there'll be a "Direct Download" link that bypasses AdFocus (if the regular link uses AdFocus) and downloads the file directly.
×
×
  • Create New...

Important Information

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