当前位置: 首页>>代码示例>>Java>>正文


Java IModelPart类代码示例

本文整理汇总了Java中net.minecraftforge.common.model.IModelPart的典型用法代码示例。如果您正苦于以下问题:Java IModelPart类的具体用法?Java IModelPart怎么用?Java IModelPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IModelPart类属于net.minecraftforge.common.model包,在下文中一共展示了IModelPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    // TODO make more use of Optional
    if(!part.isPresent())
    {
        if(parent != null)
        {
            return parent.apply(part);
        }
        return Optional.absent();
    }
    if(!(part.get() instanceof NodeJoint))
    {
        return Optional.absent();
    }
    Node<?> node = ((NodeJoint)part.get()).getNode();
    TRSRTransformation nodeTransform;
    if(progress < 1e-5 || frame == nextFrame)
    {
        nodeTransform = getNodeMatrix(node, frame);
    }
    else if(progress > 1 - 1e-5)
    {
        nodeTransform = getNodeMatrix(node, nextFrame);
    }
    else
    {
        nodeTransform = getNodeMatrix(node, frame);
        nodeTransform = nodeTransform.slerp(getNodeMatrix(node, nextFrame), progress);
    }
    if(parent != null && node.getParent() == null)
    {
        return Optional.of(parent.apply(part).or(TRSRTransformation.identity()).compose(nodeTransform));
    }
    return Optional.of(nodeTransform);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:37,代码来源:B3DLoader.java

示例2: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
/**
 * IModelState wrapper for a Clip, sampled at specified time.
 */
public static Pair<IModelState, Iterable<Event>> apply(final IClip clip, final float lastPollTime, final float time)
{
    return Pair.<IModelState, Iterable<Event>>of(new IModelState()
    {
        public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
        {
            if(!part.isPresent() || !(part.get() instanceof IJoint))
            {
                return Optional.absent();
            }
            IJoint joint = (IJoint)part.get();
            // TODO: Cache clip application?
            TRSRTransformation jointTransform = clip.apply(joint).apply(time).compose(joint.getInvBindPose());
            Optional<? extends IJoint> parent = joint.getParent();
            while(parent.isPresent())
            {
                TRSRTransformation parentTransform = clip.apply(parent.get()).apply(time);
                jointTransform = parentTransform.compose(jointTransform);
                parent = parent.get().getParent();
            }
            return Optional.of(jointTransform);
        }
    }, clip.pastEvents(lastPollTime, time));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:28,代码来源:Clips.java

示例3: bake

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
    for(int i = 0; i < textures.size(); i++)
    {
        ResourceLocation tex = textures.get(i);
        if(tex.toString().equals("minecraft:missingno"))
            continue;
        TextureAtlasSprite sprite = bakedTextureGetter.apply(tex);

        String breakLocation = new ResourceLocation(Reference.MOD_ID,"items/breakmask").toString();
        TextureAtlasSprite breakTemplate = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(breakLocation);

        builder.addAll(getQuadsForSprite(i, breakTemplate, sprite, format, transform));
        //builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, NORTH_Z + Z_OFFSET * i, EnumFacing.NORTH, 0xffffffff));
       // builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, SOUTH_Z - Z_OFFSET * i, EnumFacing.SOUTH, 0xffffffff));
    }
    TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
    ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
    return new BakedItemModel(builder.build(), particle, map, null);
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:23,代码来源:ModelToolShardInner.java

示例4: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(final Optional<? extends IModelPart> part)
{
    if (part.isPresent())
    {
        final UnmodifiableIterator<String> parts = Models.getParts(part.get());
        if (parts.hasNext())
        {
            final String name = parts.next();
            if (!parts.hasNext() && this.blacklist && this.parts.contains(name)
                    || !this.blacklist && !this.parts.contains(name))
                return this.value;
        }
    }
    return Optional.empty();
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:17,代码来源:VisibilityModelState.java

示例5: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
      {
          if(part.isPresent())
          {
              // This whole thing is subject to change, but should do for now.
              UnmodifiableIterator<String> parts = Models.getParts(part.get());
              if(parts.hasNext())
              {
                  String name = parts.next();
                  // only interested in the root level
                  if(!parts.hasNext() && hidden.contains(name))
                  {
                      return value;
                  }
              }
          }
          return Optional.absent();
      }
 
开发者ID:Bitterholz,项目名称:LP2,代码行数:20,代码来源:BlockGenericPipe.java

示例6: bake

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
    TRSRTransformation transform = state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity());

    TextureAtlasSprite base = bakedTextureGetter.apply(new ResourceLocation(nbtFood.defualtIcon));
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    ImmutableList.Builder<ResourceLocation> objectBuilder = ImmutableList.builder();
    objectBuilder.add(new ResourceLocation(nbtFood.defualtIcon));
    for (String a : nbtFoodAddivites) {
        try {
            ResourceLocation r = new ResourceLocation(nbtFood.additives.get(a));
            objectBuilder.add(r);
        }
        catch (NullPointerException e) {

        }
    }

    IBakedModel model = new ItemLayerModel(objectBuilder.build()).bake(state, format, bakedTextureGetter);
    builder.addAll(model.getQuads(null, null, 0));

    return new BakedNBTFoodModel(this, builder.build(), base, format, transformMap);
}
 
