Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Dahaka написал(а):Охх
Код:private static final ResourceLocation[] RES = new ResourceLocation[] { new ResourceLocation("textures/gui/title/bg.png"), new ResourceLocation("textures/gui/title/bg2.png") } private int time = 0; private int index = 0; @Override public void updateScreen() { if (++time > 20 * 60) t = 0; if (++index >= RES.length) { index = 0; } } } //где используется у тебя используеться mc.getTextureManager().bindTexture, типа того писать mc.getTextureManager().bindTexture(RES[index])
java.lang.ArrayIndexOutOfBoundsException: 3
at com.rcp.rcc.client.gui.MainMenu.renderSkybox(MainMenu.java:482)
at com.rcp.rcc.client.gui.MainMenu.drawScreen(MainMenu.java:499)
Dahaka написал(а):Все должно быть нормально. Видимо ты скопировал до того, как я > заменил на >=
/**
* Called from the main game loop to update the screen.
*/
public static final ResourceLocation[] RES = new ResourceLocation[] {
new ResourceLocation(rcc.modid,"textures/gui/title/bg.jpg"),
new ResourceLocation(rcc.modid,"textures/gui/title/bg2.jpg"),
new ResourceLocation(rcc.modid,"textures/gui/title/bg3.jpg")
};
private int time= 0;
private int index = 0;
@Override
public void updateScreen() {
if (++time > 20 * 60)
time = 0;
if (++index >= RES.length) {
index = 0;
}
System.out.println(time);
}
mc.getTextureManager().bindTexture(RES[index]);
Dahaka написал(а):Куда дальше? Дальше, чем 20*60 оно никак уйти не может. Затем сбрасывается.
В том месте, где ты его выводишь всегда должен быть 0.
Картинка будет меняться ровно тогда, когда время сбрасывается на 0.
Dahaka написал(а):Черт, fps же не 20. наверное, из-за этого. Либо ты как-то через жопу юзаешь код.
Нужно time апать не в этой функции, а в хэндлере TickClientEvent. Или как-то так. Код написать не смогу.
timaxa007 написал(а):http://forum.mcmodding.ru/%D0%A2%D0%B5%D0%BC%D0%B0-%D0%A0%D0%B0%D0%B1%D0%BE%D1%82%D0%B0-%D1%81-%D1%81%D0%BE%D0%B1%D1%8B%D1%82%D0%B8%D1%8F%D0%BC%D0%B8
FMLCommonHandler.instance().bus().register(new EventInit());
@Override
public void updateScreen() {
if (++time > 20 * 60)
time = 0;
if (++index >= RES.length) {
index = 0;
}
System.out.println(time);
}
@SubscribeEvent
public void onClientTickEvent (TickEvent.ClientTickEvent event) {
switch (event.phase) {
case START:{
if (++time > 20 * 60)
time = 0;
if (++index >= RES.length) {
index = 0;
}
System.out.println(time);
break;
}
default:break;
}
}
Работает, но картинка не меняетсяtimaxa007 написал(а):Регистрируешь в главном классе в Init'е на клиетнской стороне:
Где EventInit это твой класс Gui. В классе твоего Gui заменяешь:Код:FMLCommonHandler.instance().bus().register(new EventInit());
наКод:@Override public void updateScreen() { if (++time > 20 * 60) time = 0; if (++index >= RES.length) { index = 0; } System.out.println(time); }
Вроде так.Код:@SubscribeEvent public void onClientTickEvent (TickEvent.ClientTickEvent event) { switch (event.phase) { case START:{ if (++time > 20 * 60) time = 0; if (++index >= RES.length) { index = 0; } System.out.println(time); break; } default:break; } }