本文整理汇总了Java中net.minecraft.potion.PotionHelper类的典型用法代码示例。如果您正苦于以下问题:Java PotionHelper类的具体用法?Java PotionHelper怎么用?Java PotionHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PotionHelper类属于net.minecraft.potion包,在下文中一共展示了PotionHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePotionMetadata
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
/**
* Clears potion metadata values if the entity has no potion effects. Otherwise, updates potion effect color,
* ambience, and invisibility metadata values
*/
protected void updatePotionMetadata()
{
if (this.activePotionsMap.isEmpty())
{
this.resetPotionEffectMetadata();
this.setInvisible(false);
}
else
{
int i = PotionHelper.calcPotionLiquidColor(this.activePotionsMap.values());
this.dataWatcher.updateObject(8, Byte.valueOf((byte)(PotionHelper.getAreAmbient(this.activePotionsMap.values()) ? 1 : 0)));
this.dataWatcher.updateObject(7, Integer.valueOf(i));
this.setInvisible(this.isPotionActive(Potion.invisibility.id));
}
}
示例2: RabbitFoot
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public RabbitFoot() {
setTextureName("rabbit_foot");
setUnlocalizedName(Utils.getUnlocalisedName("rabbit_foot"));
setCreativeTab(EtFuturum.enableRabbit ? EtFuturum.creativeTab : null);
if (EtFuturum.enableRabbit)
try {
Field f = ReflectionHelper.findField(PotionHelper.class, "potionRequirements", "field_77927_l");
f.setAccessible(true);
HashMap<Integer, String> potionRequirements = (HashMap<Integer, String>) f.get(null);
potionRequirements.put(Potion.jump.getId(), "0 & 1 & !2 & 3");
Field f2 = ReflectionHelper.findField(PotionHelper.class, "potionAmplifiers", "field_77928_m");
f2.setAccessible(true);
HashMap<Integer, String> potionAmplifiers = (HashMap<Integer, String>) f2.get(null);
potionAmplifiers.put(Potion.jump.getId(), "5");
Field f3 = ReflectionHelper.findField(Potion.class, "liquidColor", "field_76414_N");
f3.setAccessible(true);
f3.set(Potion.jump, 0x22FF4C);
} catch (Exception e) {
}
}
示例3: getItemStackDisplayName
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
@Override
public String getItemStackDisplayName(ItemStack stack) {
if (stack.getItemDamage() == 0)
return StatCollector.translateToLocal("item.emptyPotion.name").trim();
else {
String s = StatCollector.translateToLocal("potion.prefix.lingering").trim() + " ";
List<PotionEffect> list = getEffects(stack);
String s1;
if (list != null && !list.isEmpty()) {
s1 = list.get(0).getEffectName();
s1 = s1 + ".postfix";
return s + StatCollector.translateToLocal(s1).trim();
} else {
s1 = PotionHelper.func_77905_c(stack.getItemDamage());
return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack);
}
}
}
示例4: register
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
/**
* Registers blocks, items, stats, etc.
*/
public static void register()
{
if (!alreadyRegistered)
{
alreadyRegistered = true;
redirectOutputToLog();
SoundEvent.registerSounds();
Block.registerBlocks();
BlockFire.init();
Potion.registerPotions();
Enchantment.registerEnchantments();
Item.registerItems();
PotionType.registerPotionTypes();
PotionHelper.init();
EntityList.init();
StatList.init();
Biome.registerBiomes();
registerDispenserBehaviors();
}
}
示例5: getOutput
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
/**
* Code copied from TileEntityBrewingStand.brewPotions()
* It brews the potion by doing the bit-shifting magic and then checking if the new PotionEffect list is different to the old one,
* or if the new potion is a splash potion when the old one wasn't.
*/
@Override
public ItemStack getOutput(ItemStack input, ItemStack ingredient)
{
if (ingredient != null && input != null && isIngredient(ingredient))
{
ItemStack result = PotionHelper.doReaction(ingredient, input);
if (result != input)
{
return result;
}
return null;
}
return null;
}
示例6: register
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
/**
* Registers blocks, items, stats, etc.
*/
public static void register()
{
if (!alreadyRegistered)
{
alreadyRegistered = true;
if (LOGGER.isDebugEnabled())
{
redirectOutputToLog();
}
SoundEvent.registerSounds();
Block.registerBlocks();
BlockFire.init();
Potion.registerPotions();
Enchantment.registerEnchantments();
Item.registerItems();
PotionType.registerPotionTypes();
PotionHelper.init();
StatList.init();
Biome.registerBiomes();
registerDispenserBehaviors();
net.minecraftforge.fml.common.registry.GameData.vanillaSnapshot();
}
}
示例7: registerPotionTypes
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
@SubscribeEvent
public static void registerPotionTypes(final RegistryEvent.Register<PotionType> event) {
event.getRegistry().registerAll(PURIFICATION_TYPE, RUST_TYPE, BONE_SKIN_TYPE, RECALL_TYPE, BURNING_TYPE, BLEEDING_TYPE,
INFERNO_TYPE);
event.getRegistry().registerAll(HUNGER_TYPE, BLINDNESS_TYPE, NAUSEA_TYPE, RESISTANCE_TYPE, LEVITATION_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, GSItem.TOXIC_SLIME, RUST_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.GOLDEN_KOI.ordinal())), PURIFICATION_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.BONE_FISH.ordinal())), BONE_SKIN_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.SPECULAR_FISH.ordinal())), RECALL_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.MAGMA_JELLYFISH.ordinal())), BURNING_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.PIRANHA.ordinal())), BLEEDING_TYPE);
PotionHelper.addMix(BURNING_TYPE, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.FLAREFIN_KOI.ordinal())), INFERNO_TYPE);
// vanilla potions
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(Items.FISH, 1, 2)), PotionType.getPotionTypeForName("luck"));
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(Items.ROTTEN_FLESH, 1)), HUNGER_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.BLUE_JELLYFISH.ordinal())), NAUSEA_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.SPOOKYFIN.ordinal())), BLINDNESS_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.CAVEFISH.ordinal())), RESISTANCE_TYPE);
PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.CHORUS_KOI.ordinal())), LEVITATION_TYPE);
}
示例8: registerPotion
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public void registerPotion(){
try{
Class potHepler = PotionHelper.class;
Field potFields[] = potHepler.getDeclaredFields();
Field mods;
mods = Field.class.getDeclaredField("modifiers");
mods.setAccessible(true);
for(Field f : potFields){
if(f.getName() == "potionRequirements" || f.getName() == "field_77927_l"){
mods.setInt(f, f.getModifiers() & ~Modifier.FINAL);
f.setAccessible(true);
final HashMap<Integer,String> newReq = (HashMap<Integer,String>)((HashMap<Integer,String>)f.get(null)).clone();
newReq.put(HackeryMod.config.idEffectGlitch, HackeryMod.config.gfPotionReq);
f.set(null, newReq);
}
}
}catch (Exception e){
HackeryMod.logger.error("Something went wrong while registering potions!");
e.printStackTrace();
}
}
示例9: func_77832_l
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public List func_77832_l(ItemStack p_77832_1_) {
if(p_77832_1_.func_77942_o() && p_77832_1_.func_77978_p().func_74764_b("CustomPotionEffects")) {
ArrayList var6 = new ArrayList();
NBTTagList var3 = p_77832_1_.func_77978_p().func_74761_m("CustomPotionEffects");
for(int var4 = 0; var4 < var3.func_74745_c(); ++var4) {
NBTTagCompound var5 = (NBTTagCompound)var3.func_74743_b(var4);
var6.add(PotionEffect.func_82722_b(var5));
}
return var6;
} else {
List var2 = (List)this.field_77836_a.get(Integer.valueOf(p_77832_1_.func_77960_j()));
if(var2 == null) {
var2 = PotionHelper.func_77917_b(p_77832_1_.func_77960_j(), false);
this.field_77836_a.put(Integer.valueOf(p_77832_1_.func_77960_j()), var2);
}
return var2;
}
}
示例10: func_77628_j
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public String func_77628_j(ItemStack p_77628_1_) {
if(p_77628_1_.func_77960_j() == 0) {
return StatCollector.func_74838_a("item.emptyPotion.name").trim();
} else {
String var2 = "";
if(func_77831_g(p_77628_1_.func_77960_j())) {
var2 = StatCollector.func_74838_a("potion.prefix.grenade").trim() + " ";
}
List var3 = Item.field_77726_bs.func_77832_l(p_77628_1_);
String var4;
if(var3 != null && !var3.isEmpty()) {
var4 = ((PotionEffect)var3.get(0)).func_76453_d();
var4 = var4 + ".postfix";
return var2 + StatCollector.func_74838_a(var4).trim();
} else {
var4 = PotionHelper.func_77905_c(p_77628_1_.func_77960_j());
return StatCollector.func_74838_a(var4).trim() + " " + super.func_77628_j(p_77628_1_);
}
}
}
示例11: func_76986_a
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public void func_76986_a(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
Icon var10 = this.field_94151_a.func_77617_a(this.field_94150_f);
if(var10 != null) {
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
GL11.glEnable('\u803a');
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.func_110777_b(p_76986_1_);
Tessellator var11 = Tessellator.field_78398_a;
if(var10 == ItemPotion.func_94589_d("bottle_splash")) {
int var12 = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).func_70196_i(), false);
float var13 = (float)(var12 >> 16 & 255) / 255.0F;
float var14 = (float)(var12 >> 8 & 255) / 255.0F;
float var15 = (float)(var12 & 255) / 255.0F;
GL11.glColor3f(var13, var14, var15);
GL11.glPushMatrix();
this.func_77026_a(var11, ItemPotion.func_94589_d("overlay"));
GL11.glPopMatrix();
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
this.func_77026_a(var11, var10);
GL11.glDisable('\u803a');
GL11.glPopMatrix();
}
}
示例12: convertVanilla
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public static int convertVanilla(int damage) {
final List l = PotionHelper.getPotionEffects(damage, false);
if (l != null && !l.isEmpty()) {
final PotionEffect p = (PotionEffect) l.get(0);
final Potion what = Potion.potionTypes[p.getPotionID()];
if ((what.isInstant() && p.getAmplifier() >= 1)
|| (p.getDuration() >= (int) (9600 * what.getEffectiveness()))) {
for (int i = 0; i < validPotions.size(); ++i) {
if (validPotions.get(i).id == what.id)
return freshEffect(i);
}
}
}
return -1;
}
示例13: doRender
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
@Override
public void doRender(Entity par1, double par2, double par4, double par6, float par8, float par9) {
GL11.glPushMatrix();
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.loadTexture(AmitReference.Sprites.ITEMS_PATH + "thorshammer.png");
Tessellator var10 = Tessellator.instance;
if (this.iconIndex == 154) {
int var11 = PotionHelper.func_77915_a(((EntityPotion) par1).getPotionDamage(), false);
float var12 = (var11 >> 16 & 255) / 255.0F;
float var13 = (var11 >> 8 & 255) / 255.0F;
float var14 = (var11 & 255) / 255.0F;
GL11.glColor3f(var12, var13, var14);
GL11.glPushMatrix();
this.func_77026_a(var10, 141);
GL11.glPopMatrix();
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
this.func_77026_a(var10, this.iconIndex);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例14: getEffects
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public List<PotionEffect> getEffects(ItemStack stack)
{
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9))
{
List<PotionEffect> list1 = Lists.<PotionEffect>newArrayList();
NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
list1.add(potioneffect);
}
}
return list1;
}
else
{
List<PotionEffect> list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata()));
if (list == null)
{
list = PotionHelper.getPotionEffects(stack.getMetadata(), false);
this.effectCache.put(Integer.valueOf(stack.getMetadata()), list);
}
return list;
}
}
示例15: getItemStackDisplayName
import net.minecraft.potion.PotionHelper; //导入依赖的package包/类
public String getItemStackDisplayName(ItemStack stack)
{
if (stack.getMetadata() == 0)
{
return StatCollector.translateToLocal("item.emptyPotion.name").trim();
}
else
{
String s = "";
if (isSplash(stack.getMetadata()))
{
s = StatCollector.translateToLocal("potion.prefix.grenade").trim() + " ";
}
List<PotionEffect> list = Items.potionitem.getEffects(stack);
if (list != null && !list.isEmpty())
{
String s2 = ((PotionEffect)list.get(0)).getEffectName();
s2 = s2 + ".postfix";
return s + StatCollector.translateToLocal(s2).trim();
}
else
{
String s1 = PotionHelper.getPotionPrefix(stack.getMetadata());
return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack);
}
}
}