Jump to content

Athire

Members
  • Posts

    62
  • Joined

  • Last visited

Everything posted by Athire

  1. Hello all! Sorry to bother you again so soon, but I've spent quite a while going through the debugger and I'm about out of ideas. I'm still trying to get a feel for how packets are done in 1.7, and one of them is giving me an issue. Whenever I try to log in to a world, the game crashes due to a null pointer, saying "Undefined message for descriminator 1 in propsChannel", which is the channel I use to sync my extended player properties. I believe it is in the packet class itself, because that was the last thing I canged before I got the issue. However the crash report cuts out before pointing me to a line of my code, so it's possible that when I fixed something in my packet class it allowed for a new error elsewhere. Thank you guys in advance. You are always incredibly helpful! Here is my packet class. handler: Registration: Here is the crash report: Thank you again, -Athire
  2. Hello all! I'm almost done updating my code from 1.6 to 1.7, but I'm coming across a srtange issue. I was trying to get a flower texture to load, but for some reason the standard SetBlockTextureName() wasn't working. I tried using Icons instead, and that caused the texture to load correctly. However when I go into the creative inventory and switch to a new tab, the game crashes due to a null pointer in BlockFlower.getSubBlocks(). When I comment out the registerIcons() function, the error goes away. Also, I realize that the way I've named my textures does not follow the current convention, I will be updating that as soon as my code works correctly in 1.7. Any help you guys could give me would be very much appreciated! Thank you in advance! P.S. the spoilers button seems to be broken, it's not a long file so I'll just paste it here. Sorry for any inconvenience. public class nightsbaneBlock extends BlockFlower { @SideOnly(Side.CLIENT) private IIcon NightsbaneTexture; public nightsbaneBlock() { super(1); //this.setBlockTextureName("innerpower:InnerPower_NightsbaneBlock"); this.setBlockName("InrPwrNightsbane"); } public Block idDropped(int metadata, Random random, int fortune) { return this; } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return this.NightsbaneTexture; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister reg) { this.NightsbaneTexture=reg.registerIcon("innerpower:InnerPower_Nightsbane"); } }
  3. Hello All! I recently updated my code from 1.6 to 1.7, which meant completely changing the way packets were sent. I finally got all of the errors fixed so I tried to run the client, got to the main screen, but crashed with "Ticking Memory Connection" when I tried to join a world. The error log pointed me to my "magicPlayer" file, which houses extended properties for my player class. I read up on the error and it said it had something to do with packets sending incorrectly. However I only ran the client, and the only packets sent in that file only send if !world.isRemote(), so I'm not sure how that can be the case. I also tried running both the client and server but there was no difference. here is the class in question: here is the packet class it uses: and here's the packet handler: error report: Thank you for any help you can give!
  4. Hello again! I finally have time to update my mod, but it appears how packets are being sent in 1.7 differs greatly from 1.6 I'm trying to use diesieben07's simpleNetworkWrapper tutorial but I'm getting a slight snag. I have an extended player class and I need to send packets to update their properties. I had this working in 1.6 by importing cpw.mods.fml.common.network.Player; to get the instance of the player who sent the packet, which I could then translate into my extended player class. However this package has been renamed or no longer exists. Can anyone tell me the new package name, or is there now a better way to do this with the SimpleNetworkWrapper? Thanks in advance!
  5. I'm having a similar issue, but only when I try to install NEI. Forge runs fine otherwise, but when I try to install NEI it causes this same launcher restart issue. Should I redownload vanilla as well and reinstall forge, or do I have a different issue? Thank you in advance!
  6. Hello! Forgive me if this isn't the right place to post this, it's my first time posting in this section. So i run a small forge 1.7.2 server with a few different mods- including Ic2, buildcraft, railcraft, weapons+ and the dalek mod. My friends and i just started this server, and everything seemed to be going well. All of the correct ores, trees, and mobs were spawning. However when I tried to craft anything from IC2, the recipes do not work. I've tried refined iron, iron furnaces, even tree taps. nothing seems to work. I went into creative mode and found that all of the railcraft things show up fine but none of the Ic2 or buildcraft things are there. I've tried reinstalling ic2, but nothing seemed to work. Has anyone had this isuue before? Any help would be much appreciated.
  7. I ended up solving this! My attempt at fixing this was almost right. I had forgotten to set the projectiles position clientside after sending the packet Thank you guys anyway! I'm marking this as solved
  8. The chat message sent in the packet handler appears by the way, so I know the packet is sending and being received ok! This is very odd, I can't find anything that works on the internet! D:
  9. Hey guys! Sorry to post on here so soon after my last question, but if I don't get this done in the next day or so I'm worried wont have time to work on it again for the next week or so, and I'm hoping it's a quick fix I have a few projectiles which render fine in a singleplayer world, but none of them render in a multiplayer environment. One of them is a vinilla entitySmallFireball, for which i get the fire effect but the actual projectile is not rendered. The entities still effect the world, which tells me they are being spawned on the server but not registered with the client. I tried using a packet to update the clients of all nearby players. I was trying to spawn the projectile on the client with the same motion information, to get it on the client side as well. The packet is being received correctly and I am reading the data from the input stream alright, but I still can't get the projectile to render. Doesn't the method sendPacketToAllAround send it to the player's clients? I read in a few places to get rid of the if(!world.isRemote) check, so I commented it out but I still can't get it to render. The prjectile extends entityThrowable. I will post the relevant code below! Here is the code for when my projectile "spirit bolt" gets fired: Here is the relevant part of the packet handler: Here is where I register the renderers, which work fine in singleplayer. The item is not actually right clicked to throw, so I created an item in my main mod class to use as the rendered texture. Thanks to anyone who can help me! I know I ask a lot of questions on here but I always learn much more from you guys than I do searching for vague issues like this. I have searched around for solutions but nothing has helped so far D: I'm probably doing something wrong in a simple place (like my last post, whoops that was embarrassing!) so hopefully this is a quick fix! Thank you guys again!
  10. Like LTLightning said, to check the value of world.isRemote you simply use an if statement. Is your question when it will be false? isRemote is true for the client side and false for the server side.
  11. Oh wow can't believe I missed that! That's coding 101! I'm a bit new to java but I've done a lot of C++, I really should have caught that! Thank you, it's always helpful to have an extra set of eyes!
  12. By the way I'm in 1.6.4! Sorry for not including that earlier
  13. hello guys! I've been struggling with this issue for the last few days. So I have a keybind which should be sending a packet to the server when the key is pressed ( for multiplayer compatibility). One issue is that it isn't sending when the key is pressed, but the main reason I am here is because whenever i send a packet on a different channel, my packet handler executes that channel's function as well as the keybinding packet's function. To be more specific, I have a few channels: "manaChannel" handles updates to the player's mana, "spellChannel" changes the player's active spell, and my new one "useAbility" is supposed to execute that ability when the key is pressed. If i send a packet on "manaChannel" or "spellChannel", my packet handler executes the function for both the received channel and my "useAbility" channel. I don't quite know how this can happen, not only do I use an if statement to check for the channel, but I changed it to an else-if block when this problem started. It still executes both! My first thought was that multiple packets were being received simultaneously, so I put a "system.out.println();" at the begining of my packet handler to report the channel of the received packet. I put similar statements in each else-if statement, as can be seen in my code. When I run the program and send a packet on one of the other channels, the system.out line prints that the correct channel is being received, and then it passes into the correct if statement AND the "useAbility" if statement. For example the console will print: Packet recieved on channel: spellchannel [sTDOUT] Packet recieved in changeActiveSpell [sTDOUT] Packet entered spellChannel block [sTDOUT] Packet entered useSpell block with channel: spellchannel 2014-03-17 16:05:22 [iNFO] [sTDOUT] Packet recieved in useSpell In this case, changeActiveSpell is the function which executes the code for spellchannel and useSpell is the function which should only execute for packets of the channel "useAbility". Here is the relevant code (on a side note I just figured out how to use spoilers. If they don't work and I end up posting a big chunk of code I apologize D: ) Here is the onPacketData portion of my packet handler Here is the keybinding where the packet should send but doesn't Here is where I declare the packet channels in my main mod class: Thank you in advance to anyone who can help me! I'm still a bit new to the whole packet handling thing but I think I'm getting the hang of them (all of the other channels seemed to work before this last one was created). This problem has just been so strange that I haven't been able to figure it out! Thank you guys again!
  14. Can I tag one more quick question on here? It has to do with the same code and I believe it's relevant to other people trying to do something similar to this. So I think what I have above is only updating the mob's motion client side, because the mob keeps teleporting back to it's original spot. I've heard that the method Minecraft.getMinecraft().objectMouseOver.entityHit; is client side only. I know how to do basic packet handling but I'm not sure how to get the entity from my packet handler. I tried using the above method again just in case it would work, but the entity keeps teleporting back. This makes sense because the method is still client side only! It there another method I can use which is not client side only? Or, if not, how can I get to the entity from my packet handler to update it's motion on the server?
  15. Ahh, thank you! So when I was checking if entityHit was null, I got a null Pointer exception because objectMouseOver itself was null. I added in a quick check for that and now it works Thanks a ton, you guys are always great here!
  16. Hello all! So I'm still working on my magic mod and I'm trying to add a knockback type spell. I'm using this method to get the entity the player is looking at: Minecraft.getMinecraft().objectMouseOver.entityHit; This seems to work ok when I aim at an entity, but if i miss the game crashes with a null pointer exception. I understand why the null pointer is happening, but I'm a bit stuck on how to get around it. I saw someone online use if(Minecraft.getMinecraft().objectMouseOver.entityHit != null) to make sure that entityHit isn't null, but the game seems to just crash at that line. The full code in question is: if(Minecraft.getMinecraft().objectMouseOver.entityHit != null){ //<--- Seems to crash here if(Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityLiving){ Entity target= Minecraft.getMinecraft().objectMouseOver.entityHit; Vec3 look= player.getLookVec(); ((EntityLiving)target).motionX=look.xCoord*2; ((EntityLiving)target).motionY=look.yCoord*2; ((EntityLiving)target).motionY=look.yCoord*2; } } Does anyone have any tips on how I can make the function return when entityHit is null? Or does anyone know a better way to do what I'm trying to do? Any help is much appreciated! Thank you in advance!
  17. Thank you! I'm in 1.6.4 by the way, I realize now I should have included that
  18. Hello again! I have a (hopefully) quick question. I have a few keybindings working well, but they are executing even when I type something into chat. Is there a method that I can call that will let me know whether or not the player has the chat window open? I've tried looking through the source code but couldn't find anything. I tried the getChatVisibility() method in EntityPlayerMP, but that returns an int and I couldn't determine what number it would be if chat is open! Thank you in advance!
  19. Ok, thank you! That's kind of what I thought was happening but it's good to get confirmation! And thanks again for those tutorials you put out, they've really helped me a lot! I'll get working on this tonight, thanks for the fast reply!
  20. Whoops! The method I meant to use was just "actionPerformed" not "onActionPerformed"! It now adds the chat message but it's not updating the variable, any ideas?
  21. Hello All! So I have a working gui and I'm trying to edit a player's extended entity property I have created when they press a button. Unfortunately the method doesn't take the player as a parameter. I tried using " this.mc.thePlayer" to get the player variable, but that doesn't seem to work. I thought that maybe the issue was that the server didn't recognize the change, because I know that GUIs are client side only. I have a working packet handler and I tried using that to send a packet to the server with the change, but it still doesn't work! I've been struggling with it for awhile now and decided to come here for some advice. Does anyone know a good way to access the player who opened the GUI? Or am I doing something wrong with my packet handling? I'm basically trying to change the variable "activeSpellID" in my magicPlayer class depending on what button is pressed (which right now there is only one). activeSpellID initializes to zero, and should change to 1 when I press this button, but it refuses to! Anyway, thanks in advance for the help! You guys are always really helpful whenever I come here! Here is my gui button method. There is a bit of an attempt to send a packet in there but I'm not very confident in it, as I havn't sent packets to the server before. public void onActionPerformed(GuiButton button) { ByteArrayOutputStream bos = new ByteArrayOutputStream(; DataOutputStream outputStream = new DataOutputStream(bos); magicPlayer props= magicPlayer.get(this.mc.thePlayer); this.mc.thePlayer.addChatMessage("This is the correct player"); //checking to see if this.mc.thePlayer is working, which it didn't switch(button.id) { case 0: { props.activeSpellID=1; } } Packet250CustomPayload packet = new Packet250CustomPayload("manachannel", bos.toByteArray()); PacketDispatcher.sendPacketToServer(packet); } Here is my packet handler in case you guys need it: public class manaPacketHandler implements IPacketHandler { public manaPacketHandler() {} @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { // This is a good place to parse through channels if you have multiple channels if (packet.channel.equals("manachannel")){ handleExtendedProperties(packet, player); } } private void handleExtendedProperties(Packet250CustomPayload packet, Player player) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); magicPlayer props = magicPlayer.get((EntityPlayer) player); // Everything we read here should match EXACTLY the order in which we wrote it // to the output stream in our ExtendedPlayer sync() method. try { props.setMaxMana(inputStream.readInt()); props.setCurrentMana(inputStream.readInt()); props.setActiveSpellID(inputStream.readInt()); } catch (IOException e) { e.printStackTrace(); return; } // Just so you can see in the console that it's working: System.out.println("[PACKET] Mana from packet: " + props.getCurrentMana() + "/" + props.getMaxMana()); System.out.println("[PACKET] Current Active Spell ID: "+props.activeSpellID); } } All I really need is access to the player variable, so if anyone has a good way to do that I would greatly appreciate the help!
  22. Thank you! That works perfectly! And also thank you so much for your extended properties tutorial, that's probably the main reason I was able to get my mana system off the ground! If I'm talking to the same coolAlias that is Thanks again, for this and your other resources which I have been using!
  23. Hello guys! Me again! So I'm having a weird issue and I can't find a solution anywhere on the interwebs, so I thought I'd ask it here. So I have an item that, when right clicked, shoots a small invisible projectile that calls down lightning when it hits the ground. It works perfectly at mid/long range, but when the projectile would hit something within 5 blocks, it breaks in the player model and calls down lightning on the player. I tried making the projectile spawn further in front of the player, but no luck. I at one point spawned it in 2 blocks in front of the player and it didn't make a difference. I was however able to find that the acceleration on the projectile is what's causing the issue. I usually set it's x/y/z motion to the players look vector * 5, to negate gravity drop. I found that when I lower it to 2 and below I no longer get this issue. But I don't want my projectile to be affected by gravity! So my question is this: How can I make my projectile not affected by gravity without increasing its x/y/z motion? Or is there a way to increase it's x/y/z motion speed without causing this issue? I'll post a bit of code below. here is the code in the item that sets the projectile's speed and angle: lightningProjectile lp= new lightningProjectile(par2World, par3EntityPlayer); Vec3 look = par3EntityPlayer.getLookVec(); lp.setPosition(par3EntityPlayer.posX + look.xCoord * par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posY + look.yCoord * par3EntityPlayer.getEyeHeight()+1, par3EntityPlayer.posZ + look.zCoord * par3EntityPlayer.getEyeHeight()); lp.motionX = look.xCoord * 2; lp.motionY = look.yCoord * 2; lp.motionZ = look.zCoord * 2; par2World.spawnEntityInWorld(lp); where "lightningProjectile" is my projectile that calls down lightning on impact. This is in an onItemRightClick() function. the lightningProjectile class doesn't really have much relevant code, it just spans a lightning bolt on impact. It's basicly a re-skinned snowball that spawns lightning. Anyway, thank you guys again for all of your help! Sorry if I ask a ton of questions on here, I'm just still pretty new at this
  24. By the way, I'm not sure how to mark this as solved D: Can anyone quickly tell me how to do that so I don't waste anyone's time?
×
×
  • Create New...

Important Information

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