public ResourceLocation getResourceLocation() { try { if (f_modelLocation == null) { f_modelLocation = OBJModel.class.getDeclaredField("modelLocation"); f_modelLocation.setAccessible(true); } if (f_modelLocation != null) return (ResourceLocation) f_modelLocation.get(this); } catch (Exception e) { e.printStackTrace(); } return null; }
public Object getCustomData() { try { if (f_customData == null) { f_customData = OBJModel.class.getDeclaredField("customData"); f_customData.setAccessible(true); } if (f_customData != null) return f_customData.get(this); } catch (Exception e) { e.printStackTrace(); } return null; }
public void setCustomData(Object data) { try { if (f_customData == null) { f_customData = OBJModel.class.getDeclaredField("customData"); f_customData.setAccessible(true); } if (f_customData != null) f_customData.set(this, data); } catch (Exception e) { e.printStackTrace(); } }
public static HashMap<String, IBakedModel> getModelsForGroups(OBJModel objModel) { HashMap<String, IBakedModel> modelParts = new HashMap<String, IBakedModel>(); if (!objModel.getMatLib().getGroups().keySet().isEmpty()) { for (String key : objModel.getMatLib().getGroups().keySet()) { String k = key; if (!modelParts.containsKey(key)) { // public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) modelParts.put(k, objModel.bake(new OBJModel.OBJState(ImmutableList.of(k), false), MYFORMAT, textureGetterFlipV)); // can use a list strings as a OBJModel.OBJState Turning those group objects on or off accordngly } } } modelParts.put(ALL_PARTS, objModel.bake(objModel.getDefaultState(), MYFORMAT, textureGetterFlipV)); return modelParts; }
public static HashMap<String, IBakedModel> getModelsForGroups (OBJModel objModel) { HashMap<String, IBakedModel> modelParts = new HashMap<String, IBakedModel>(); if (!objModel.getMatLib().getGroups().keySet().isEmpty()) { for (String key : objModel.getMatLib().getGroups().keySet()) { if (!modelParts.containsKey(key)) { modelParts.put(key, objModel.bake(new OBJModel.OBJState(ImmutableList.of(key), false), Attributes.DEFAULT_BAKED_FORMAT, ModelHelper.textureGetterFlipV)); } } } modelParts.put(ALL_PARTS, objModel.bake(objModel.getDefaultState(), Attributes.DEFAULT_BAKED_FORMAT, textureGetterFlipV)); return modelParts; }
public IBakedModel loadModel(String modelname) { IBakedModel ret = null; try { ret = bake((OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation(Thelta.MODID, modelname))); } catch (Exception e) { e.printStackTrace(); } return ret; }
public static OBJModel loadModel(String suffix){ OBJModel model; try { model = ((OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("tombmanygraves:models/block/" + suffix + ".obj"))); return model; } catch (Exception e) { throw new ReportedException(new CrashReport("Error making the model for " + suffix + "!", e)); } }
private final void putVertexData(UnpackedBakedQuad.Builder builder, OBJModel.Vertex v, OBJModel.Normal faceNormal, OBJModel.TextureCoordinate defUV, TextureAtlasSprite sprite) { for (int e = 0; e < format.getElementCount(); e++) { switch (format.getElement(e).getUsage()) { case POSITION: builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, v.getPos().w); break; case COLOR: if (v.getMaterial() != null) builder.put(e, v.getMaterial().getColor().x, v.getMaterial().getColor().y, v.getMaterial().getColor().z, v.getMaterial().getColor().w); else builder.put(e, 1, 1, 1, 1); break; case UV: if (!v.hasTextureCoordinate()) builder.put(e, sprite.getInterpolatedU(defUV.u * 16), sprite.getInterpolatedV((1 - defUV.v) * 16), 0, 1); else builder.put(e, sprite.getInterpolatedU(v.getTextureCoordinate().u * 16), sprite.getInterpolatedV((1 - v.getTextureCoordinate().v) * 16), 0, 1); break; case NORMAL: if (!v.hasNormal()) builder.put(e, faceNormal.x, faceNormal.y, faceNormal.z, 0); else builder.put(e, v.getNormal().x, v.getNormal().y, v.getNormal().z, 0); break; default: builder.put(e); } } }
@Override public IModel loadModel(ResourceLocation modelLocation) throws IOException { IModel model = super.loadModel(modelLocation); if (model instanceof OBJModel) { ImmutableMap<String, String> flip = new ImmutableMap.Builder<String, String>().put("flip-v", "true").build(); return ((OBJModel) model).process(flip); } else { return model; } }
public ModelEternalFlames () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/eternalflames.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelBurnout() { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/burnout.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelFerrisWheel () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/ferriswheel.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelSizzlingEdge () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/sizzlingedge.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelPrometheus () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/prometheus.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelIfrit () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/ifrit.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelOutbreak () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/outbreak.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelInferno () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/"+ Strings.Inferno+".obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelCombustion () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/combustion.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelMoulinRouge () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/moulinrouge.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelDoledrum () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/doldrums.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelOmegaTrinity () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/omegatrinity.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelProminence() { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/prominence.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelBlazeofGlory () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/blazeofglory.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelZephyr () { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/zephyr.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { } }
public ModelPortal() { try { model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/block/portal.obj")); modelParts = ModelHelper.getModelsForGroups(model); } catch (Exception e) { e.printStackTrace(); } }
@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { EnumFacing facing = state.getValue(FACING); TRSRTransformation transform = new TRSRTransformation(facing); OBJModel.OBJState retState = new OBJModel.OBJState(Arrays.asList(new String[]{OBJModel.Group.ALL}), true, transform); return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.INSTANCE, retState); }
@SubscribeEvent public void onModelBake(ModelBakeEvent event) { for (final TwinTailType type : ItemHairBand.twinTailTypes) { IModel model = getModel(new ResourceLocation("twintails:twintails_" + type.getName() + ".obj")); if (model instanceof OBJModel) model = ((OBJModel) model).process(ImmutableMap.of("flip-v", "true")); IBakedModel bakedModel = BakerUtil.bake(model, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL, textures); type.getModel().setModel(bakedModel); } }
public ModelIngot(OBJModel model) { this.model = model; }
public IModel loadIngotModel(ResourceLocation modelLocation) throws Exception { return new ModelIngot((OBJModel) OBJLoader.INSTANCE.loadModel(modelLocation)); }
public static IModel retexture(OBJModel model, String toReplace, String suffix) { return (((OBJModel) model.retexture(ImmutableMap.of(toReplace, "tombmanygraves:blocks/" + suffix))).process(ImmutableMap.of("flip-v","true"))); }
public static IModel retexture(OBJModel model, ImmutableMap<String, String> map) { return (((OBJModel) model.retexture(map)).process(ImmutableMap.of("flip-v","true"))); }
public HSOBJModelWrapper(OBJModel wrapped) { this.wrapped = wrapped; }
public HSOBJModelWrapper(IModel wrapped) { this((OBJModel)wrapped); }
@Override public BlockStateContainer createBlockState() { return new BlockStateContainer.Builder(this).add(FACING).add(OBJModel.OBJProperty.INSTANCE).add(TYPE).build(); }
@Override public BlockStateContainer createBlockState() { return new BlockStateContainer.Builder(this).add(FACING).add(OBJModel.OBJProperty.INSTANCE).build(); }