本文整理匯總了Java中net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerEvent.PlayerLoggedInEvent方法的具體用法?Java PlayerEvent.PlayerLoggedInEvent怎麽用?Java PlayerEvent.PlayerLoggedInEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.fml.common.gameevent.PlayerEvent
的用法示例。
在下文中一共展示了PlayerEvent.PlayerLoggedInEvent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerLoggedIn
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
{
PlayerInformation playerInfo = (PlayerInformation) event.player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
Stats statsCap = (Stats) event.player.getCapability(CapabilityPlayerStats.STATS, null);
if (playerInfo != null && playerInfo.getPlayerClass() == 0 && statsCap != null && statsCap.getMaxMana() == 0)
{
// send Class Selection gui to client on first join.
LootSlashConquer.network.sendTo(new PacketClassGui(), (EntityPlayerMP) event.player);
// setup max mana + send it to client.
statsCap.setMaxMana(100);
statsCap.setMana(statsCap.getMaxMana());
statsCap.setManaPerSecond(5);
statsCap.setHealthPerSecond(1);
LootSlashConquer.network.sendTo(new PacketUpdateStats(statsCap), (EntityPlayerMP) event.player);
}
else if (playerInfo != null && playerInfo.getPlayerClass() > 0)
LootSlashConquer.network.sendTo(new PacketUpdatePlayerInformation(playerInfo), (EntityPlayerMP) event.player);
}
示例2: onPlayerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event){
if(DifficultyManager.enabled && ProgressiveDifficulty.oldConfigExists){
TextComponentString linkComponent = new TextComponentString("[Progressive Difficulty Wiki]");
ITextComponent[] chats = new ITextComponent[]{
new TextComponentString("[ProgressiveDifficulty] It looks like you have a version 1.0 " +
"config file. Please check out the Progressive Difficulty Wiki for instructions on how" +
" to migrate to a version 2.0 config file."),
linkComponent
};
ClickEvent goLinkEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,"https://github.com/talandar/ProgressiveDifficulty/wiki/2.0-Transition");
linkComponent.getStyle().setClickEvent(goLinkEvent);
linkComponent.getStyle().setColor(TextFormatting.BLUE);
linkComponent.getStyle().setUnderlined(true);
ChatUtil.sendChat(event.player,chats);
}
}
示例3: playerJoin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerJoin(PlayerEvent.PlayerLoggedInEvent event) {
ItemStack guideBookStack = new ItemStack(Items.WRITTEN_BOOK, 1);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("title", new TextComponentTranslation("book.title.guide").getFormattedText());
nbt.setString("author", new TextComponentTranslation("book.author.guide").getFormattedText());
nbt.setInteger("generation", 2);
NBTTagList nbtList = new NBTTagList();
for (int index = 0; index <= 15; index++)
nbtList.appendTag(new NBTTagString(String.format("{\"text\": \"%s\"}", new TextComponentTranslation(String.format("book.pages.guide.%d", index)).getFormattedText())));
nbt.setTag("pages", nbtList);
guideBookStack.setTagCompound(nbt);
if (!event.player.getEntityData().getBoolean("genera.joined_before")) {
event.player.getEntityData().setBoolean("genera.joined_before", true);
event.player.getEntityData().setInteger("genera.sacrifices_made", 0);
event.player.addItemStackToInventory(guideBookStack);
}
}
示例4: onLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
if (FMLCommonHandler.instance().getMinecraftServerInstance() != null)
if (event.player instanceof EntityPlayerMP) {
Overlord.logDebug("Sending " + event.player.getName() + " client their squads.");
PacketDispatcher.sendTo(new SetSquadsMessage(Squads.getInstance().getSquadsFor(event.player.getUniqueID())), (EntityPlayerMP) event.player);
if (ConfigValues.TEAMHACK) {
ScorePlayerTeam team = event.player.getEntityWorld().getScoreboard().getTeam(event.player.getName());
//noinspection ConstantConditions
if (team == null) {
team = event.player.getEntityWorld().getScoreboard().createTeam(event.player.getName());
team.setColor(TextFormatting.values()[teamColor++ % 15]);
}
event.player.getEntityWorld().getScoreboard().addPlayerToTeam(event.player.getName(), team.getName());
}
}
}
示例5: onPlayerLoggedInEvent
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent e)
{
if(!e.player.world.isRemote)
{
SavedData data = SavedData.get(e.player.world);
if(data != null)
{
ChunkLoaders cl = data.getChunkLoaders();
cl.updateLoginTimestamp(e.player.getUniqueID().toString(), System.currentTimeMillis());
data.setChunkLoaders(cl);
// Enable all of the chunk loaders this player owns
for(ChunkLoaderPos loaderPos : cl.getLoaders())
{
ChunkLoaderTileEntity te = (ChunkLoaderTileEntity)e.player.world.getTileEntity(loaderPos.pos);
if(te != null)
{
te.enable();
}
}
}
}
}
示例6: onPlayerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent e) {
if (MCFlux.UPDATE_CHECK_FINISHED && !MCFlux.NEWER_VERSION.isEmpty() && e.player instanceof EntityPlayerMP)
MCFluxNetwork.to(Msg.newVersion(MCFlux.NEWER_VERSION), (EntityPlayerMP) e.player);
if (SpecialEventHandler.getEventStatus() == SpecialEventHandler.EventStatus.DOWNLOADED) {
final SpecialEventReceiver ser = e.player.getCapability(SpecialEventReceiver.SELF_CAP, null);
if (ser != null) {
final int[] seids = SpecialEventHandler.getEventIDs();
for (int l : seids) {
if (ser.alreadyReceived(l))
continue;
final ItemStack is = new ItemStack(MCFluxResources.SPECIAL);
is.setTagInfo("seid", new NBTTagInt(l));
e.player.dropItem(is, false, true);
ser.addReceived(l);
}
}
}
}
示例7: onJoin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onJoin(PlayerEvent.PlayerLoggedInEvent e) {
if (e.player.getCapability(FTJFactoryProvider.FTJ_CAPABILITY, null).getFTJ()) {
ISkillsCapability skills = e.player.getCapability(SkillsFactoryProvider.SKILLS_CAPABILITY, null);
ILevelCapability lvl = e.player.getCapability(LEVEL_CAPABILITY, null);
ISpechialCapability spe = e.player.getCapability(SpechialFactoryProvider.SPECHIAL_CAPABILITY, null);
Item lvliningCrystal = ItemInit.lvlingCrystall;
ItemStack lvlingcrystallS = new ItemStack(lvliningCrystal);
lvlingcrystallS.setCount(1);
e.player.inventory.addItemStackToInventory(lvlingcrystallS);
e.player.getCapability(WaterFactoryProvider.WATER_CAPABILITY, null).setWater(100);
lvl.initNewplayer();
skills.setAll(10);
spe.setAll(0);
e.player.getCapability(FTJFactoryProvider.FTJ_CAPABILITY, null).setFTJ(false);
}
e.player.getCapability(IAdvProvider.Adv_Inv, null).updateClient(e.player);
updatePlayerSpechial(e.player);
updatePlayerSkills(e.player);
updatePlayerLevel(e.player);
}
示例8: playerLoggedIn
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
{
// Give the first achievement, because it is stupid and nobody cares.
// If you're using this mod, you've probably opened your inventory before anyways.
StatUtil.IFzStat stat = StatUtil.load(event.player, AchievementList.openInventory);
if (stat.get() <= 0 && FMLCommonHandler.instance().getSide() == Side.CLIENT) {
stat.set(-1);
stat.set(300); // Literally, hundreds of times! :D
Core.logInfo("Achievement Get! %s, you've opened your inventory hundreds of times already! Yes! You're welcome!", event.player.getName());
// NORELEASE: Verify this works.
}
}
{
MinecraftServer ms = MinecraftServer.getServer();
if (ms != null && ms.getTickCounter() >= ms.tickTimeArray.length) {
//Startup time is ignored; early birds will get a TPS packet soon enough
MiscNet.channel.sendTo(MiscNet.makeTpsReportPacket(getTpsRatio()), (EntityPlayerMP) event.player);
}
}
fixReachDistance((EntityPlayerMP)event.player);
}
示例9: onPlayerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
NBTTagCompound tag = EntityHelper.getPlayerPersistentData(event.player, "GuiltTripSave");
int size = tag.getInteger("size");
for(int i = 0; i < size; i++)
{
ArrayList<KillInfo> kills = GuiltTrip.eventHandlerServer.playerKills.get(event.player.getName());
if(kills == null)
{
kills = new ArrayList<>();
GuiltTrip.eventHandlerServer.playerKills.put(event.player.getName(), kills);
}
kills.add(KillInfo.createKillInfoFromTag(tag.getCompoundTag("kill_" + i)));
}
GuiltTrip.eventHandlerServer.updatePlayersOnKill(event.player.getName(), null);
GuiltTrip.eventHandlerServer.updatePlayersOnKill(null, event.player.getName());
}
示例10: PlayerLoggedInEvent
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void PlayerLoggedInEvent(PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
recalcTeams();
WarsMod.proxy.genTag(event.player);
int totalKills = event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getInteger("warsmod_totalKill");
int killStreak = event.player.getEntityData().getInteger("warsmod_killstreak");
int deaths = event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getInteger("warsmod_deaths");
PacketDispatcher.sendTo(new PacketKills(totalKills, killStreak, deaths), (EntityPlayerMP) event.player);
PacketDispatcher.sendTo(new PacketTeams(redPlayers, greenPlayers, bluePlayers, yellowPlayers), (EntityPlayerMP) event.player);
WarsSavedData savedWarsData = WarsSavedData.get(event.player.worldObj);
ItemStack playerBoots = event.player.inventory.getStackInSlot(36);// playerMP.inventory.armorItemInSlot(0);
if (playerBoots == null) {
if (!savedWarsData.editMode.editModeToggle) {
scheduleDelayedGui((EntityPlayerMP) event.player);
}
}
}
}
示例11: playerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event){
if(event.player instanceof EntityPlayer && (event.player).getDisplayName().equals("Harry9137") || (event.player).getDisplayName().equals("helloneibghor")){
EntityWings wings = new EntityWings(event.player.getEntityWorld(), event.player);
wings.setPosition(event.player.posX, event.player.posY, event.player.posZ);
event.player.getEntityWorld().spawnEntityInWorld(wings);
}
if(event.player.getDisplayName().equals("Harry9137") && event.player instanceof EntityPlayer){
((EntityPlayer) event.player).capabilities.allowFlying = true;
}
else if(event.player.getDisplayName().equals("helloneibghor") && event.player instanceof EntityPlayer){
((EntityPlayer)event.player).capabilities.allowFlying = true;
}
CreepTech.console.addText(event.player.getDisplayNameString());
}
示例12: onPlayerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
//This will send config data from the server to the client
try
{
for (Field field : Settings.class.getDeclaredFields())
{
Object val = field.get(null);
if (val.getClass().isArray() && !Arrays.asList(blacklistedSettingsFields).contains(field.getName()))
{
sendConfigInfo(field.getName(), val, (EntityPlayerMP) event.player);
}
}
}
catch (ReflectiveOperationException e)
{
e.printStackTrace();
}
}
示例13: onPlayerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
if(event.player instanceof EntityPlayerMP)
{
ServerConfigMessage msg = new ServerConfigMessage();
msg.recipeVillagerSlabsIsRecovery = CommonProxy.recipeVillagerSlabsIsRecovery;
SimpleNetworkWrapper netwrapper = CubicVillager.getProxy().simpleNetWrapper;
netwrapper.sendTo(msg, (EntityPlayerMP)event.player);
StringBuilder spawnedMessage = new StringBuilder(64);
spawnedMessage.append("プレイヤー ")
.append(((EntityPlayerMP)event.player).getName())
.append(" がワールドに參加しました。設定を送信しました。");
CubicVillager.LOG.info(spawnedMessage);
}
}
示例14: onPlayerJoin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) {
BrewStorageHandler.getBrewStorage(event.player).ifPresent(data -> {
if (event.player instanceof EntityPlayerMP) {
data.syncToNear(event.player);
}
});
}
示例15: onPlayerLogin
import net.minecraftforge.fml.common.gameevent.PlayerEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
if(event.player instanceof EntityPlayerMP) {
NBTTagCompound data = event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
IHardcoreRevival revival = event.player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null);
if(revival != null) {
CapabilityHardcoreRevival.REVIVAL_CAPABILITY.readNBT(revival, null, data.getCompoundTag("HardcoreRevival"));
}
NetworkHandler.instance.sendTo(new MessageDeathTime(revival != null ? revival.getDeathTime() : 0), (EntityPlayerMP) event.player);
if(revival != null && revival.getDeathTime() >= ModConfig.maxDeathTicks) {
NetworkHandler.instance.sendTo(new MessageDie(), (EntityPlayerMP) event.player);
}
}
}