本文整理匯總了Java中net.minecraft.network.datasync.EntityDataManager類的典型用法代碼示例。如果您正苦於以下問題:Java EntityDataManager類的具體用法?Java EntityDataManager怎麽用?Java EntityDataManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityDataManager類屬於net.minecraft.network.datasync包,在下文中一共展示了EntityDataManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleSpawnPlayer
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的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);
}
}
示例2: sendMetadataToAllAssociatedPlayers
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
/**
* Sends the entity metadata (DataWatcher) and attributes to all players tracking this entity, including the entity
* itself if a player.
*/
private void sendMetadataToAllAssociatedPlayers()
{
EntityDataManager entitydatamanager = this.trackedEntity.getDataManager();
if (entitydatamanager.isDirty())
{
this.sendToTrackingAndSelf(new SPacketEntityMetadata(this.trackedEntity.getEntityId(), entitydatamanager, false));
}
if (this.trackedEntity instanceof EntityLivingBase)
{
AttributeMap attributemap = (AttributeMap)((EntityLivingBase)this.trackedEntity).getAttributeMap();
Set<IAttributeInstance> set = attributemap.getAttributeInstanceSet();
if (!set.isEmpty())
{
this.sendToTrackingAndSelf(new SPacketEntityProperties(this.trackedEntity.getEntityId(), set));
}
set.clear();
}
}
示例3: readPacketData
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.uniqueId = buf.readUuid();
this.type = buf.readVarIntFromBuffer();
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.headPitch = buf.readByte();
this.velocityX = buf.readShort();
this.velocityY = buf.readShort();
this.velocityZ = buf.readShort();
this.dataManagerEntries = EntityDataManager.readEntries(buf);
}
示例4: fromBytes
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {
entityID = buf.readInt();
healTarget = buf.readInt();
try {
entries = EntityDataManager.readEntries(new PacketBuffer(buf));
//System.out.println("Entries rec: "+(entries != null ? entries.size() : 0));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*
* try { tag=CompressedStreamTools.read(new ByteBufInputStream(buf),
* new NBTSizeTracker(2097152L)); } catch (IOException e) { // TODO
* Auto-generated catch block e.printStackTrace(); }
*/
}
示例5: toBytes
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(entityID);
buf.writeInt(healTarget);
//System.out.println("Entries: "+entries.size());
try {
EntityDataManager.writeEntries(entries,new PacketBuffer(buf));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*
* try { CompressedStreamTools.write(tag, new
* ByteBufOutputStream(buf)); } catch (IOException e) { // TODO
* Auto-generated catch block e.printStackTrace(); }
*/
}
示例6: WeaponsCapability
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
public WeaponsCapability(EntityLivingBase entity) {
this.owner = entity;
this.dataManager = new EntityDataManager(entity);
this.dataManager.register(CRIT_TIME, 0);
this.dataManager.register(HEADS, 0);
this.dataManager.register(HEAL_TARGET, -1);
this.dataManager.register(PHLOG_RAGE, 0f);
this.dataManager.register(KNOCKBACK_RAGE, 0f);
this.dataManager.register(METAL, MAX_METAL);
this.dataManager.register(FEIGN, false);
this.dataManager.register(INVIS, false);
this.dataManager.register(DISGUISED, false);
this.dataManager.register(DISGUISE_TYPE, "");
this.dataManager.register(EXP_JUMP, false);
this.dataManager.register(CHARGING, false);
//this.nextBossTicks = (int) (entity.world.getWorldTime() + entity.getRNG().nextInt(360000));
}
示例7: readPacketData
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.uniqueId = buf.readUuid();
this.type = buf.readByte() & 255;
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.headPitch = buf.readByte();
this.velocityX = buf.readShort();
this.velocityY = buf.readShort();
this.velocityZ = buf.readShort();
this.dataManagerEntries = EntityDataManager.readEntries(buf);
}
示例8: handleSpawnPlayer
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的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);
}
}
示例9: execute
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
@Override
public boolean execute(EntityPlayerMP target) {
for (int i = 0; i < 15; i++) {
EntityCreeper creeper = new EntityCreeper(target.world);
EXPLOSION_RADIUS.set(creeper, 0);
EntityDataManager watcher = creeper.getDataManager();
watcher.set(POWERED_DATA_PARAMETER.get(null), true);
creeper.setPosition(target.posX + 20 * (random.nextFloat() - 0.5),
target.posY + 5 * (1 + random.nextFloat()),
target.posZ + 20 * (random.nextFloat() - 0.5));
target.world.spawnEntity(creeper);
}
return true;
}
示例10: getDataManager
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
@Override
public EntityDataManager getDataManager() {
if (m_realPlayer == null) {
return super.getDataManager();
} else {
syncToRealPlayer();
return syncPublicFieldsFromRealAndReturn(m_realPlayer.getDataManager());
}
}
示例11: getDataManager
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
@Override
public EntityDataManager getDataManager() {
if (m_realPlayer == null) {
return super.getDataManager();
} else {
return m_realPlayer.getDataManager();
}
}
示例12: createSnapshot
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
@Override
public EntityMetadata createSnapshot(EntityMetadata metadata) {
EntityDataManager manager = new EntityDataManager((net.minecraft.entity.Entity)metadata.getEntity());
List<DataEntry<?>> entries = ((EntityDataManager)metadata).getAll();
if(entries != null) {
for(DataEntry<?> entry : entries) {
register(manager, entry);
}
}
return (EntityMetadata)manager;
}
示例13: Entity
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
public Entity(World worldIn)
{
this.entityId = nextEntityID++;
this.riddenByEntities = Lists.<Entity>newArrayList();
this.boundingBox = ZERO_AABB;
this.width = 0.6F;
this.height = 1.8F;
this.nextStepDistance = 1;
this.rand = new Random();
this.field_190534_ay = -this.func_190531_bD();
this.firstUpdate = true;
this.entityUniqueID = MathHelper.getRandomUUID(this.rand);
this.cachedUniqueIdString = this.entityUniqueID.toString();
this.cmdResultStats = new CommandResultStats();
this.tags = Sets.<String>newHashSet();
this.field_191505_aI = new double[] {0.0D, 0.0D, 0.0D};
this.world = worldIn;
this.setPosition(0.0D, 0.0D, 0.0D);
if (worldIn != null)
{
this.dimension = worldIn.provider.getDimensionType().getId();
}
this.dataManager = new EntityDataManager(this);
this.dataManager.register(FLAGS, Byte.valueOf((byte)0));
this.dataManager.register(AIR, Integer.valueOf(300));
this.dataManager.register(CUSTOM_NAME_VISIBLE, Boolean.valueOf(false));
this.dataManager.register(CUSTOM_NAME, "");
this.dataManager.register(SILENT, Boolean.valueOf(false));
this.dataManager.register(NO_GRAVITY, Boolean.valueOf(false));
this.entityInit();
}
示例14: readPacketData
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.uniqueId = buf.readUuid();
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.dataManagerEntries = EntityDataManager.readEntries(buf);
}
示例15: SPacketEntityMetadata
import net.minecraft.network.datasync.EntityDataManager; //導入依賴的package包/類
public SPacketEntityMetadata(int entityIdIn, EntityDataManager dataManagerIn, boolean sendAll)
{
this.entityId = entityIdIn;
if (sendAll)
{
this.dataManagerEntries = dataManagerIn.getAll();
dataManagerIn.setClean();
}
else
{
this.dataManagerEntries = dataManagerIn.getDirty();
}
}