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.

Robertof

Members
  • Joined

  • Last visited

  1. Sorry for the double post - but I fixed that: /** * A function which generates an EntityItem * from an ItemStack, given World and x, y, z coordinates. * @param wObj The world object where the entity will be spawned. * @param result The ItemStack to drop. It will be automatically copied. * @param x X coordinate * @param y Y coordinate * @param z Z coordinate * @author Robertof */ protected void genBlockDrop (World wObj, ItemStack result, int x, int y, int z) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { float var6 = 0.7F; double var7 = (double)(wObj.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; double var9 = (double)(wObj.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; double var11 = (double)(wObj.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; EntityItem ei = new EntityItem(wObj, (double)x + var7, (double)y + var9, (double)z + var11, new ItemStack (result.itemID, result.stackSize, result.getItemDamage())); if (result.hasTagCompound()) ei.item.setTagCompound((NBTTagCompound) result.getTagCompound().copy()); ei.delayBeforeCanPickup = 10; wObj.spawnEntityInWorld(ei); } } add that to onBlockStartBreak along with something to add damage to the tool used (if you want), then return true and you are good to go.
  2. Yep but as I said - I don't have the access to the original block (and I don't wanna edit the original classes). I just have the access to the tool. By the way I guess I should use a temporary block which drops what is in the metadata. Thanks anyways.
  3. Hello, I'm pretty new to Forge programming (but not to programming in general), and I need to ask a thing. I already tried to ask that in IRC but I got no response. Anyways, I have a class 'ItemMyPickaxe' which should replace some blocks when they break. However I didn't find anything to do this. I tried 2 different solutions: Using onBlockStartBreak() and then running playerEntity.worldObj.setBlock (blockX, blockY, blockZ, newblock) That would've work perfectly, but then I realized that I need to drop even items, not just blocks. So, nope. Then I tried again with onBlockStartBreak(), this time dropping the block manually using the code in Block.dropBlockAsItem_do(). But using that leads to 1) the drop entity not being placed correctly, for a reason unknown to me 2) the need to add the code in ItemInWorldManager.tryHarvestBlock(x,y,z). But that's too much, and also dangerous for future updates. Can anyone help me on this? (to make an example - a thing like Azanor's TC2 Pickaxe of the core is what I would need: it cooked the items on the fly and dropped them, but I still didn't understand how to do that) Thank you very much, Robertof

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.