Jump to content

Cyan

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by Cyan

  1. Ah! But I do have a packet handler. Granted, I am willing to admit that I probably am not using it right. Okay, fine, I'm not entirely sure at all what I am doing when it comes to the packet handler. I'm going to assume the packet function goes something along the lines of try { if () {} } I suppose I am puzzled somewhat on what to add to the if condition. Edit: Actually, here is just my whole packet handler. import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.Player; public class ModPacketHandler implements IPacketHandler { @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { if (packet.channel.equals("TestMod")) { handlePacket(packet); } } public void handlePacket(Packet250CustomPayload packet){ DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); int randomInt1; int randomInt2; try { if () { } }catch(IOException e){ e.printStackTrace(); return; } } }
  2. Hi, So like the topic says, I seem to be having trouble making my GUI stay updated when I want to give my entity a new name. I have the standard keyTyped function for imputing the characters in the GUI, and I have a datawatcher keeping track of the nickname that results from it. While in the game, it works fine, but the second I log out it reverts back to the regular name, rather than saving the nickname. I figure this is a problem with the client and server not communicating, but I am unsure of why it is happening, and I would be greatly appreciative for some advice. If this isn't enough information to go on, someone chew me out for it and I'll post up the code as well
  3. Darn. I was afraid of that. Thanks. Will also look into the GenLayer file. Hadn't looked there. Thanks for the replies. Now only for that tricky music disk question
  4. So other than the cheesy title, I would like to ask a three part question on some things I am having trouble with. Timers: Are they done differently since the client/server merge? For an example, I have a timer that sets eggs to hatch after so many ticks. I figured it would be fine since it is saved as an NBT, but sadly that was not the case. Would this be a good time to invest in a datawatcher, or is there perhaps another problem that I could be having? The code is just a simple bit in onUpdate() public void onUpdate() { hatchTime++; if(hatchTime>= 80) hatch(); super.onUpdate(); } Biomes is more of a general question. I was looking through the code to see if I could find how mushroom islands were generated, but couldn't quite find it in any of the biome files. Is there a special way to make a biome that is not connected to the mainland? And if islands are possible, would floating biomes and underground biomes also be plausible using the same logic? Music Disks I would just like to see if there are some general pointers on. I remember reading that Forge has a way to implement music files, and I was just looking for more information on how to do that. Also, do .mp3s work, or is there a special format?
  5. So I have a GUI button that is set up to exchange so many player levels for an item, and this item is dropped in the world infront of the player. Hwwever, when the item is dropped, it is unpickup-able, almost as if it were only on the client side. Is this the case? Is there a particular check I can use to make it spawn server side? Or is this a job for a packethandler?
  6. So, after a few more attempts at using datawatchers, I finally figured out I was doing them wrong. So after doing some searching and reading through some other posts, I have come to somewhat understand datawatchers. There are three main portions to using a datawatcher: addObject, which establishes want you are wanting watched obviously. getWatchableObject, that instructs it as to where to start watching. updateObject, which updates what is being watched. Now is where my flood of questions come in. The first question goes back to the addObject. dataWatcher.addObject(2, ""); The 2,"" would be the int and the object, correct? I was told that Minecraft already uses 0,1,and 8. So if this is true, all other ints from 2 to 31 should be usable for anything I need watched, correct? Also, is it possible for booleans to be watched? Bonus points: In case anyone is feeling extremely helpful. Here is my tame code that I have put up in so many other posts These are the things that need saving, and therefore need datawatchers. These stats are only used once the entity is tamed though. So should I be sticking the updateObject into the tame function? Last question for now: Will I be needing a separate datawatcher for each of these? I would assume so, but figured I would ask if there is a way to have one datawatcher be watching all of them at once. Thanks for any help you may be able to provide!
  7. So...I am back to update this topic as I am still having the same issue. I've tried using both the datawatchers and making a custom packet handler to work with the tame function, and have still come up with nothing. A solution to this would be greatly appreciated
  8. I may need more explanation than that. I was under the impression that implementing IAnimals would send the packets to and from the server?
  9. I have registered them with registerModEntity, registerGlobalEntityID, and even both at the same time to no avail. Edit: I have found the issue. The tamed digimon is only being saved client side, and not server side. Now if only I could figure out how to save it server side.
  10. I thought you might have been on to something, but unfortunately I get the same problem I updated my isTamed() and setTamed() functions with the info from EntityTameable, but it still resulted with the digimon not saving. I'm thinking that the newDigimon() function is overriding the tame() function still. I think I need a way to save the info from my tame() function to the server so that when the game starts, the newDigimon() does not override the tame() Is this even possible to do without an outside file? I figure I could save the entities to a file and have them reloaded into the game everytime someone loads a world up, but that complicates the purpose of the function a little too much. Edit: Okay. So experimenting with this a little more, the entity itself does save. But moving out of range/logging out resets the tame function. So I guess what I am asking is how I can make the tame() function stay in effect after I have logged out.
  11. Bumpdate. Still having trouble with this. I'd settle for even an educated guess at what the problem might be.
  12. Post has been edited incase anyone has looked at it before now 12/27/12! It appears that when my tame function is thrown into action, that it is only saving the information to the client side. This causes all of the information not to save server side, thus not making a server side tamed digimon at all. I'm looking for a way to make all the info save both client side and server side. In case thats not enough to go on(and its probably not), Below is my entire entity file. Please just ignore all the things that have been commented out or otherwise look like they don't do anything. They are being reworked.
  13. Hello again, So..... I'm back again unfortunately having to ask for more help converting over to Forge. This time however, it is with my interact! I have noticed that I get either "ticking entity" errors or a NullPointerException error when anything calls the interact function. More specifically, when I right click on my entities. Most of the items in the interact function either tames the entities, or swaps them with a different entity(evolving). So..My logical guess is that something on the server side is not compatible with my code, but I do not have enough knowledge to really know what exactly that might be. Here's my interact code: Thanks for any insight you may be able to provide!
  14. Ahhh. That seems to be working much better. Thank you very much for your help!
  15. I feel bad for making my first post a "help me I can't forge!" topic, but it is unfortunately what I have to do. So for those who may not know me, I run the digimobs mod and I have been having some trouble converting my mod from modloader to Forge. It may be because I am simply an idiot, but I see to be having trouble either registering my entities, or spawning them. They just don't appear period. Since my mod is so entity heavy, I have cut out a large portion so you all don't have to scroll through basically the same thing over and over. My code is in the spoilers, since it makes the page really wide with the code. Thanks to anyone who may be able to point out my mistakes!
×
×
  • Create New...

Important Information

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