-
Which function to override for block drops?
I'm pretty suree it's this: protected void dropBlockAsItem(World p_149642_1_, int p_149642_2_, int p_149642_3_, int p_149642_4_, ItemStack p_149642_5_) { It has a World, x, y, z, Itemstack. For help about that look at the Block class. EDIT: I'm sure that if you Override getItemDropped(int, Random, int) it will work but I'm not sure what are the parameters there.
-
QuickQuestion: Storing data about players.
I fixed my problem so I could get back into modding, I register it in EventHandler like this: package bulkyzanka.electro.mod.handler; import bulkyzanka.electro.mod.research.PlayerResearch; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.EntityEvent.EntityConstructing; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class ElectroEventHandler { @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { if(event.entity instanceof EntityPlayer && PlayerResearch.get((EntityPlayer) event.entity) == null) { PlayerResearch.register((EntityPlayer) event.entity); } if (event.entity instanceof EntityPlayer && event.entity.getExtendedProperties(PlayerResearch.EXT_PROP_NAME) == null) { event.entity.registerExtendedProperties(PlayerResearch.EXT_PROP_NAME, new PlayerResearch((EntityPlayer) event.entity)); } } } But for the player.registerExtendedEntityProperties(EXT_PROP_NAME,this); Where do I register that? I'm guessing it's in that class because of the "this". Should I put it in init? ABout the other little mistakes, I fixed them.
-
[1.7.2] Item that changes Block on right Click
Ohh, oops. I was a minute late... >.> diesieben07 posted while I was writing.
-
[1.7.2] Item that changes Block on right Click
Try this, Override onItemUse then get the block coordinates, check if it's null and set that block to something else.
-
QuickQuestion: Storing data about players.
I'm not sure if this is the right place to post this, sorry if it's not. It's just that it has something to do with this post. I was going to fix all that now but my Eclipse sort of messed up. Last time I saved my work and just closed it, this morning when I tired to run Eclipse, It was constantly giving a me an error. Something to do with the workspace not loading and my code didn't appear. I reinstalled Eclipse, the code was all there but I got a different error: eclipse.buildId=4.3.2.M20140221-1700 java.version=1.8.0 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pl_PL Framework arguments: -product org.eclipse.epp.package.standard.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product Error Sun May 25 12:10:22 BST 2014 Unable to find Action Set: org.eclipse.rse.core.search.searchActionSet eclipse.buildId=4.3.2.M20140221-1700 java.version=1.8.0 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pl_PL Framework arguments: -product org.eclipse.epp.package.standard.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product Error Sun May 25 12:10:22 BST 2014 Unable to find Action Set: org.eclipse.mylyn.tasks.ui.navigation eclipse.buildId=4.3.2.M20140221-1700 java.version=1.8.0 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pl_PL Framework arguments: -product org.eclipse.epp.package.standard.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product Error Sun May 25 12:10:22 BST 2014 Unable to find Action Set: org.eclipse.mylyn.doc.actionSet eclipse.buildId=4.3.2.M20140221-1700 java.version=1.8.0 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pl_PL Framework arguments: -product org.eclipse.epp.package.standard.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product Error Sun May 25 12:10:22 BST 2014 Unable to find Action Set: org.eclipse.mylyn.context.ui.actionSet When I try to do something like research and I try to put a dot there, nothing is appearing.
-
QuickQuestion: Storing data about players.
I read a little about it and I think I got it... Didn't test it yet because I don't have anything triggering it. Here is my code. I f I did anything wrong feel free to point it out. public class PlayerResearch implements IExtendedEntityProperties { public final static String EXT_PROP_NAME = "PlayerResearch"; private final EntityPlayer player; public int[] CurrentResearch = { 0, 0, 0, 0, 0}; public PlayerResearch(EntityPlayer player) { this.player = player; } public static final void register(EntityPlayer player) { player.registerExtendedProperties(PlayerResearch.EXT_PROP_NAME, new PlayerResearch(player)); } public static final PlayerResearch get(EntityPlayer player) { return (PlayerResearch)player.getExtendedProperties(EXT_PROP_NAME); } public void saveNBTData(NBTTagCompound nbt) { NBTTagCompound research = new NBTTagCompound(); research.setInteger("Research1", CurrentResearch[0]); research.setInteger("Research2", CurrentResearch[1]); research.setInteger("Research3", CurrentResearch[2]); research.setInteger("Research4", CurrentResearch[3]); research.setInteger("Research5", CurrentResearch[4]); System.out.print("Key Presses"); nbt.setTag(EXT_PROP_NAME, research); } public void loadNBTData(NBTTagCompound nbt) { NBTTagCompound research = (NBTTagCompound) nbt.getTag(EXT_PROP_NAME); CurrentResearch[0] = research.getInteger("Research1"); CurrentResearch[1] = research.getInteger("Research2"); CurrentResearch[2] = research.getInteger("Research3"); CurrentResearch[3] = research.getInteger("Research4"); CurrentResearch[4] = research.getInteger("Research5"); System.out.println(research.getInteger("Research1")); } public void init(Entity entity, World world) { } }
-
QuickQuestion: Storing data about players.
I wasn't how to do it so the player data is different for all the players, I don't want them to share the research.
-
QuickQuestion: Storing data about players.
Thanks for the fast answer. I'll try it and post the code I get for others.
-
QuickQuestion: Storing data about players.
I was wonder how to store some data about players. Stuff like research. I thought about NBT but it what I did didn't work so I scraped it. I also tried something involving IExtendedEntityProperties. I read about the fact you can use it with an entity but it totally failed. Then I did player.getEntityData() but same thing happened. I think the way to do it would be the NBT but I'm not sure how to store the completed research in every player individually. Thanks for any help.
-
Quick question about overriding methods
I found it but I wasn't sure will that do the job since it didn't have the parameters.
-
Quick question about overriding methods
But there is no method called updateTick so it won't get called in the tileentity
-
Quick question about overriding methods
I have a tile entity, I also custom render my block. So should I put that code in the tileentity class?
-
Quick question about overriding methods
It still doesn't work, it doesn't even do anything.
-
Quick question about overriding methods
Ok, so this is the code I used, and it didn't work. Nothing happend. public void updateTick(World world, int x, int y, int z, Random random) { EntityPlayer player = world.getClosestVulnerablePlayer(5, x, y, z); if(player != null) { System.out.println("gf"); } } Ohh yeah, sorry for posting this here but, when I log out and back in, my block isn't there.
-
Quick question about overriding methods
Thanks!
IPS spam blocked by CleanTalk.