Java 类net.minecraftforge.client.model.obj.OBJModel 实例源码

项目:Qbar    文件:QBarOBJModel.java   
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;
}
项目:Qbar    文件:QBarOBJModel.java   
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;
}
项目:Qbar    文件:QBarOBJModel.java   
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();
    }
}
项目:TechStack-s-HeavyMachineryMod    文件:MachineModModelHelper.java   
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;
    }
项目:Kingdom-Keys-Re-Coded    文件:ModelHelper.java   
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;
    }
项目:Thelta    文件:TileEntityRendererMachineArm.java   
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;
}
项目:TombManyGraves    文件:ModelHelper.java   
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));
    }
}
项目:Qbar    文件:QBarBakedOBJModel.java   
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);
        }
    }
}
项目:Factorization    文件:FactorizationClientProxy.java   
@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;
    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelEternalFlames.java   
public ModelEternalFlames () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/eternalflames.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelBurnout.java   
public ModelBurnout() {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/burnout.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelFerrisWheel.java   
public ModelFerrisWheel () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/ferriswheel.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelSizzlingEdge.java   
public ModelSizzlingEdge () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/sizzlingedge.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelPrometheus.java   
public ModelPrometheus () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/prometheus.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelIfrit.java   
public ModelIfrit () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/ifrit.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelOutbreak.java   
public ModelOutbreak () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/outbreak.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelInferno.java   
public ModelInferno () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/"+ Strings.Inferno+".obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelCombustion.java   
public ModelCombustion () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/combustion.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelMoulinRouge.java   
public ModelMoulinRouge () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/moulinrouge.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelDoledrum.java   
public ModelDoledrum () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/doldrums.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelOmegaTrinity.java   
public ModelOmegaTrinity () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/omegatrinity.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelProminence.java   
public ModelProminence() {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/prominence.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelBlazeofGlory.java   
public ModelBlazeofGlory () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/blazeofglory.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelZephyr.java   
public ModelZephyr () {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/item/zephyr.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {

    }
}
项目:Kingdom-Keys-Re-Coded    文件:ModelPortal.java   
public ModelPortal() {
    try {
        model = (OBJModel) OBJLoader.INSTANCE.loadModel(new ResourceLocation("kk:models/block/portal.obj"));
        modelParts = ModelHelper.getModelsForGroups(model);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:AbyssalCraft    文件:BlockEngraver.java   
@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);
}
项目:TwinTails    文件:ModelBakerTwinTails.java   
@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);
    }
}
项目:ExPetrum    文件:ModelIngot.java   
public ModelIngot(OBJModel model)
{
    this.model = model;
}
项目:ExPetrum    文件:ModelLoaderExP.java   
public IModel loadIngotModel(ResourceLocation modelLocation) throws Exception
{
    return new ModelIngot((OBJModel) OBJLoader.INSTANCE.loadModel(modelLocation));
}
项目:TombManyGraves    文件:ModelHelper.java   
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")));
}
项目:TombManyGraves    文件:ModelHelper.java   
public static IModel retexture(OBJModel model, ImmutableMap<String, String> map)
{
    return (((OBJModel) model.retexture(map)).process(ImmutableMap.of("flip-v","true")));
}
项目:Hard-Science    文件:HSOBJModelWrapper.java   
public HSOBJModelWrapper(OBJModel wrapped)
{
    this.wrapped = wrapped;
}
项目:Hard-Science    文件:HSOBJModelWrapper.java   
public HSOBJModelWrapper(IModel wrapped)
{
    this((OBJModel)wrapped);
}
项目:AbyssalCraft    文件:BlockDecorativeStatue.java   
@Override
public BlockStateContainer createBlockState()
{
    return new BlockStateContainer.Builder(this).add(FACING).add(OBJModel.OBJProperty.INSTANCE).add(TYPE).build();
}
项目:AbyssalCraft    文件:BlockStatue.java   
@Override
public BlockStateContainer createBlockState()
{
    return new BlockStateContainer.Builder(this).add(FACING).add(OBJModel.OBJProperty.INSTANCE).add(TYPE).build();
}
项目:AbyssalCraft    文件:BlockEngraver.java   
@Override
public BlockStateContainer createBlockState()
{
    return new BlockStateContainer.Builder(this).add(FACING).add(OBJModel.OBJProperty.INSTANCE).build();
}