@SideOnly(Side.CLIENT)
public int getStatusIconIndex() {
Minecraft.getMinecraft().renderEngine.bindTexture(icons);
return super.getStatusIconIndex();
Написано про поле с иконками 256на256 и размер иконок 18на18, а у тебя 16 на 16, возможно проблема в этом, но могу ошибатьсяНемного про иконки:
Мне никогда не нравилась эта система индексирования, но вкратце, у вас есть [неограниченное] поле размером 256x256, в котором вы можете размещать иконки зелий 18x18 в строгом порядке, после чего майнкрафт сам будет получать нужную область картинки. Верхняя левая картинка - 0, правее - 1, ещё правее - 2 и так далее. Ряд состоит из 8 картинок, после чего происходит смещение вниз. "Шаблон" такого поля можно найти в папке с текстурами по пути \assets\minecraft\textures\gui\container\inventory.png
Если для вас это слишком сложно, используйте метод renderInventoryEffect, предоставляемый форджем.
private static final ResourceLocation icons = new ResourceLocation(ModID, "textures/effects/icons.png");
[17:30:17] [main/INFO]: Setting user: Player676
[17:30:22] [Client thread/INFO]: LWJGL Version: 2.9.1
[17:30:49] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:BERZIK CORE
[17:30:50] [Sound Library Loader/INFO]: Sound engine started
[17:30:58] [Client thread/INFO]: Created: 16x16 textures/blocks-atlas
[17:30:58] [Client thread/INFO]: Created: 16x16 textures/items-atlas
[17:30:58] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:BERZIK CORE
[17:30:59] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[17:30:59] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[17:31:00] [Sound Library Loader/INFO]: Sound engine started
[17:31:16] [Client thread/INFO]: Stopping!
public class PotionMod extends Potion {
private static final ResourceLocation icons = new ResourceLocation("berzik:textures/effects/icons.png");
public PotionMod(int id, String name, boolean badEffect, int color, int iconIndex) {
super(id, badEffect, color);
setPotionName("berzik." + name);
setIconIndex(iconIndex % 8, iconIndex / 8);
}
@Override
@SideOnly(Side.CLIENT)
public int getStatusIconIndex() {
Minecraft.getMinecraft().renderEngine.bindTexture(icons);
return super.getStatusIconIndex();
}
}
public class PotionClimbing extends PotionMod {
public PotionClimbing() {
super(40, "Climbing", false, 0xFFFFEE, 2);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent e) {
if (e.entityLiving instanceof EntityPlayer) {
if (e.entityLiving.getActivePotionEffect(this) != null && e.entityLiving.getActivePotionEffect(this).getDuration() > 0) {
{
e.entityLiving.fallDistance = 1.0F;
}
EntityClientPlayerMP var3 = Minecraft.getMinecraft().thePlayer;
if (var3.isCollidedHorizontally)
{
var3.motionY = 0.25D;
}
boolean var71 = var3.isSneaking() && var3 instanceof EntityPlayer && var3.isCollidedHorizontally;
if (var71)
{
var3.motionY = 0.0D;
}
} else {
}
}
}
}
private static final ResourceLocation icons = new ResourceLocation("berzik", "textures/effects/icons.png");