Bon j’ai du bidouiller mais problème résolu je vous poste quand même le code si ça intéresse quelqu’un :
public class SyncFood implements IMessage{
ItemStack stack;
int slot;
public SyncFood() {}
public SyncFood(ItemStack stack, int slot) {
this.stack = stack;
this.slot = slot;
}
@Override
public void fromBytes(ByteBuf buf) {
this.stack = ByteBufUtils.readItemStack(buf);
this.slot = ByteBufUtils.readVarInt(buf, 5);
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeItemStack(buf, this.stack);
ByteBufUtils.writeVarInt(buf, this.slot, 5);
}
public static class Handler implements IMessageHandler<syncfood, imessage="">{
@Override
public IMessage onMessage(SyncFood message, MessageContext ctx) {
Minecraft.getMinecraft().thePlayer.inventory.setInventorySlotContents(message.slot, message.stack);
return null;
}
}
}
public class ItemsFoodHeimnor extends ItemFood {
public ItemsFoodHeimnor(int gigot, float saturation, boolean wolf) {
super(gigot, saturation, wolf);
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
stack.stackSize–;
return stack;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity player, int slotID, boolean p_77663_5_) {
if (player instanceof EntityPlayer) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
if (!world.isRemote) {
if (!stack.getTagCompound().hasKey("quality")) {
int result = FichesFonc.throwOneComp((EntityPlayer) player, "Cuisine",
FichesFonc.getCuisine((EntityPlayer) player), world);
System.out.println("Jet de dés :" + result);
int i = 5;
if (result == 1) {
i = 0;
} else if (result > 1 && result <= 10) {
i = 1;
} else if (result > 10 && result < 20) {
i = 2;
} else if (result == 20) {
i = 3;
}
String[] table = { "Même un lainard n'oserait pas y toucher ...", "Mouais ... ça se mange.",
"Bien ! Ça ne doit pas être mauvais.", "Parfait !" };
String stringNBT = table*;
if (stack.hasTagCompound()) {
stack.getTagCompound().setString("quality", stringNBT);
System.out.println("stack server : " + stack);
Heimnor.network.sendTo(new SyncFood(stack, slotID), (EntityPlayerMP) player);
System.out.println(stack.getTagCompound().getString("quality"));
}
((EntityPlayer) player).inventory.setInventorySlotContents(slotID, stack);
}
}
}
}
}
```</syncfood,>