本文整理汇总了Java中net.minecraft.entity.EntityTracker类的典型用法代码示例。如果您正苦于以下问题:Java EntityTracker类的具体用法?Java EntityTracker怎么用?Java EntityTracker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityTracker类属于net.minecraft.entity包,在下文中一共展示了EntityTracker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hidePlayer
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public void hidePlayer(Player player) {
Validate.notNull(player, "hidden player cannot be null");
if (getHandle().playerNetServerHandler == null) return;
if (equals(player)) return;
if (hiddenPlayers.contains(player.getUniqueId())) return;
hiddenPlayers.add(player.getUniqueId());
//remove this player from the hidden player's EntityTrackerEntry
net.minecraft.entity.EntityTracker tracker = ((net.minecraft.world.WorldServer) entity.worldObj).theEntityTracker;
net.minecraft.entity.player.EntityPlayerMP other = ((CraftPlayer) player).getHandle();
net.minecraft.entity.EntityTrackerEntry entry = (net.minecraft.entity.EntityTrackerEntry) tracker.trackedEntityIDs.lookup(other.getEntityId());
if (entry != null) {
entry.removePlayerFromTracker(getHandle());
}
//remove the hidden player from this player user list
getHandle().playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S38PacketPlayerListItem(player.getPlayerListName(), false, 9999));
}
示例2: showPlayer
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public void showPlayer(Player player) {
Validate.notNull(player, "shown player cannot be null");
if (getHandle().playerNetServerHandler == null) return;
if (equals(player)) return;
if (!hiddenPlayers.contains(player.getUniqueId())) return;
hiddenPlayers.remove(player.getUniqueId());
EntityTracker tracker = ((WorldServer) entity.worldObj).theEntityTracker;
EntityPlayerMP other = ((CraftPlayer) player).getHandle();
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntityIDs.lookup(other.getEntityId());
if (entry != null) {
entry.removePlayerFromTracker(getHandle());
}
getHandle().playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(player.getPlayerListName(), false, 9999));
}
示例3: handleSpawnPlayer
import net.minecraft.entity.EntityTracker; //导入依赖的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);
}
}
示例4: WorldServer
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
super(saveHandlerIn, info, net.minecraftforge.common.DimensionManager.createProviderFor(dimensionId), profilerIn, false);
this.mcServer = server;
this.theEntityTracker = new EntityTracker(this);
this.thePlayerManager = new PlayerChunkMap(this);
// Guarantee the dimension ID was not reset by the provider
int providerDim = this.provider.getDimension();
this.provider.registerWorld(this);
this.provider.setDimension(providerDim);
this.chunkProvider = this.createChunkProvider();
perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn));
this.worldTeleporter = new Teleporter(this);
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.getWorldBorder().setSize(server.getMaxWorldSize());
net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer);
}
示例5: handleSpawnPlayer
import net.minecraft.entity.EntityTracker; //导入依赖的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);
}
}
示例6: func_71001_a
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public void func_71001_a(Entity p_71001_1_, int p_71001_2_) {
if(!p_71001_1_.field_70128_L && !this.field_70170_p.field_72995_K) {
EntityTracker var3 = ((WorldServer)this.field_70170_p).func_73039_n();
if(p_71001_1_ instanceof EntityItem) {
var3.func_72784_a(p_71001_1_, new Packet22Collect(p_71001_1_.field_70157_k, this.field_70157_k));
}
if(p_71001_1_ instanceof EntityArrow) {
var3.func_72784_a(p_71001_1_, new Packet22Collect(p_71001_1_.field_70157_k, this.field_70157_k));
}
if(p_71001_1_ instanceof EntityXPOrb) {
var3.func_72784_a(p_71001_1_, new Packet22Collect(p_71001_1_.field_70157_k, this.field_70157_k));
}
}
}
示例7: WorldServer
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
this.mcServer = server;
this.theEntityTracker = new EntityTracker(this);
this.thePlayerManager = new PlayerManager(this);
this.provider.registerWorld(this);
this.chunkProvider = this.createChunkProvider();
this.worldTeleporter = new Teleporter(this);
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.getWorldBorder().setSize(server.getMaxWorldSize());
}
示例8: getEntityTracker
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
@Override
public EntityTracker getEntityTracker() {
if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
return m_proxyWorld.getEntityTracker();
} else if (m_realWorld != null) {
return m_realWorld.getEntityTracker();
} else {
return super.getEntityTracker();
}
}
示例9: handleSpawnExperienceOrb
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
/**
* Spawns an experience orb and sets its value (amount of XP)
*/
public void handleSpawnExperienceOrb(SPacketSpawnExperienceOrb packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
Entity entity = new EntityXPOrb(this.clientWorldController, d0, d1, d2, packetIn.getXPValue());
EntityTracker.updateServerPosition(entity, d0, d1, d2);
entity.rotationYaw = 0.0F;
entity.rotationPitch = 0.0F;
entity.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
}
示例10: handleEntityTeleport
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
/**
* Updates an entity's position and rotation as specified by the packet
*/
public void handleEntityTeleport(SPacketEntityTeleport packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null)
{
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
EntityTracker.updateServerPosition(entity, d0, d1, d2);
if (!entity.canPassengerSteer())
{
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
{
entity.setPositionAndRotationDirect(entity.posX, entity.posY, entity.posZ, f, f1, 0, true);
}
else
{
entity.setPositionAndRotationDirect(d0, d1, d2, f, f1, 3, true);
}
entity.onGround = packetIn.getOnGround();
}
}
}
示例11: WorldServer
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
super(saveHandlerIn, info, DimensionType.getById(dimensionId).createDimension(), profilerIn, false);
this.mcServer = server;
this.theEntityTracker = new EntityTracker(this);
this.thePlayerManager = new PlayerChunkMap(this);
this.provider.registerWorld(this);
this.chunkProvider = this.createChunkProvider();
this.worldTeleporter = new Teleporter(this);
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.getWorldBorder().setSize(server.getMaxWorldSize());
}
示例12: tryTrackingEntity
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public boolean tryTrackingEntity(EntityTracker entityTracker, Entity entity)
{
EntityRegistration er = lookupModSpawn(entity.getClass(), true);
if (er != null)
{
entityTracker.addEntityToTracker(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
return true;
}
return false;
}
示例13: tryTrackingEntity
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public boolean tryTrackingEntity(EntityTracker entityTracker, Entity entity)
{
EntityRegistration er = lookupModSpawn(entity.getClass(), true);
if (er != null)
{
entityTracker.func_72785_a(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
return true;
}
return false;
}
示例14: updateTrackers
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
public static void updateTrackers(Entity entity, IMessage message)
{
EntityTracker et = ((WorldServer) entity.worldObj).getEntityTracker();
for (EntityPlayer player : et.getTrackingPlayers(entity))
{
DISPATCHER.sendTo(message, (EntityPlayerMP) player);
}
}
示例15: sendToTracked
import net.minecraft.entity.EntityTracker; //导入依赖的package包/类
/**
* Send message to players who are tracking given entity
*/
public static void sendToTracked(Entity entity, IMessage message)
{
EntityTracker tracker = ((WorldServer) entity.worldObj).getEntityTracker();
for (EntityPlayer player : tracker.getTrackingPlayers(entity))
{
DISPATCHER.sendTo(message, (EntityPlayerMP) player);
}
}