BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryTickHandler.java
2014-01-17 14:12:49 -05:00

51 lines
1.4 KiB
Java

package WayofTime.alchemicalWizardry.common;
import java.util.EnumSet;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.TickType;
public class AlchemicalWizardryTickHandler implements ITickHandler
{
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
}
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.PLAYER);
}
public String getLabel()
{
return "BloodMagic";
}
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
String[] usernames = MinecraftServer.getServer().getAllUsernames();
if (usernames == null)
{
return;
}
for (String userName : usernames)
{
EntityPlayer entityPlayer = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(userName);
if (entityPlayer != null)
{
ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, entityPlayer.capabilities, Float.valueOf(0.1f), new String[] { "walkSpeed", "g", "field_75097_g" });
//entityPlayer.sendPlayerAbilities();
}
}
}
}