开发者ID:TeamDmfMM,项目名称:Extra-Food,代码行数:26,代码来源:NBTFoodModel.java

示例7: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    Optional<TRSRTransformation> normal = state.apply(part);
    Optional<TRSRTransformation> multi = state.apply(Optional.of(new PartPart(model, index, part)));
    if(normal.isPresent() && multi.isPresent())
    {
        return Optional.of(normal.get().compose(multi.get()));
    }
    return normal.or(multi);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:MultiModelState.java

示例8: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    Optional<TRSRTransformation> f = first.apply(part), s = second.apply(part);
    if(f.isPresent() && s.isPresent())
    {
        return Optional.of(f.get().compose(s.get()));
    }
    return f.or(s);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:ModelStateComposition.java

示例9: bake

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
public IBakedModel bake(IModelState state, final VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
    for(int i = 0; i < textures.size(); i++)
    {
        TextureAtlasSprite sprite = bakedTextureGetter.apply(textures.get(i));
        builder.addAll(getQuadsForSprite(i, sprite, format, transform));
    }
    TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
    ImmutableMap<TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
    return new BakedItemModel(builder.build(), particle, map, overrides, null);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:ItemLayerModel.java

示例10: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    if(!part.isPresent())
    {
        return def;
    }
    if(!map.containsKey(part.get()))
    {
        return Optional.absent();
    }
    return Optional.fromNullable(map.get(part.get()));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:SimpleModelState.java

示例11: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    Optional<TRSRTransformation> f = first.apply(part), s = second.apply(part);
    if (f.isPresent() && s.isPresent())
        return Optional.of(f.get().compose(s.get()));
    return f.isPresent() ? f : s;
}
 
开发者ID:OPMCorp,项目名称:Qbar,代码行数:8,代码来源:CompositeModelState.java

示例12: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part) {
    if (!part.isPresent() || !(part.get() instanceof TransformType) || !map.containsKey(part.get())) {
        return defaultTransform;
    }
    return Optional.ofNullable(map.get(part.get()));
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:8,代码来源:CCModelState.java

示例13: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part) {
	if (!part.isPresent()) {
		return Optional.absent();
	}
	IModelPart modelPart = part.get();
	if (modelPart instanceof Bone) {
		return getTransformForBone((Bone) modelPart);
	}
	if (modelPart instanceof TransformType) {
		return getTransformForView((TransformType) modelPart);
	}
	return Optional.absent();
}
 
开发者ID:WorldSEnder,项目名称:MCAnm,代码行数:15,代码来源:ModelLoader.java

示例14: load

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public IBakedModel load(final Map<String, Float> key) throws Exception {
	final IModelState clipTransform = part -> {
		if (!part.isPresent()) return Optional.empty();

		final IModelPart maybeJoint = part.get();
		if (!(maybeJoint instanceof IJoint)) return Optional.empty();

		final IJoint joint = (IJoint)part.get();
		return Optional.of(evaluator.evaluate(joint, key));
	};
	return bakeModelWithTransform(clipTransform);
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:14,代码来源:BakedEvalModel.java

示例15: apply

import net.minecraftforge.common.model.IModelPart; //导入依赖的package包/类
@Override
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
    if (parent != null) return parent.apply(part);
    return Optional.empty();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:7,代码来源:TintedOBJModel.java


注:本文中的net.minecraftforge.common.model.IModelPart类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。