Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Briggybros

Members
  • Content Count

    155
  • Joined

  • Last visited

Community Reputation

-1 Poor

About Briggybros

  • Rank
    Creeper Killer

Converted

  • Gender
    Male
  • URL
    http://www.toomuchminecraft.com
  • Location
    Wales, UK
  • Personal Text
    I am new! <-- Not so much..

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, I'm trying to find a way to neatly get the player which sent a packet using IMessageHandler. This only allows me to retrieve the data in the message the side and the net handler. What would be the best way to see who sent the packet? Currently I am including the player's entityid in the packet. However, I really dislike this because it will break if there is more than just the default world. So to counter that I could send the world id the player is in also, and this would work. I find that method messy and overly complicated, is there a better way which I have missed?
  2. Thank you, setting the return to null as the javadoc indicated fixed the issue. How does it show that the packets are registered incorrectly?
  3. But if handleKey were being called multiple times then there would be "[14:46:47] [Client thread/INFO] [sTDOUT]: [com.laszloslads.micity.common.KeyHandler:handleKey:16]: Client: Sending key packet" printed to console for every time it is called, which there isn't.
  4. Here: public class KeyBindings { KeyHandler keyHandler; public static KeyBinding[] bindings = { new KeyBinding("key.overview", Keyboard.KEY_O, "key.categories.micity") }; public KeyBindings(KeyHandler keyHandler) { this.keyHandler = keyHandler; for(KeyBinding binding : bindings) { ClientRegistry.registerKeyBinding(binding); } FMLCommonHandler.instance().bus().register(this); } @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { for(KeyBinding binding : bindings) { i
  5. I have just started working with Minecraft forge again and I'm trying to set up my mod, however, when sending a packet it gets received repeatedly. I used the CatDany example for reference. This method gets called on a key press: public void handleKey(EntityPlayer player, int keyId) { if(player instanceof EntityClientPlayerMP) { System.out.println("Client: Sending key packet"); IMessage msg = new KeyPacket.KeyMessage(player.getEntityId(), keyId); PacketHandler.net.sendToServer(msg); } } Which is handled by this packet class: package com.laszloslads.micity.common.packet
  6. Hey, I was wondering what's the best way to keep a custom 'tracker' in sync between the client and server. I have this class: public class ObjectRegistry { static HashMap<EntityPlayer, MyObject> map = new HashMap<EntityPlayer, MyObject>(); public static MyObject createNewObject(EntityPlayer entityPlayer) { MyObject t = new MyObject(entityPlayer); map.put(entityPlayer, t); return t; } public static MyObject getPlayerObject(EntityPlayer player) { return map.get(player); } } And here is the MyObject class: package mods.ages.civilization; import net.minecraft.ent
  7. Yes, I was looking into that tag, I don't know how to use it though..
  8. Right, I've got this set up to check if it's the player's first time: package mods.ages.player; import java.util.Random; import mods.ages.entity.EntityCivilian; import mods.ages.util.NameGenerator; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import cpw.mods.fml.common.IPlayerTracker; public class PlayerTracker implements IPlayerTracker { PlayerHandler ph; public PlayerTracker(PlayerHandler ph) { this.ph = ph; } @Override public void onPlayerLogin(EntityPlayer player) { if (PlayerH
  9. Hello, I know it's possible to set a custom NBT tag using IExtendedEntityProperties to persist through respawn etc. How would this be achieved? Actually setting the tag to be persistent instead of resetting on death..
  10. Okay, thanks EDIT: So to convert from a ResorceLocation to an InputStream, this should work: InputStream stream = Ages.class.getResourceAsStream("/assets/" + resource.func_110624_b() + "/" + resource.func_110623_a());
  11. Hello, in my mod I'm using a custom file type which I want to load into java. I have all of the loading methods set up, etc. However, I've got it set to load from a File object, so I can set up input streams. I thought, since the file's classified as an asset that I should use Minecraft's built in ResourceLocation class. Yet, using the ResourceLocation, I cannot seem to find a way to get the file object that the resource location's pointing to. How can I do this?
  12. That's exactly what I've done with IExtendedEntityProperties, thanks for the input guys
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.