Jump to content

Gadersd

Members
  • Posts

    18
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Gadersd's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I fixed the issue for single player by making a global variable that the integrated server can set directly, nullifying the need for packets. Now my SimpleNetworkWrapper isn't working on multiplayer. I set it up in my server's preInit method with net = NetworkRegistry.INSTANCE.newSimpleChannel("dataChannel"); net.registerMessage(PacketHandler.class, Packet.class, 0, Side.CLIENT); and send it with net.sendTo(new Packet(data), player); I tested this code on single player without the global variable and it worked, but on multiplayer the client doesn't receive the packet.
  2. I setup my SimpleNetworkWrapper in my preInit method of my base mode class. This works fine for dedicated servers and single player, but when my mods runs as a client in multiplayer, it crashes. How can I prevent my mod from setting up the SimpleNetworkWrapper when it is run as a client on multiplayer. I already tried Minecraft.getMinecraft.isSinglePlayer() to detect if my mod is running on an integrated server, but it always returns false.
  3. I just tested it and it runs fine on a dedicated server, but not on single player. Shouldn't server code run on single player since there is a local server?
  4. I come across another problem. Whenever I set one of my events to server only, the code doesn't run. When I set it back to both client and server, it runs. Why does everything have to go wrong? :'(
  5. Is health and position is handled on the server while jumping velocity is handled on the client?
  6. Never mind about the jump height only working on the server. It was my own flawed code causing that problem.
  7. I have noticed that I can decrease the amount of damage that a player takes on the client side. But, increasing a player's jump height only works if running on the server. Why is this and what different things should the client and the server handle? What should be run on both the client and the server?
  8. I am confused on the client and the server communications. Is all the data allocated on the server and the client? Is why I must send some data in packets or use the data watcher. Is the construction event server side only? That would explain why the client would need to have its data updated.
  9. After some testing I discovered the problem. The values for the client are reset when Minecraft starts and the values for the server are loaded. How can I fix these syncing issues? Should I use packets?
  10. No particular reason. I just use the same annotation for all my events to stay consistent.
  11. Here is my extendedEntityClass public class WerewolfData implements IExtendedEntityProperties { public static final String PROP_NAME="WerewolfData"; private final EntityPlayer player; private boolean isWerewolf=true; private boolean isInWerewolfForm=true; public WerewolfData(EntityPlayer player){ this.player = player; } public static final void register(EntityPlayer player){ player.registerExtendedProperties(PROP_NAME, new WerewolfData(player)); } public static final WerewolfData get(EntityPlayer player){ return (WerewolfData)player.getExtendedProperties(PROP_NAME); } @Override public void saveNBTData(NBTTagCompound compound) { NBTTagCompound properties=new NBTTagCompound(); properties.setBoolean("isWerewolf", isWerewolf); properties.setBoolean("isInWerewolfForm", isInWerewolfForm); compound.setTag(PROP_NAME, properties); System.out.println("has been saved"); } @Override public void loadNBTData(NBTTagCompound compound) { NBTTagCompound properties = (NBTTagCompound)compound.getTag(PROP_NAME); isWerewolf = properties.getBoolean("isWerewolf"); isInWerewolfForm = properties.getBoolean("isInWerewolfForm"); System.out.println("has been loaded"); } @Override public void init(Entity entity, World world) { // TODO Auto-generated method stub } public final void makeWerewolf(boolean input){ isWerewolf=input; } public final boolean isWerewolf(){ return isWerewolf; } public final void changeIntoWerewolfForm(boolean input){ isInWerewolfForm=input; } public final boolean isInWerewolfForm(){ return isInWerewolfForm; } } Here is my constructing event. @SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled=true) public void constructPlayers(EntityConstructing event){ if(event.entity instanceof EntityPlayer){ EntityPlayer player=(EntityPlayer)event.entity; WerewolfData.register((EntityPlayer)event.entity); System.out.println("fdafasfa"); } }
  12. I am following this tutorial http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and . My extendedEntity class never gets its loadNBTData method called and the data gets reset every time I exit Minecraft. How can I solve this?
  13. I finally got it working. All that needs to be done now is to increase the players damage. How can I check if the player is the source of damage in the LivingHurtEvent?
  14. I know java I just don't know which specific class I should use. I am new to Minecraft modding.
  15. Do I compare it with the EntityPlayer class or something else?
×
×
  • Create New...

Important Information

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