use of net.silentchaos512.gems.api.lib.ToolPartPosition in project SilentGems by SilentChaos512.
the class ToolPartTipGems method getModel.
@Override
public ModelResourceLocation getModel(ItemStack tool, ToolPartPosition pos, int frame) {
String name = ((IRegistryObject) tool.getItem()).getName();
name = SilentGems.MODID + ":" + name.toLowerCase() + "/" + name + "_" + tipName + (frame == 3 ? "_3" : "");
if (modelMap.containsKey(name)) {
return modelMap.get(name);
}
name = name.toLowerCase();
ModelResourceLocation model = new ModelResourceLocation(name, "inventory");
modelMap.put(name, model);
return model;
}
use of net.silentchaos512.gems.api.lib.ToolPartPosition in project SilentGems by SilentChaos512.
the class ToolModel method getQuads.
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
LogHelper log = SilentGems.logHelper;
if (tool == null) {
return new ArrayList<BakedQuad>();
}
if (modelManager == null) {
modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager();
}
List<BakedQuad> quads = Lists.newArrayList();
ModelResourceLocation location;
IBakedModel model;
IBakedModel rodModel = null;
Item item = tool.getItem();
// Invalid tools models.
if (ToolHelper.getMaxDamage(tool) <= 0 && tool.getItem() instanceof IRegistryObject) {
String name = ((IRegistryObject) tool.getItem()).getName();
location = new ModelResourceLocation(SilentGems.MODID + ":" + name.toLowerCase() + "/_error", "inventory");
model = modelManager.getModel(location);
if (model != null) {
quads.addAll(model.getQuads(state, side, rand));
}
return quads;
}
for (ToolPartPosition partPos : ToolPartPosition.values()) {
// Scepter rods on top of head.
if (tool.getItem() instanceof ItemGemScepter) {
if (partPos == ToolPartPosition.ROD) {
location = ToolRenderHelper.getInstance().getModel(tool, partPos);
rodModel = modelManager.getModel(location);
continue;
} else if (partPos == ToolPartPosition.ROD_DECO) {
quads.addAll(rodModel.getQuads(state, side, rand));
}
}
// Normal logic.
location = ToolRenderHelper.getInstance().getModel(tool, partPos);
// debug += partPos + ": " + (location == null ? "null" : location.toString()) + "\n";
if (location != null) {
model = modelManager.getModel(location);
if (model != null) {
quads.addAll(model.getQuads(state, side, rand));
}
}
}
if (ModuleAprilTricks.instance.isEnabled() && ModuleAprilTricks.instance.isRightDay()) {
model = modelManager.getModel(ToolRenderHelper.getInstance().modelGooglyEyes);
quads.addAll(model.getQuads(state, side, rand));
}
return quads;
}
Aggregations