本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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()));
}
示例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;
}
示例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()));
}
示例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();
}
示例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);
}
示例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();
}