本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getTeam方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getTeam方法的具体用法?Java EntityPlayer.getTeam怎么用?Java EntityPlayer.getTeam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getTeam方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMessageToAllTeamMembers
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
Team team = player.getTeam();
if (team != null)
{
for (String s : team.getMembershipCollection())
{
EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);
if (entityplayermp != null && entityplayermp != player)
{
entityplayermp.addChatMessage(message);
}
}
}
}
示例2: sendMessageToTeamOrEvryPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message)
{
Team team = player.getTeam();
if (team == null)
{
this.sendChatMsg(message);
}
else
{
for (int i = 0; i < this.playerEntityList.size(); ++i)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);
if (entityplayermp.getTeam() != team)
{
entityplayermp.addChatMessage(message);
}
}
}
}
示例3: sendMessageToAllTeamMembers
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void sendMessageToAllTeamMembers(EntityPlayer player, ITextComponent message)
{
Team team = player.getTeam();
if (team != null)
{
for (String s : team.getMembershipCollection())
{
EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);
if (entityplayermp != null && entityplayermp != player)
{
entityplayermp.addChatMessage(message);
}
}
}
}
示例4: sendMessageToTeamOrAllPlayers
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void sendMessageToTeamOrAllPlayers(EntityPlayer player, ITextComponent message)
{
Team team = player.getTeam();
if (team == null)
{
this.sendChatMsg(message);
}
else
{
for (int i = 0; i < this.playerEntityList.size(); ++i)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i);
if (entityplayermp.getTeam() != team)
{
entityplayermp.addChatMessage(message);
}
}
}
}
示例5: processInteract
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (!(player.getHeldItemMainhand() != null
&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
&& (this.getOwner() == player || this.getAttackTarget() == null || this.friendly) && this.isEntityAlive() && !this.isTrading()
&& !this.isChild() && !player.isSneaking()) {
if (this.world.isRemote && player.getTeam() == null
&& ((this.getCapability(TF2weapons.WEAPONS_CAP, null).state & 1) == 0 || this.friendly)
&& !player.isCreative())
ClientProxy.displayScreenConfirm("Choose a team to interact",
"Visit the Mann Co. Store located in a village");
if (!this.world.isRemote && (TF2Util.isOnSameTeam(this, player) || player.isCreative())
&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
this.setCustomer(player);
FMLNetworkHandler.openGui(player, TF2weapons.instance, 4, world, this.getEntityId(), 0, 0);
}
player.addStat(StatList.TALKED_TO_VILLAGER);
return true;
} else
return super.processInteract(player, hand);
}
示例6: processInteract
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (!(player.getHeldItemMainhand() != null
&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
&& this.getAttackTarget() == null && this.isEntityAlive() && !this.isTrading() && !this.isChild()
&& !player.isSneaking()) {
if (this.world.isRemote && player.getTeam() == null && !player.isCreative())
ClientProxy.displayScreenJoinTeam();
else if (!this.world.isRemote && (player.getTeam() != null || player.isCreative())
&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
this.setCustomer(player);
player.displayVillagerTradeGui(this);
}
player.addStat(StatList.TALKED_TO_VILLAGER);
return true;
} else
return super.processInteract(player, hand);
}
示例7: isInvisibleToPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Only used by renderer in EntityLivingBase subclasses.
* Determines if an entity is visible or not to a specfic player, if the entity is normally invisible.
* For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent.
*/
public boolean isInvisibleToPlayer(EntityPlayer player)
{
if (player.isSpectator())
{
return false;
}
else
{
Team team = this.getTeam();
return team != null && player != null && player.getTeam() == team && team.getSeeFriendlyInvisiblesEnabled() ? false : this.isInvisible();
}
}
示例8: getReplacement
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static ItemStack getReplacement(EntityPlayer player, ItemStack stack) {
if (!stack.isEmpty() && stack.getItem() instanceof ItemBuildingBox
&& player.getTeam() == player.world.getScoreboard().getTeam("BLU"))
stack.setItemDamage(stack.getItemDamage() + 1);
if (!stack.isEmpty() && stack.getItem() instanceof ItemBanner){
NBTTagCompound pattern=new NBTTagCompound();
if(player.getTeam() == player.world.getScoreboard().getTeam("BLU")){
stack.setItemDamage(EnumDyeColor.BLUE.getDyeDamage());
pattern.setString("Pattern", "bb");
pattern.setInteger("Color", 15);
}
else{
pattern.setString("Pattern", "rb");
pattern.setInteger("Color", 15);
}
stack.getSubCompound("BlockEntityTag").getTagList("Patterns", 10).appendTag(pattern);
}
if (!stack.isEmpty() && stack.getItem() instanceof ItemBuildingBox && stack.getItemDamage()/2 == 11) {
ItemStack wrench=TF2Util.getFirstItem(player.inventory, stackL ->{
return TF2Attribute.getModifier("Teleporter Cost", stackL, 1, player) != 1;
});
if(!wrench.isEmpty()) {
stack.setCount((int) TF2Attribute.getModifier("Teleporter Cost", wrench, 1, player));
}
}
return stack;
}
示例9: isInvisibleToPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Only used by renderer in EntityLivingBase subclasses.
* Determines if an entity is visible or not to a specfic player, if the entity is normally invisible.
* For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent.
*/
@SideOnly(Side.CLIENT)
public boolean isInvisibleToPlayer(EntityPlayer player)
{
if (player.isSpectator())
{
return false;
}
else
{
Team team = this.getTeam();
return team != null && player != null && player.getTeam() == team && team.getSeeFriendlyInvisiblesEnabled() ? false : this.isInvisible();
}
}
示例10: onPlayerDeath
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerDeath(LivingDeathEvent event) {
if (event.getEntityLiving() instanceof EntityPlayerMP) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
// If the player fell into the void, there's no rescuing
if (event.getSource() == DamageSource.OUT_OF_WORLD) {
player.getEntityData().setBoolean(IGNORE_REVIVAL_DEATH, true);
NetworkHandler.instance.sendTo(new MessageDie(), (EntityPlayerMP) player);
return;
}
// If IGNORE_REVIVAL_DEATH is set, this should be treated as a normal death
if (event.getSource() == HardcoreRevival.notRescuedInTime || player.getEntityData().getBoolean(IGNORE_REVIVAL_DEATH)) {
return;
}
// Fire event for compatibility addons
MinecraftForge.EVENT_BUS.post(new PlayerKnockedOutEvent(player, event.getSource()));
// Dead players glow
if (ModConfig.glowOnDeath) {
player.setGlowing(true);
}
// Cancel event - we're taking over from here
event.setCanceled(true);
// If enabled, show a death message
if (player.world.getGameRules().getBoolean("showDeathMessages")) {
MinecraftServer server = player.world.getMinecraftServer();
if (server != null) {
Team team = player.getTeam();
if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS) {
if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS) {
server.getPlayerList().sendMessageToAllTeamMembers(player, player.getCombatTracker().getDeathMessage());
} else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM) {
server.getPlayerList().sendMessageToTeamOrAllPlayers(player, player.getCombatTracker().getDeathMessage());
}
} else {
server.getPlayerList().sendMessage(player.getCombatTracker().getDeathMessage());
}
}
}
}
}