本文整理汇总了Java中net.minecraft.scoreboard.ScorePlayerTeam.setCollisionRule方法的典型用法代码示例。如果您正苦于以下问题:Java ScorePlayerTeam.setCollisionRule方法的具体用法?Java ScorePlayerTeam.setCollisionRule怎么用?Java ScorePlayerTeam.setCollisionRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.scoreboard.ScorePlayerTeam
的用法示例。
在下文中一共展示了ScorePlayerTeam.setCollisionRule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleTeams
import net.minecraft.scoreboard.ScorePlayerTeam; //导入方法依赖的package包/类
/**
* Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team-
* memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled
*/
public void handleTeams(SPacketTeams packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
ScorePlayerTeam scoreplayerteam;
if (packetIn.getAction() == 0)
{
scoreplayerteam = scoreboard.createTeam(packetIn.getName());
}
else
{
scoreplayerteam = scoreboard.getTeam(packetIn.getName());
}
if (packetIn.getAction() == 0 || packetIn.getAction() == 2)
{
scoreplayerteam.setTeamName(packetIn.getDisplayName());
scoreplayerteam.setNamePrefix(packetIn.getPrefix());
scoreplayerteam.setNameSuffix(packetIn.getSuffix());
scoreplayerteam.setChatFormat(TextFormatting.fromColorIndex(packetIn.getColor()));
scoreplayerteam.setFriendlyFlags(packetIn.getFriendlyFlags());
Team.EnumVisible team$enumvisible = Team.EnumVisible.getByName(packetIn.getNameTagVisibility());
if (team$enumvisible != null)
{
scoreplayerteam.setNameTagVisibility(team$enumvisible);
}
Team.CollisionRule team$collisionrule = Team.CollisionRule.getByName(packetIn.getCollisionRule());
if (team$collisionrule != null)
{
scoreplayerteam.setCollisionRule(team$collisionrule);
}
}
if (packetIn.getAction() == 0 || packetIn.getAction() == 3)
{
for (String s : packetIn.getPlayers())
{
scoreboard.addPlayerToTeam(s, packetIn.getName());
}
}
if (packetIn.getAction() == 4)
{
for (String s1 : packetIn.getPlayers())
{
scoreboard.removePlayerFromTeam(s1, scoreplayerteam);
}
}
if (packetIn.getAction() == 1)
{
scoreboard.removeTeam(scoreplayerteam);
}
}