本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}