- 1,031
- 19
- 87
Доброго времени суток. При клике ПКМ предмет на мгновение замещается на 8 единиц нужного, но потом уменьшается до 1-го. Либо удалить предмет и выдать 8 чего-то там, либо таки заменить предмет на 8 чего-то там. Подскажите плеасэ.
Для прояснения, такая запись тоже заменяет предмет, но 1 единицу чего-то там:
Код:
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack itemstack = new ItemStack(ItemsInit.INACTIVE_ENDER_PEARL_SHARD, 8);
if(!world.isRemote) {
player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 100, 0));
}
else {
world.playSound(player.posX, player.posY, player.posZ, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.PLAYERS, 1.0F, 1.0F, false);
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
}
Код:
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
if(!world.isRemote) {
player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 100, 0));
}
else {
world.playSound(player.posX, player.posY, player.posZ, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.PLAYERS, 1.0F, 1.0F, false);
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, new ItemStack(ItemsInit.INACTIVE_ENDER_PEARL_SHARD, 8));
}
Последнее редактирование: