本文整理汇总了Java中net.minecraft.client.entity.EntityOtherPlayerMP类的典型用法代码示例。如果您正苦于以下问题:Java EntityOtherPlayerMP类的具体用法?Java EntityOtherPlayerMP怎么用?Java EntityOtherPlayerMP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityOtherPlayerMP类属于net.minecraft.client.entity包,在下文中一共展示了EntityOtherPlayerMP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRender
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public void onRender(float partialTicks)
{
boolean found = false;
for(Object entity : WMinecraft.getWorld().loadedEntityList)
if(entity instanceof EntityOtherPlayerMP)
{
EntityOtherPlayerMP player = (EntityOtherPlayerMP)entity;
if(player.getName().equals(playerName))
{
ChatUtils.message(
"Showing inventory of " + player.getName() + ".");
mc.displayGuiScreen(new GuiInventory(player));
found = true;
}
}
if(!found)
ChatUtils.error("Player not found.");
playerName = null;
wurst.events.remove(RenderListener.class, this);
}
示例2: handleSpawnPlayer
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
/**
* Handles the creation of a nearby player entity, sets the position and held item
*/
public void handleSpawnPlayer(SPacketSpawnPlayer packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.world, this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile());
entityotherplayermp.prevPosX = d0;
entityotherplayermp.lastTickPosX = d0;
entityotherplayermp.prevPosY = d1;
entityotherplayermp.lastTickPosY = d1;
entityotherplayermp.prevPosZ = d2;
entityotherplayermp.lastTickPosZ = d2;
EntityTracker.updateServerPosition(entityotherplayermp, d0, d1, d2);
entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
List < EntityDataManager.DataEntry<? >> list = packetIn.getDataManagerEntries();
if (list != null)
{
entityotherplayermp.getDataManager().setEntryValues(list);
}
}
示例3: getEntityFromName
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
public static IEntity getEntityFromName(String username) {
for (Entity entity : Minecraft.getMinecraft().world.loadedEntityList) {
if (entity instanceof EntityOtherPlayerMP) {
EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity;
if (player.getName().toLowerCase().equals(username.toLowerCase())) {
return new IEntity(player);
}
}
}
return null;
}
示例4: handleSpawnPlayer
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
/**
* Handles the creation of a nearby player entity, sets the position and held item
*/
public void handleSpawnPlayer(SPacketSpawnPlayer packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile());
entityotherplayermp.prevPosX = d0;
entityotherplayermp.lastTickPosX = d0;
entityotherplayermp.prevPosY = d1;
entityotherplayermp.lastTickPosY = d1;
entityotherplayermp.prevPosZ = d2;
entityotherplayermp.lastTickPosZ = d2;
EntityTracker.updateServerPosition(entityotherplayermp, d0, d1, d2);
entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
List < EntityDataManager.DataEntry<? >> list = packetIn.getDataManagerEntries();
if (list != null)
{
entityotherplayermp.getDataManager().setEntryValues(list);
}
}
示例5: onRender
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public void onRender() {
boolean found = false;
for (Object entity : Minecraft.getMinecraft().theWorld.loadedEntityList) {
if (entity instanceof EntityOtherPlayerMP) {
EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity;
if (player.getName().equals(playerName)) {
WurstClient.INSTANCE.chat.message("Showing inventory of " + player.getName() + ".");
Minecraft.getMinecraft().displayGuiScreen(new GuiInventory(player));
found = true;
}
}
}
if (!found) WurstClient.INSTANCE.chat.error("Player not found.");
playerName = null;
WurstClient.INSTANCE.events.remove(RenderListener.class, this);
}
示例6: onEnable
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public void onEnable() {
if (EntityUtils.getClosestEntityRaw(false) == null) {
WurstClient.INSTANCE.chat.message("There is no nearby entity.");
setEnabled(false);
return;
}
oldX = Minecraft.getMinecraft().thePlayer.posX;
oldY = Minecraft.getMinecraft().thePlayer.posY;
oldZ = Minecraft.getMinecraft().thePlayer.posZ;
oldYaw = Minecraft.getMinecraft().thePlayer.rotationYaw;
oldPitch = Minecraft.getMinecraft().thePlayer.rotationPitch;
Minecraft.getMinecraft().thePlayer.noClip = true;
if (otherID == null) otherID = EntityUtils.getClosestEntityRaw(false).getUniqueID();
otherView = EntityUtils.searchEntityByIdRaw(otherID);
wasInvisible = otherView.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer);
EntityOtherPlayerMP fakePlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld,
Minecraft.getMinecraft().thePlayer.getGameProfile());
fakePlayer.clonePlayer(Minecraft.getMinecraft().thePlayer, true);
fakePlayer.copyLocationAndAnglesFrom(Minecraft.getMinecraft().thePlayer);
fakePlayer.rotationYawHead = Minecraft.getMinecraft().thePlayer.rotationYawHead;
Minecraft.getMinecraft().theWorld.addEntityToWorld(-69, fakePlayer);
WurstClient.INSTANCE.chat.message("Now viewing " + otherView.getName() + ".");
WurstClient.INSTANCE.events.add(UpdateListener.class, this);
}
示例7: onTick
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ClientTickEvent event) {
if(event.phase == TickEvent.Phase.START && mc.theWorld != null) {
if(pingDelay <= -10.0D) {
pingDelay = 63.0D;
}
pingDelay -= 1.0D;
entityList = mc.theWorld.loadedEntityList;
ArrayList<String> newInRangePlayers = new ArrayList();
for(Object o : entityList) {
if(o instanceof EntityOtherPlayerMP) {
newInRangePlayers.add(((EntityOtherPlayerMP)o).getName());
}
}
ArrayList<String> temp = (ArrayList)newInRangePlayers.clone();
newInRangePlayers.removeAll(inRangePlayers);
for(String name : newInRangePlayers) {
mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "minecraft:note.pling", config.getPingVolume(), 1.0F, false);
}
inRangePlayers = temp;
}
}
示例8: onEnable
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public void onEnable()
{
try{
Resilience.getInstance().getValues().freecamEnabled = true;
Resilience.getInstance().getEventManager().register(this);
freecamX = invoker.getPosX();
freecamY = invoker.getPosY();
freecamZ = invoker.getPosZ();
freecamPitch = invoker.getRotationPitch();
freecamYaw = invoker.getRotationYaw();
entity = new EntityOtherPlayerMP(Resilience.getInstance().getWrapper().getWorld(), new GameProfile("",Resilience.getInstance().getValues().nameProtectEnabled ? Resilience.getInstance().getValues().nameProtectAlias.getValue() : invoker.getSessionUsername()));
invoker.setPositionAndRotation(entity, invoker.getPosX(), invoker.getPosY() - invoker.getEntityHeight(Resilience.getInstance().getWrapper().getPlayer()) + 0.17, invoker.getPosZ(), invoker.getRotationYaw(), invoker.getRotationPitch());
invoker.copyInventory(entity, Resilience.getInstance().getWrapper().getPlayer());
invoker.addEntityToWorld(entity, 69);
}catch(Exception e){}
}
示例9: recieveCommand
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public boolean recieveCommand(String cmd) throws Exception {
String args[] = cmd.split("invsee ");
for(Object o : Resilience.getInstance().getInvoker().getEntityList()){
if(o instanceof EntityOtherPlayerMP){
EntityOtherPlayerMP player = (EntityOtherPlayerMP)o;
if(Resilience.getInstance().getInvoker().getPlayerName(player).equalsIgnoreCase(args[1].trim())){
Resilience.getInstance().getWrapper().getInGameGui().displayInv(player);
Resilience.getInstance().getLogger().infoChat("Now viewing "+args[1]);
return true;
}
}
}
Resilience.getInstance().getLogger().warningChat("Error! Player "+args[1]+" not found.");
return true;
}
示例10: recieveCommand
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public boolean recieveCommand(String cmd) throws Exception {
if(mc.renderViewEntity != mc.thePlayer){
mc.renderViewEntity = mc.thePlayer;
Resilience.getInstance().getLogger().infoChat("Now viewing from your player");
return true;
}
String args[] = cmd.split("remoteview ");
for(Object o : Resilience.getInstance().getInvoker().getEntityList()){
if(o instanceof EntityOtherPlayerMP){
EntityOtherPlayerMP otherPlayer = (EntityOtherPlayerMP) o;
if(Resilience.getInstance().getInvoker().getPlayerName(otherPlayer).equalsIgnoreCase(args[1].trim())){
mc.renderViewEntity = otherPlayer;
Resilience.getInstance().getLogger().infoChat("Now viewing from \247b"+Resilience.getInstance().getInvoker().getPlayerName(otherPlayer)+"\247f's perspective");
return true;
}
}
}
Resilience.getInstance().getLogger().warningChat("Error, player not found");
return false;
}
示例11: getPlayers
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
public Set<AbstractClientPlayer> getPlayers(final PlayerTeam team) {
try {
return playerList.get(team, new Callable<Set<AbstractClientPlayer>>() {
@Override
public Set<AbstractClientPlayer> call() throws Exception {
Set<AbstractClientPlayer> players = new LinkedHashSet();
Minecraft mc = Minecraft.getMinecraft();
players.add(new EntityOtherPlayerMP(mc.theWorld, new GameProfile(team.getOwner(), getUsernameFromID(team.getOwner()))));
if (!team.isOwner(mc.thePlayer)) players.add(mc.thePlayer);
for (UUID uuid : team.getMembers()) {
if (uuid.equals(PlayerHelper.getUUIDForPlayer(mc.thePlayer))) continue;
else {
players.add(new EntityOtherPlayerMP(mc.theWorld, new GameProfile(uuid, getUsernameFromID(uuid))));
}
}
return players;
}
});
} catch (Exception e) {
return new LinkedHashSet();
}
}
示例12: func_72518_a
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
public void func_72518_a(Packet20NamedEntitySpawn p_72518_1_) {
double var2 = (double)p_72518_1_.field_73515_c / 32.0D;
double var4 = (double)p_72518_1_.field_73512_d / 32.0D;
double var6 = (double)p_72518_1_.field_73513_e / 32.0D;
float var8 = (float)(p_72518_1_.field_73510_f * 360) / 256.0F;
float var9 = (float)(p_72518_1_.field_73511_g * 360) / 256.0F;
EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.field_72563_h.field_71441_e, p_72518_1_.field_73514_b);
var10.field_70169_q = var10.field_70142_S = (double)(var10.field_70118_ct = p_72518_1_.field_73515_c);
var10.field_70167_r = var10.field_70137_T = (double)(var10.field_70117_cu = p_72518_1_.field_73512_d);
var10.field_70166_s = var10.field_70136_U = (double)(var10.field_70116_cv = p_72518_1_.field_73513_e);
int var11 = p_72518_1_.field_73518_h;
if(var11 == 0) {
var10.field_71071_by.field_70462_a[var10.field_71071_by.field_70461_c] = null;
} else {
var10.field_71071_by.field_70462_a[var10.field_71071_by.field_70461_c] = new ItemStack(var11, 1, 0);
}
var10.func_70080_a(var2, var4, var6, var8, var9);
this.field_72564_i.func_73027_a(p_72518_1_.field_73516_a, var10);
List var12 = p_72518_1_.func_73509_c();
if(var12 != null) {
var10.func_70096_w().func_75687_a(var12);
}
}
示例13: func_72524_a
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
public void func_72524_a(Packet18Animation p_72524_1_) {
Entity var2 = this.func_72545_a(p_72524_1_.field_73470_a);
if(var2 != null) {
if(p_72524_1_.field_73469_b == 1) {
EntityLivingBase var3 = (EntityLivingBase)var2;
var3.func_71038_i();
} else if(p_72524_1_.field_73469_b == 2) {
var2.func_70057_ab();
} else if(p_72524_1_.field_73469_b == 3) {
EntityPlayer var4 = (EntityPlayer)var2;
var4.func_70999_a(false, false, false);
} else if(p_72524_1_.field_73469_b != 4) {
if(p_72524_1_.field_73469_b == 6) {
this.field_72563_h.field_71452_i.func_78873_a(new EntityCrit2FX(this.field_72563_h.field_71441_e, var2));
} else if(p_72524_1_.field_73469_b == 7) {
EntityCrit2FX var5 = new EntityCrit2FX(this.field_72563_h.field_71441_e, var2, "magicCrit");
this.field_72563_h.field_71452_i.func_78873_a(var5);
} else if(p_72524_1_.field_73469_b == 5 && var2 instanceof EntityOtherPlayerMP) {
;
}
}
}
}
示例14: playerTick
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@SubscribeEvent
public void playerTick(PlayerTickEvent event)
{
if(event.player.world.isRemote)
{
if(!event.player.getEntityData().hasKey("harshenInventory") && !(event.player instanceof EntityOtherPlayerMP))
HarshenNetwork.sendToServer(new MessagePacketRequestInv());
}
if(!tickMap.containsKey(event.player))
tickMap.put(event.player, 0);
tickMap.put(event.player, tickMap.get(event.player) + 1);
HarshenItemStackHandler handler = HarshenUtils.getHandler(event.player);
ArrayList<ItemStack> prevInv = event.side.isServer() ? prevInvServer : prevInvClient;
if(prevInv.size() != 0)
for(int slot = 0; slot < handler.getSlots(); slot++)
if(!prevInv.get(slot).isItemEqual(handler.getStackInSlot(slot)) && handler.getStackInSlot(slot).getItem() instanceof IHarshenProvider)
((IHarshenProvider)handler.getStackInSlot(slot).getItem()).onAdd(event.player, slot);
else if(!prevInv.get(slot).isEmpty() && handler.getStackInSlot(slot).isEmpty() && prevInv.get(slot).getItem() instanceof IHarshenProvider)
((IHarshenProvider)prevInv.get(slot).getItem()).onRemove(event.player, slot);
ArrayList<ItemStack> tickHandlerInventory = new ArrayList<>();
for(int slot = 0; slot < handler.getSlots(); slot++)
{
if(handler.getStackInSlot(slot).getItem() instanceof IHarshenProvider)
((IHarshenProvider)handler.getStackInSlot(slot).getItem()).onTick(event.player, tickMap.get(event.player));
tickHandlerInventory.add(handler.getStackInSlot(slot));
}
prevInv.clear();
prevInv.addAll(tickHandlerInventory);
}
示例15: onEnabled
import net.minecraft.client.entity.EntityOtherPlayerMP; //导入依赖的package包/类
@Override
public void onEnabled() {
if(MC.player != null) {
isRidingEntity = MC.player.getRidingEntity() != null;
if (MC.player.getRidingEntity() == null) {
posX = MC.player.posX;
posY = MC.player.posY;
posZ = MC.player.posZ;
}
else {
ridingEntity = MC.player.getRidingEntity();
MC.player.dismountRidingEntity();
}
pitch = MC.player.rotationPitch;
yaw = MC.player.rotationYaw;
clonedPlayer = new EntityOtherPlayerMP(MC.world, MC.getSession().getProfile());
clonedPlayer.copyLocationAndAnglesFrom(MC.player);
clonedPlayer.rotationYawHead = MC.player.rotationYawHead;
MC.world.addEntityToWorld(-100, clonedPlayer);
MC.player.capabilities.isFlying = true;
MC.player.capabilities.setFlySpeed(speed.getAsFloat());
MC.player.noClip = true;
}
}