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


Java DataParameter类代码示例

本文整理汇总了Java中net.minecraft.network.datasync.DataParameter的典型用法代码示例。如果您正苦于以下问题:Java DataParameter类的具体用法?Java DataParameter怎么用?Java DataParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataParameter类属于net.minecraft.network.datasync包,在下文中一共展示了DataParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: set

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public <T> void set(@Nonnull DataParameter<T> key, @Nonnull T value) {
    if (key == EntityPlayer.ABSORPTION) {
        float floatValue = (Float) value;
        if (player instanceof EntityPlayerMP) { //may be EntityOtherPlayerMP as well
            EntityPlayerMP playerMP = (EntityPlayerMP) player;
            if (playerMP.connection != null) //also fired when connecting, ignore(otherwise the net handler would crash)
                FirstAid.NETWORKING.sendTo(new MessageApplyAbsorption(floatValue), playerMP);
        }
        PlayerDataManager.getDamageModel(player).setAbsorption(floatValue);
    } else if (key == EntityLivingBase.HEALTH) {
         if (!player.world.isRemote && (Float) value > player.getMaxHealth())
            PlayerDataManager.getDamageModel(player).forEach(damageablePart -> damageablePart.currentHealth = damageablePart.getMaxHealth());
    }
    set_impl(key, value);
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:17,代码来源:DataManagerWrapper.java

示例2: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    super.notifyDataManagerChange(key);

    if (HAND_STATES.equals(key))
    {
        boolean flag = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
        EnumHand enumhand = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;

        if (flag && !this.handActive)
        {
            this.setActiveHand(enumhand);
        }
        else if (!flag && this.handActive)
        {
            this.resetActiveHand();
        }
    }

    if (FLAGS.equals(key) && this.isElytraFlying() && !this.wasFallFlying)
    {
        this.mc.getSoundHandler().playSound(new ElytraSound(this));
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:25,代码来源:EntityPlayerSP.java

示例3: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    super.notifyDataManagerChange(key);

    if (LAST_OUTPUT.equals(key))
    {
        try
        {
            this.commandBlockLogic.setLastOutput((ITextComponent)this.getDataManager().get(LAST_OUTPUT));
        }
        catch (Throwable var3)
        {
            ;
        }
    }
    else if (COMMAND.equals(key))
    {
        this.commandBlockLogic.setCommand((String)this.getDataManager().get(COMMAND));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:EntityMinecartCommandBlock.java

示例4: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    super.notifyDataManagerChange(key);

    if (HAND_STATES.equals(key) && this.world.isRemote)
    {
        if (this.isHandActive() && this.activeItemStack.func_190926_b())
        {
            this.activeItemStack = this.getHeldItem(this.getActiveHand());

            if (!this.activeItemStack.func_190926_b())
            {
                this.activeItemStackUseCount = this.activeItemStack.getMaxItemUseDuration();
            }
        }
        else if (!this.isHandActive() && !this.activeItemStack.func_190926_b())
        {
            this.activeItemStack = ItemStack.field_190927_a;
            this.activeItemStackUseCount = 0;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:EntityLivingBase.java

示例5: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    if (SLIME_SIZE.equals(key))
    {
        int i = this.getSlimeSize();
        this.setSize(0.51000005F * (float)i, 0.51000005F * (float)i);
        this.rotationYaw = this.rotationYawHead;
        this.renderYawOffset = this.rotationYawHead;

        if (this.isInWater() && this.rand.nextInt(20) == 0)
        {
            this.resetHeight();
        }
    }

    super.notifyDataManagerChange(key);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:EntitySlime.java

示例6: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
	this.adjustSize();
	
	// System.out.println("Watcher update: "+data);
	if (!this.world.isRemote && key == CONSTRUCTING) {
		this.setSoundState(this.dataManager.get(CONSTRUCTING) >= this.getConstructionTime()? 0 : 25);
	}
	if (this.world.isRemote && key == SOUND_STATE) {
		SoundEvent sound = this.getSoundNameForState(this.getSoundState());
		if (sound != null) {
			// System.out.println("Playing Sound: "+sound);
			if (this.buildingSound != null)
				this.buildingSound.stopPlaying();
			this.buildingSound = new BuildingSound(this, sound, this.getSoundState());
			ClientProxy.playBuildingSound(buildingSound);
		}
		else{
			if(this.buildingSound != null)
				this.buildingSound.stopPlaying();
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:24,代码来源:EntityBuilding.java

示例7: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    super.notifyDataManagerChange(key);

    if (HAND_STATES.equals(key) && this.worldObj.isRemote)
    {
        if (this.isHandActive() && this.activeItemStack == null)
        {
            this.activeItemStack = this.getHeldItem(this.getActiveHand());

            if (this.activeItemStack != null)
            {
                this.activeItemStackUseCount = this.activeItemStack.getMaxItemUseDuration();
            }
        }
        else if (!this.isHandActive() && this.activeItemStack != null)
        {
            this.activeItemStack = null;
            this.activeItemStackUseCount = 0;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:EntityLivingBase.java

示例8: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    if (IS_CHILD.equals(key))
    {
        this.setChildSize(this.isChild());
    }
    else if (VILLAGER_TYPE.equals(key))
    {
        net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, ZombieType.getByOrdinal(this.getDataManager().get(VILLAGER_TYPE)), this.getDataManager().get(VILLAGER_TYPE));
    }
    else if (VILLAGER_TYPE_STR.equals(key))
    {
        String name = this.getDataManager().get(VILLAGER_TYPE_STR);
        net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
                "".equals(name) ? null : net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation(name));
        this.setVillagerType(p);
    }

    super.notifyDataManagerChange(key);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityZombie.java

示例9: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    super.notifyDataManagerChange(key);

    if (STATUS.equals(key))
    {
        if (this.isElder() && this.width < 1.0F)
        {
            this.setSize(1.9975F, 1.9975F);
        }
    }
    else if (TARGET_ENTITY.equals(key))
    {
        this.clientSideAttackTime = 0;
        this.targetedEntity = null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:EntityGuardian.java

示例10: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
    super.notifyDataManagerChange(key);
    if(key == SUCCESS) {
        success = dataManager.get(SUCCESS).booleanValue();
    } else if(container == null) {

        if(dataManager.get(RITUAL) != null && dataManager.get(RECIPE) != null &&
                dataManager.get(TOTAL_TICKS) != null) {
            loadFromData(dataManager.get(RITUAL), dataManager.get(RECIPE),
                    dataManager.get(TOTAL_TICKS), dataManager.get(TICKS_LEFT), true);
        }

    } else if(key == TICKS_LEFT) {
        container.ticksLeft = dataManager.get(TICKS_LEFT).intValue();
    }
}
 
开发者ID:ExoMagica,项目名称:ExoMagica,代码行数:18,代码来源:EntityRitual.java

示例11: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
    if (PLAYER_ID.equals(key)) {
        if (this.world.isRemote) {
            Entity entity = world.getEntityByID(this.dataManager.get(PLAYER_ID));
            if (entity instanceof EntityPlayer) {
                EntityPlayer player = (EntityPlayer) entity;
                if (player != null) {
                    this.getAngler().fishEntity = null;
                    this.angler = player;
                    this.angler.fishEntity = this;
                }
            }
        }
    }

    super.notifyDataManagerChange(key);
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:19,代码来源:EntityCustomFishHook.java

示例12: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    if (IS_CHILD.equals(key))
    {
        this.setChildSize(this.isChild());
    }
    else if (VILLAGER_TYPE.equals(key))
    {
        net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, ZombieType.func_190146_a(this.getDataManager().get(VILLAGER_TYPE)), this.getDataManager().get(VILLAGER_TYPE));
    }
    else if (VILLAGER_TYPE_STR.equals(key))
    {
        String name = this.getDataManager().get(VILLAGER_TYPE_STR);
        net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
                "".equals(name) ? null : net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation(name));
        this.setVillagerType(p);
    }

    super.notifyDataManagerChange(key);
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:21,代码来源:EntityZombie.java

示例13: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
    super.notifyDataManagerChange(key);

    if (HAND_STATES.equals(key))
    {
        boolean flag = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
        EnumHand enumhand = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;

        if (flag && !this.handActive)
        {
            this.setActiveHand(enumhand);
        }
        else if (!flag && this.handActive)
        {
            this.resetActiveHand();
        }
    }

    if (FLAGS.equals(key) && this.isElytraFlying() && !this.field_189813_ct)
    {
        this.mc.getSoundHandler().playSound(new ElytraSound(this));
    }
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:25,代码来源:EntityPlayerSP.java

示例14: DragonBreedHelper

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public DragonBreedHelper(EntityTameableDragon dragon, DataParameter<String> dataParam) {
    super(dragon);
    
    this.dataParam = dataParam;

    if (dragon.isServer()) {
        // initialize map to avoid future checkings
        for (EnumDragonBreed type : EnumDragonBreed.values()) {
            breedPoints.put(type, new AtomicInteger());
        }
        
        // default breed has initial points
        breedPoints.get(EnumDragonBreed.DEFAULT).set(POINTS_INITIAL);
    }
    
    dataWatcher.register(dataParam, EnumDragonBreed.DEFAULT.getName());
}
 
开发者ID:ata4,项目名称:dragon-mounts,代码行数:18,代码来源:DragonBreedHelper.java

示例15: notifyDataManagerChange

import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
	if (m_realPlayer == null) {
		super.notifyDataManagerChange(key);
	} else {
		syncToRealPlayer();
		m_realPlayer.notifyDataManagerChange(key);
		syncPublicFieldsFromReal();
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:11,代码来源:EntityPlayerMPProxy.java


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