July 16, 201312 yr perhaps something like FMLServerHandler.instance().getServer().getConfigurationManager().playerEntityList.toArray()? (warning: not tested) mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
July 18, 201312 yr Author Ok, that gave me the list, but now that I have the list I'm not sure it's what I want. I'm using my server tick handler to check if a player has a flight buff and then do some calculations and then change the motionY player variable. What I had was this private void onWorldTick(World world) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; Which worked fine in a single player world, but on lan only the player that started the game got the buff. I then tried this private void onWorldTick(World world) { List<EntityPlayer> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList; for(int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); But that seems like that makes the player a read-only variable. I can read the username, but that's pretty much it. I can't change the motionY or add velocity which doesn't make sense to me because it's the same EntityPlayer. Also in a server situation with hundreds of players would it be smart to have a for loop checking every player every tick. If not then what is the best way?
July 18, 201312 yr use a server tick handler instead, itll ball the method in the handler for every player without having to deal with the list how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 18, 201312 yr Author use a server tick handler instead, itll ball the method in the handler for every player without having to deal with the list if (type.equals(EnumSet.of(TickType.SERVER))) vs. if (type.equals(EnumSet.of(TickType.WORLD)))?
July 18, 201312 yr //hides package com.hydroflame.mod; import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayerMP; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class ServerPlayerTickHandler implements ITickHandler{ @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { // TODO Auto-generated method stub } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { EntityPlayerMP player = (EntityPlayerMP) tickData[0] //do stuff with the player } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER); } @Override public String getLabel() { return null; } } //hidee how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 19, 201312 yr Author That doesn't work either, it just makes a bunch of weird client-server mismatches.
July 19, 201312 yr no thsi method is working its what im using for my mod. can you explain what are the mismatch/bugs ? how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.