Simple way you can view any model in the cache.
might wanna center the models better, just made this quick to show the concept.
use command
::viewmodel type id
::viewmodel id (view model from index1)
::viewmodel -1 (resets interface)
type represents which type of model it is (such as an item model, npc model, player model or any model)
id represents a fileid in index1 of the cache if its type 1, or the entity id if its 2 or 4. type 3 ignores it.
- type 1 = any model
- type 2 = npc
- type 3 = player head
- type 4 item
Code:
public static void modelViewer(int interfaceId, int modelType, int entityId) {
Widget widget = Widget.addInterface(interfaceId);
Widget rsi = Widget.addTabInterface(interfaceId + 1);
rsi.id = interfaceId;
rsi.parent = interfaceId;
rsi.type = 6;
rsi.optionType = 0;
rsi.contentType = 329;
rsi.width = 136;
rsi.height = 168;
rsi.opacity = 0;
rsi.mOverInterToTrigger = 0;
rsi.modelZoom = 560;
rsi.modelRotationY = 150;
rsi.modelRotationX = 0;
rsi.defaultAnimationId = -1;
rsi.secondaryAnimationId = -1;
rsi.modelType = modelType;
rsi.modelFileId = entityId;
widget.totalChildren(1);
widget.child(0, interfaceId + 1, 190, 150);
}
Code:
if (index == 329) {
try {
Model model = null;
int rotationOffsetY = 0;
if (widget.modelType == 1) {
model = Model.getModel(widget.modelFileId);
rotationOffsetY = 150;
} else if (widget.modelType == 2) {
// this will get the full npc model
NpcDefinition npc = NpcDefinition.lookup(widget.modelFileId);
model = npc.getAnimatedModel(-1, -1, null);
// to only get the head you would use
//Widget.getModel(2, widget.modelFileId);
rotationOffsetY = 200;
} else if (widget.modelType == 3) {
model = Widget.getModel(3, widget.modelFileId);
} else if (widget.modelType == 4) {
model = Widget.getModel(4, widget.modelFileId);
rotationOffsetY = 400;
widget.modelZoom = 350;
}
widget.modelRotationY = rotationOffsetY;
widget.modelRotationX = ((int) (Math.sin((double) tick / 40D) * 256D) & 0x7ff);
if (model == null) {
return;
}
model.skin();
model.scale2(1);
widget.defaultMediaType = 5;
//widget.defaultMedia = 0;
Widget.method208(false, model);
} catch (Exception ex) {
ex.printStackTrace();
}
return;
}
Code:
if (inputString.startsWith("::viewmodel")) {
try {
/*
* type 1 = any model
* type 2 = npc
* type 3 = player head
* type 4 item
*/
String[] split = inputString.split(" ");
int interfaceId = 37990;
if (split.length == 3) {
int type = Integer.parseInt(split[1]);
int id = Integer.parseInt(split[2]);
if (id <= -1 || (type < 1 || type > 4)) {
interfaceId = -1;
}
Widget.modelViewer(37990, type, id);
} else if (split.length == 2) {
int id = Integer.parseInt(split[1]);
if (id <= -1) {
interfaceId = -1;
}
Widget.modelViewer(37990, 1, id);
} else if (split.length == 1) {
Widget.modelViewer(37990, 0, 0);
}
if (interfaceId == -1) {
clearScreen();
} else {
showInterface(37990);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
Result