當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。