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


Java Potion.getPotionById方法代码示例

本文整理汇总了Java中net.minecraft.potion.Potion.getPotionById方法的典型用法代码示例。如果您正苦于以下问题:Java Potion.getPotionById方法的具体用法?Java Potion.getPotionById怎么用?Java Potion.getPotionById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.potion.Potion的用法示例。


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

示例1: handleEntityEffect

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        Potion potion = Potion.getPotionById(packetIn.getEffectId());

        if (potion != null)
        {
            PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.getIsAmbient(), packetIn.doesShowParticles());
            potioneffect.setPotionDurationMax(packetIn.isMaxDuration());
            ((EntityLivingBase)entity).addPotionEffect(potioneffect);
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:18,代码来源:NetHandlerPlayClient.java

示例2: handleEntityEffect

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        Potion potion = Potion.getPotionById(packetIn.getEffectId() & 0xFF);

        if (potion != null)
        {
            PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.getIsAmbient(), packetIn.doesShowParticles());
            potioneffect.setPotionDurationMax(packetIn.isMaxDuration());
            ((EntityLivingBase)entity).addPotionEffect(potioneffect);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:NetHandlerPlayClient.java

示例3: onUpdate

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP player) {
	if(isEnabled()) {
		if(player != null && !player.isPotionActive(Potion.getPotionById(16))) {
			PotionEffect nightVision = new PotionEffect(Potion.getPotionById(16), Integer.MAX_VALUE, 0);
			nightVision.setPotionDurationMax(true);
			player.addPotionEffect(nightVision);
		}
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:Fullbright.java

示例4: readPacketData

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.entityId = buf.readVarIntFromBuffer();
    this.effectId = Potion.getPotionById(buf.readUnsignedByte());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:SPacketRemoveEntityEffect.java

示例5: updateScreen

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
/**
 * Called from the main game loop to update the screen.
 */
public void updateScreen()
{
    super.updateScreen();
    int i = this.tileBeacon.getField(0);
    Potion potion = Potion.getPotionById(this.tileBeacon.getField(1));
    Potion potion1 = Potion.getPotionById(this.tileBeacon.getField(2));

    if (this.buttonsNotDrawn && i >= 0)
    {
        this.buttonsNotDrawn = false;
        int j = 100;

        for (int k = 0; k <= 2; ++k)
        {
            int l = TileEntityBeacon.EFFECTS_LIST[k].length;
            int i1 = l * 22 + (l - 1) * 2;

            for (int j1 = 0; j1 < l; ++j1)
            {
                Potion potion2 = TileEntityBeacon.EFFECTS_LIST[k][j1];
                GuiBeacon.PowerButton guibeacon$powerbutton = new GuiBeacon.PowerButton(j++, this.guiLeft + 76 + j1 * 24 - i1 / 2, this.guiTop + 22 + k * 25, potion2, k);
                this.buttonList.add(guibeacon$powerbutton);

                if (k >= i)
                {
                    guibeacon$powerbutton.enabled = false;
                }
                else if (potion2 == potion)
                {
                    guibeacon$powerbutton.setSelected(true);
                }
            }
        }

        int k1 = 3;
        int l1 = TileEntityBeacon.EFFECTS_LIST[3].length + 1;
        int i2 = l1 * 22 + (l1 - 1) * 2;

        for (int j2 = 0; j2 < l1 - 1; ++j2)
        {
            Potion potion3 = TileEntityBeacon.EFFECTS_LIST[3][j2];
            GuiBeacon.PowerButton guibeacon$powerbutton2 = new GuiBeacon.PowerButton(j++, this.guiLeft + 167 + j2 * 24 - i2 / 2, this.guiTop + 47, potion3, 3);
            this.buttonList.add(guibeacon$powerbutton2);

            if (3 >= i)
            {
                guibeacon$powerbutton2.enabled = false;
            }
            else if (potion3 == potion1)
            {
                guibeacon$powerbutton2.setSelected(true);
            }
        }

        if (potion != null)
        {
            GuiBeacon.PowerButton guibeacon$powerbutton1 = new GuiBeacon.PowerButton(j++, this.guiLeft + 167 + (l1 - 1) * 24 - i2 / 2, this.guiTop + 47, potion, 3);
            this.buttonList.add(guibeacon$powerbutton1);

            if (3 >= i)
            {
                guibeacon$powerbutton1.enabled = false;
            }
            else if (potion == potion1)
            {
                guibeacon$powerbutton1.setSelected(true);
            }
        }
    }

    this.beaconConfirmButton.enabled = !this.tileBeacon.getStackInSlot(0).func_190926_b() && potion != null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:76,代码来源:GuiBeacon.java

示例6: isBeaconEffect

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@Nullable
private static Potion isBeaconEffect(int p_184279_0_)
{
    Potion potion = Potion.getPotionById(p_184279_0_);
    return VALID_EFFECTS.contains(potion) ? potion : null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:TileEntityBeacon.java

示例7: updateScreen

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
/**
 * Called from the main game loop to update the screen.
 */
public void updateScreen()
{
    super.updateScreen();
    int i = this.tileBeacon.getField(0);
    Potion potion = Potion.getPotionById(this.tileBeacon.getField(1));
    Potion potion1 = Potion.getPotionById(this.tileBeacon.getField(2));

    if (this.buttonsNotDrawn && i >= 0)
    {
        this.buttonsNotDrawn = false;
        int j = 100;

        for (int k = 0; k <= 2; ++k)
        {
            int l = TileEntityBeacon.EFFECTS_LIST[k].length;
            int i1 = l * 22 + (l - 1) * 2;

            for (int j1 = 0; j1 < l; ++j1)
            {
                Potion potion2 = TileEntityBeacon.EFFECTS_LIST[k][j1];
                GuiBeacon.PowerButton guibeacon$powerbutton = new GuiBeacon.PowerButton(j++, this.guiLeft + 76 + j1 * 24 - i1 / 2, this.guiTop + 22 + k * 25, potion2, k);
                this.buttonList.add(guibeacon$powerbutton);

                if (k >= i)
                {
                    guibeacon$powerbutton.enabled = false;
                }
                else if (potion2 == potion)
                {
                    guibeacon$powerbutton.setSelected(true);
                }
            }
        }

        int k1 = 3;
        int l1 = TileEntityBeacon.EFFECTS_LIST[3].length + 1;
        int i2 = l1 * 22 + (l1 - 1) * 2;

        for (int j2 = 0; j2 < l1 - 1; ++j2)
        {
            Potion potion3 = TileEntityBeacon.EFFECTS_LIST[3][j2];
            GuiBeacon.PowerButton guibeacon$powerbutton2 = new GuiBeacon.PowerButton(j++, this.guiLeft + 167 + j2 * 24 - i2 / 2, this.guiTop + 47, potion3, 3);
            this.buttonList.add(guibeacon$powerbutton2);

            if (3 >= i)
            {
                guibeacon$powerbutton2.enabled = false;
            }
            else if (potion3 == potion1)
            {
                guibeacon$powerbutton2.setSelected(true);
            }
        }

        if (potion != null)
        {
            GuiBeacon.PowerButton guibeacon$powerbutton1 = new GuiBeacon.PowerButton(j++, this.guiLeft + 167 + (l1 - 1) * 24 - i2 / 2, this.guiTop + 47, potion, 3);
            this.buttonList.add(guibeacon$powerbutton1);

            if (3 >= i)
            {
                guibeacon$powerbutton1.enabled = false;
            }
            else if (potion == potion1)
            {
                guibeacon$powerbutton1.setSelected(true);
            }
        }
    }

    this.beaconConfirmButton.enabled = this.tileBeacon.getStackInSlot(0) != null && potion != null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:76,代码来源:GuiBeacon.java


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