23 déc. 2015, 21:01

Ho putain le truc horrible que tu as fait x)
En plus ça ne risque pas du tout de fonctionner car tu utilises la même instance pour tout et en plus qui sort de nul part. En gros là si un joueur bois ça va augmenter le niveau d’alcool de tout le monde …
Voila un truc plus propre :

package com.AltisMine.mod;

import ibxm.Player;

import java.util.List;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.event.entity.player.EntityInteractEvent;

public class AT extends Item
{
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
{
if(entity instanceof EntityPlayer)
{
EntityPlayer target = (EntityPlayer)entity;
if(!stack.hasTagCompound())
{
stack.setTagCompound(new NBTTagCompound());
}
ExtendedEntityPropAlcool prop = ExtendedEntityPropAlcool.get(target);
stack.getTagCompound().setInteger("level", prop.getAlcool());
}
return true;
}

public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if(!stack.hasTagCompound())
{
stack.setTagCompound(new NBTTagCompound());
}
if(stack.getTagCompound().hasKey("level", Constants.NBT.TAG_INT))
{
list.add("le niveau d'alcoolemie de la personne est de : " + stack.getTagCompound().getInteger("level"));
}
else
{
list.add("Faite clic droit sur le joueur pour ");
list.add("obtenir son niveau d'alcoolemie.");
}
}
}

Et du-coup dans tes items comme IMF tu vires ça :
AT alcohol = new AT();
public int Fixlvl = 0;
Et tu définie le niveau d’alcool dans ExtendedEntityPropAlcool