Posted June 29, 201510 yr Hi, I made a block which uses a TileEntity, and depending on it's state (which can be found out by looking at the tileEntity) it should drop a different amount of blocks when destroyed. However, since the "quantityDropped" method doesn't have anything to access the world, to scan the tileEntity, I have no idea how to change this amount. Since I cannot store anything in the block via variables, I have to access the tileEntity. Any suggestions? Thanks in advance, Reygok My first Mod: http://www.curse.com/mc-mods/minecraft/231302-adamantium-mod-better-than-diamonds#
June 29, 201510 yr There are actually three different versions of quantityDropped that take different parameters. One of them is: public int quantityDropped(IBlockState state, int fortune, Random random) Check out my tutorials here: http://jabelarminecraft.blogspot.com/
June 29, 201510 yr Author Oh god, I'm so blind, I didn't find the third one... Thanks My first Mod: http://www.curse.com/mc-mods/minecraft/231302-adamantium-mod-better-than-diamonds#
June 30, 201510 yr Author Hm wait, I have no idea how to access the TileEntity when I only have the state... My first Mod: http://www.curse.com/mc-mods/minecraft/231302-adamantium-mod-better-than-diamonds#
June 30, 201510 yr Why do you want to access your TE if you want to make the drops depending on the state?
June 30, 201510 yr Author Because it is way easier to save the information I need in the TileEntity, than to check the 255 possible states I realized that just now, will reformulate the title and first post now. My first Mod: http://www.curse.com/mc-mods/minecraft/231302-adamantium-mod-better-than-diamonds#
June 30, 201510 yr Override the getDrops() method, it givs you full control over the drops and gains you access the the World and the BlockPos. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
June 30, 201510 yr Author The problem there seems to be that when this method is called, the tileEntity at that blockPos is already gone, since it gives ame a Nullpointerexception here: TileEntityTinyBlock tileEntity = (TileEntityTinyBlock) worldIn.getTileEntity(pos); int count = tileEntity.count(); <---- THERE My first Mod: http://www.curse.com/mc-mods/minecraft/231302-adamantium-mod-better-than-diamonds#
July 2, 201510 yr Author Awesome, thanks, it works now My first Mod: http://www.curse.com/mc-mods/minecraft/231302-adamantium-mod-better-than-diamonds#
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.