mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Add a debug key for reloading models
This commit is contained in:
parent
fb78e806ea
commit
c6be9e5088
3 changed files with 48 additions and 3 deletions
|
@ -16,6 +16,11 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
|||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.data.MetadataSerializer;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
@ -43,6 +48,9 @@ public class MineLittlePony {
|
|||
|
||||
private final PonyRenderManager renderManager;
|
||||
|
||||
private static int modelUpdateCounter = 0;
|
||||
private static boolean reloadingModels = false;
|
||||
|
||||
MineLittlePony() {
|
||||
instance = this;
|
||||
|
||||
|
@ -87,8 +95,29 @@ public class MineLittlePony {
|
|||
}
|
||||
|
||||
void onTick(Minecraft minecraft, boolean inGame) {
|
||||
if (inGame && minecraft.currentScreen == null && SETTINGS_GUI.isPressed()) {
|
||||
minecraft.displayGuiScreen(new GuiPonySettings());
|
||||
if (inGame && minecraft.currentScreen == null) {
|
||||
if (SETTINGS_GUI.isPressed()) {
|
||||
minecraft.displayGuiScreen(new GuiPonySettings());
|
||||
} else {
|
||||
|
||||
if ((Minecraft.getSystemTime() % 10) == 0) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_F3) && Keyboard.isKeyDown(Keyboard.KEY_M)) {
|
||||
if (!reloadingModels) {
|
||||
minecraft.ingameGUI.getChatGUI().printChatMessage(
|
||||
(new TextComponentString("")).appendSibling(
|
||||
new TextComponentTranslation("debug.prefix")
|
||||
.setStyle(new Style().setColor(TextFormatting.YELLOW).setBold(true)))
|
||||
.appendText(" ")
|
||||
.appendSibling(new TextComponentTranslation("minelp.debug.reload_models.message")));
|
||||
|
||||
reloadingModels = true;
|
||||
modelUpdateCounter++;
|
||||
}
|
||||
} else {
|
||||
reloadingModels = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PonySkullRenderer.resolve();
|
||||
|
@ -115,6 +144,10 @@ public class MineLittlePony {
|
|||
return renderManager;
|
||||
}
|
||||
|
||||
public static int getModelRevisionNumber() {
|
||||
return modelUpdateCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the global MineLP client configuration.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmor;
|
||||
import com.minelittlepony.model.armour.PonyArmor;
|
||||
import com.minelittlepony.model.capabilities.IModelWrapper;
|
||||
|
@ -13,6 +14,8 @@ public class ModelWrapper implements IModelWrapper {
|
|||
private final AbstractPonyModel body;
|
||||
private final PonyArmor armor;
|
||||
|
||||
private int lastModelUpdate = 0;
|
||||
|
||||
/**
|
||||
* Creates a new model wrapper to contain the given pony.
|
||||
*/
|
||||
|
@ -41,6 +44,13 @@ public class ModelWrapper implements IModelWrapper {
|
|||
|
||||
@Override
|
||||
public void apply(IPonyData meta) {
|
||||
int modelRevision = MineLittlePony.getModelRevisionNumber();
|
||||
|
||||
if (modelRevision != lastModelUpdate) {
|
||||
lastModelUpdate = modelRevision;
|
||||
init();
|
||||
}
|
||||
|
||||
body.metadata = meta;
|
||||
armor.apply(meta);
|
||||
}
|
||||
|
|
|
@ -23,3 +23,5 @@ minelp.mobs.endermen=Ponify endermen
|
|||
|
||||
minelp.mode.dry=Land pony
|
||||
minelp.mode.wet=Sea pony
|
||||
|
||||
minelp.debug.reload_models.message=Reloading pony models...
|
Loading…
Reference in a new issue