Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Choonster

Moderators
  • Joined

  • Last visited

Everything posted by Choonster

  1. Create the ItemStack of Items.SPAWN_EGG , then call ItemMonsterPlacer.applyEntityIdToItemStack to set the ItemStack 's spawned entity ID. Look at the implementation of this method to see how it produces the same NBT structure as you'd use in the command.
  2. Choonster replied to Lyras's topic in Modder Support
    I can't see any obvious problems with your code, I suggest stepping through it in a debugger to see where things go wrong. For the FOV values, look at AbstractClientPlayer#getFovModifier (where FOVUpdateEvent is fired) or the code from my mod that I linked in my first post.
  3. Biomes are stored in the Chunk#blockBiomeArray field. Use World#getChunkFromBlockCoords to get the Chunk at the specified position, then use Chunk#getBiomeArray to get the biome array. This array stores the ID of the Biome at each x/z position within the chunk, using (z & 15) << 4 | (x & 15) as the index. Use Biome#getIdForBiome to get the ID of a Biome .
  4. I recommend extending ItemTool and calling Item#setHarvestLevel in the constructor for each tool class. You can see my implementation of a multi-tool here.
  5. Choonster replied to Lyras's topic in Modder Support
    I explained how to handle the FOV in my first post. Post your new code.
  6. Post your FML log, blockstates file(s), model(s) and a screenshot of the directory structure containing these files.
  7. Random is a (pseudo-)random number generator. Call Random#nextInt to get a random integer in the specified range. Math.random returns a random number in the range [0, 1) (i.e. greater than or equal to 0, less than 1). If you multiply by 4 and add 1, the new range is [1, 5) ; which means that it will never be 0 and your potion effect will never be applied.
  8. You're registering each subtype as a variant of the item's registry name, so Minecraft will look for a blockstates file named with the item's registry name containing a variant for each of the subtypes. Is this what you want? What's actually happening? The FML log (logs/fml-client-latest.log) will contain any model loading errors, please post it.
  9. You have a _JAVA_OPTIONS environment variable setting the maximum memory to 512 MB, delete it. Where do I go to delete it? Environment variables are a feature of your OS, use your search engine of choice to find the answer.
  10. Choonster replied to Lyras's topic in Modder Support
    You're setting the pickup status to CREATIVE_ONLY when ammo is required (i.e. no Infinity enchantment or creative mode). This is the opposite of what you want. I suggest looking at ItemBow#onPlayerStoppedUsing again.
  11. Choonster replied to Lyras's topic in Modder Support
    In EntityArrow#onCollideWithPlayer , the item is only added to the player's inventory if the pickup status is ALLOWED .
  12. The Biome Dictionary is a part of Forge. BOP registers all of its biomes with the Biome Dictionary, using the appropriate types for each one. In 1.7.10, this is done here.
  13. You can use BiomeDictionary.getBiomesForType to get all BiomeGenBase instances registered as the specified BiomeDictionary.Type (e.g. FOREST or PLAINS ). 1.7.10 is extremely outdated and no longer supported, update to 1.10.2.
  14. Models can be generated on demand and cached. I suggest looking at ModelDynBucket , it uses an ItemOverridesList to generate a model with the texture of the Fluid contained in the bucket.
  15. The attribute modifiers and backstabbing code should run on both sides.
  16. This is probably possible with a custom model, though the asynchronous nature of skin downloading may make things tricky. You'll need an ICustomModelLoader , IModel and ItemOverridesList for your model. I don't know of any tutorials on these, but there are several examples in Forge itself. diesieben07 talks about a custom model in this thread, though it was for 1.8.9 so things are slightly different now.
  17. Yes. Higher attack damage = more damage dealt, higher attack speed = less cooldown after each attack.
  18. I explain this here. Use the same method I described in the post linked above to change the ATTACK_DAMAGE attribute modifier. You'll probably want to override ItemSword#getDamageVsEntity as well, though this is only used by non-player entities to determine whether they should replace their currently held sword with one on the ground (the one with a higher return value from this method is favoured). The actual damage dealt when attacking is controlled by the attribute system. Override Item#hasContainerItem(ItemStack) to return true and override Item#getContainerItem(ItemStack) to return its argument (after making any necessary modifications, e.g. damaging the item). AttackEntityEvent is fired whenever a player tries to attack to an entity, before it checks whether the entity can actually be attacked and damaged. I'd recommend overriding Item#hitEntity and performing these checks there instead. You'll probably need to use the Entity#rotationYaw field of the target to get its facing and compare the positions of the entities. I don't know exactly how to achieve this.
  19. To be more specific, use a log4j2 Logger . You can get one with your mod's name from FMLPreInitializationEvent#getModLog or with any name you want from LogManager.getLogger .
  20. Java is picking up the -Xmx256M argument from somewhere, limiting the memory to 256 MB. Do you have the _JAVA_OPTIONS environment variable set? If so, delete it.
  21. Don't create your own instance of BlockColors , it's a singleton. Minecraft will only use its own instance, stored in the Minecraft#blockColors field.
  22. You can achieve something like this by copying the log4j2.xml file from the Forge JAR into src/main/resources and modifying the level of the SysOut and FmlSysOut <AppenderRef> elements to WARN , ERROR , FATAL or OFF (ordered from least specific [most messages] to most specific [least messages]). This will be copied into your mod JAR when you build it with Gradle, which you don't want. There's probably a way to filter it out with Gradle, but I haven't managed to find that yet.
  23. You need to register an IBlockColor and IItemColor for the Block and Item from your client proxy in init. Look at the BlockColors / ItemColors classes to see how vanilla does this.
  24. A bit is either 1 or 0. 2 values per bit with 4 bits is 16 (2^4) possible permutations.
  25. That fixed it, thanks. New code is here.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.