当前位置: 首页>>代码示例>>Java>>正文


Java EntityDataManager类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:29,代码来源:NetHandlerPlayClient.java

示例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();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:EntityTrackerEntry.java

示例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);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:SPacketSpawnMob.java

示例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(); }
	 */
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:18,代码来源:TF2Message.java

示例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(); }
	 */
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:18,代码来源:TF2Message.java

示例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));
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:18,代码来源:WeaponsCapability.java

示例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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:SPacketSpawnMob.java

示例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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:NetHandlerPlayClient.java

示例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;
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:17,代码来源:DummyCreepersFlimFlam.java

示例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());
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:10,代码来源:EntityPlayerMPProxy.java

示例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();
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:9,代码来源:EntityPlayerProxy.java

示例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;
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:14,代码来源:PacketControlService.java

示例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();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:34,代码来源:Entity.java

示例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);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:SPacketSpawnPlayer.java

示例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();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:SPacketEntityMetadata.java


注:本文中的net.minecraft.network.datasync.EntityDataManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。