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. When a bed item is right clicked on a block: The foot block is placed, calling Block#neighborChanged on the surrounding blocks (none of which are incomplete beds) The head block is placed, calling Block#neighborChanged on the surrounding blocks (one of which is the foot of the now-complete bed) Block#neighborChanged is never called on an incomplete bed while the bed is being placed. You should implement your Block#neighborChanged override such that it only checks the immediately adjacent blocks and not the whole structure. Let's say your structure is composed of three blocks: left, right and centre. When your item is right clicked on a block: Place the left block, calling Block#neighborChanged on the surrounding blocks. None of these are structure blocks. Place the centre block, calling Block#neighborChanged on the surrounding blocks. One of these is the left block, which checks the immediately adjacent blocks, finds the centre block and does nothing because it's valid. Place the right block, calling Block#neighborChanged on the surrounding blocks. One of these is the centre blocks, which checks the immediately adjacent blocks, finds both the left and right blocks and does nothing because they're valid. Whenever a structure block is broken, Block#neighborChanged will be called on the surrounding blocks. The adjacent structure blocks will see that the structure is now incomplete and remove themselves, propagating the change along the structure.
  2. Do you ever create an register an instance of bookScale ? If so, why use the vanilla book for its sub-items? If not, why does it extend Item at all? A NullPointerException is thrown when you attempt access a method or field of a null value. You'll have to figure out what's null and why it's null . I mean you should use a loot function (either set_nbt or your own custom function) in the loot table file to fill out the page data for the book.
  3. Forge has an animation system for baked models in the net.minecraftforge.client.model.animation package, though there's not a lot of documentation on it. Fry (a.k.a. RainWarrior) briefly described the purpose of each class in the commit that introduced the system. They've also documented the grammar of the Animation State Machine files here. Forge has a test mod for the system here.
  4. The launcher is a standard Java program, you can decompile it with a Java decompiler. That said, you're unlikely to receive any support here for modifying it. I believe Lex's stance (and Mojang's) is that everyone should be using the official launcher rather than making their own. If you want to make a modpack manager, make it use the official launcher to run the game (like Curse does).
  5. In 1.9.x, use World Saved Data. In 1.10.2, Forge has implemented World capabilities.
  6. Either use the set_nbt function in the loot table file to set the NBT or create your own LootFunction that sets the appropriate NBT. You're setting the bookScale.eastScale field to an ItemStack of Items.WRITTEN_BOOK instead of the bookScale instance, are you sure this is what you want? I recommend following Java and MCP naming conventions: PascalCase for class names, prefixed with the base type that they extend (i.e. ItemBookScale instead of bookScale ).
  7. You installed a coremod built for 1.7.10. If you don't know which one, upload the full FML log (logs/fml-client-latest.log) to Gist and link it here. You also posted this in the wrong section (Modder Support instead of Support and Bug Reports), but it should be moved soon.
  8. I'm not sure what the current problem is, creating a separate thread for it may be a good idea. There's a collection of tutorials for 1.10.2 here.
  9. I can't help you with the world generation itself, but I suggest you use your IDE's debugger to pause the process when Minecraft freezes and see what it's executing. This may give you a better idea of what's causing the freezes.
  10. EntityPlayer#inventory is an InventoryPlayer , not a Container . Use ItemHandlerHelper.giveItemToPlayer to give an item to a player or drop it at their feet if there wasn't room for it in their inventory.
  11. Get the World 's WorldProvider from the World#provider field, then get the dimension ID from the WorldProvider#getDimension method.
  12. I implemented this here using a per-tick check to see if the player's held item reveals hidden blocks (using a capability) and re-rendering chunks containing hidden blocks when the player starts or stops revealing them. This is based on the code that allows EnderIO's Yeta Wrench to hide Conduit Facades. I had to use a ticking TileEntity , but I tried to keep it as lean as possible. There was a small FPS drop when starting or stopping the revealing due to the chunks re-rendering, but FPS seemed stable once the chunks had been rendered. This may or may not be as performant as the TextureAtlasSprite method suggested by diesieben07.
  13. TileEntity syncing changed in 1.9.4, there are now two separate methods used to sync data to the client. This document explains in more detail.
  14. Call Container#detectAndSendChanges on EntityPlayer#inventoryContainer to sync the player's inventory to their client. If you make a large amount of changes to an inventory, consider calling EntityPlayerMP#sendContainerToPlayer instead. This sends a single packet with the whole inventory instead of sending an individual packet for each slot that changed.
  15. Do not use the ItemStack(Item, int, int, NBTTagCompound) constructor, the fourth argument is for the capability data rather than the stack's compound tag. Use ItemStack#setTagCompound to set the stack's compound tag.
  16. RenderGlobal#notifyBlockUpdate passes the boolean value of flag 8 to RenderChunk#setNeedsUpdate . I don't fully understand the world rendering code, but this appears to signal that the RenderChunk should be rebuilt from the current world data.
  17. You need to set the srcCompat and targetCompat properties in build.gradle like I do here.
  18. There's no reason to cast an object as you create it. Either refer to the inner class by its full name ( TileEntityBonfire.StackHandler ) or its own name ( StackHandler ), try to be consistent. As Animefan8888 said, you must have a solid understanding of Java and OO programming in general before you make a mod.
  19. You never create an instance of your StackHandler class and thus you never use it. It should probably be a static inner class, it shouldn't need to access the TileEntityBonfire . There's no reason to override a method if all you do in the override is call the super method. Your StackHandler#insertItem method breaks the contract of IItemHandler , i.e. that passing true as the simulate argument doesn't affect the contents of the inventory. ItemStackHandler#insertItem already checks for stack being null and stack.stackSize being 0, there's no reason to do this in your override. Your writeUpdateTag method still doesn't account for storedItem being null .
  20. Stop putting your posts inside quotes. I'm guessing your Block extended BlockContainer , which overrides Block#getRenderType to return EnumBlockRenderType.INVISIBLE (i.e. don't render the block). Instead of extending BlockContainer , extend Block and override Block#hasTileEntity and Block#createTileEntity .
  21. Create the ItemStack with metadata 0, then use the PotionUtils methods to set its NBT. The potion code itself doesn't care what the metadata is (all the effects are stored in NBT), but vanilla only registers the item models for metadata 0 (so other metadata values will be rendered as the missing model). Vanilla doesn't allow you to brew Strong Fire Resistance (because the amplifier doesn't do anything), so there's no PotionType for it. Vanilla doesn't allow you to brew a potion that's both Strong and Long, so there are no PotionType s for it. If you want to use an effect that doesn't have a PotionType registered for it, you can either create and register your own PotionType (using GameRegistry.register , like other IForgeRegistryEntry singletons) or add the PotionEffect directly to the potion ItemStack .
  22. Potion items don't use metadata any more, they use NBT. Standard, splash and lingering potions are now separate Item s that use the same NBT format. Tipped arrows also use this format for their effects. There is now the concept of a PotionType , which is a singleton collection of zero or more PotionEffect s (e.g. PotionTypes.LONG_FIRE_RESISTANCE , 8 minutes of Fire Resistance). Vanilla stores its PotionType s in the PotionTypes class and its Potion s in the MobEffects class. A potion item may have either zero or one PotionType as well as zero or more custom PotionEffect s. Use PotionUtils.addPotionToItemStack to set the PotionType of a potion ItemStack and PotionUtils.appendEffects to add custom PotionEffect s to a stack. Use PotionUtils.getEffectsFromStack to get all PotionEffect s from a potion ItemStack . This includes both the PotionType 's effects and the custom effects.
  23. The ItemArmor#armorType field contains the EntityEquipmentSlot of the armour item. Why are you getting the entity's position and then doing nothing with it? Why do you have if statements with true as their condition? Why do you have a whole lot of if statements with the same condition and one-line bodies instead of a single if statement with a multi-line body?

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.