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


Java IModelState类代码示例

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


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

示例1: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
    builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
    TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
    for (Map.Entry<String, Material> e : matLib.materials.entrySet())
    {
        if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#"))
        {
            FMLLog.log.fatal("OBJLoader: Unresolved texture '{}' for obj model '{}'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation);
            builder.put(e.getKey(), missing);
        }
        else
        {
            builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue().getTexture().getTextureLocation()));
        }
    }
    builder.put("missingno", missing);
    return new TintedOBJBakedModel(this, state, format, builder.build());
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:TintedOBJModel.java

示例2: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
    TextureAtlasSprite widgetSprite = bakedTextureGetter.apply(getWidgetTexture(widget));
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    int width = widget.getWidth() + (widget.getParameters() != null && widget.getParameters().length > 0 ? 10 : 0);
    int height = widget.getHeight() + (widget.hasStepOutput() ? 5 : 0);

    Pair<Double, Double> maxUV = widget.getMaxUV();
    int textureSize = widget.getTextureSize();
    float scale = 1F / (float) Math.max(maxUV.getLeft(), maxUV.getRight());
    float transX = 0;//maxUV.getLeft().floatValue();
    float transY = -1 + maxUV.getRight().floatValue();
    transform = transform.compose(new TRSRTransformation(new Vector3f(0, 0, 0), null, new Vector3f(scale, scale, 1), null));
    transform = transform.compose(new TRSRTransformation(new Vector3f(transX, transY, 0), null, new Vector3f(1, 1, 1), null));

    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), NORTH_Z_BASE, widgetSprite, EnumFacing.NORTH, 0xffffffff));
    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), SOUTH_Z_BASE, widgetSprite, EnumFacing.SOUTH, 0xffffffff));

    return new BakedProgrammingPuzzle(this, builder.build(), widgetSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap());
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:26,代码来源:ModelProgrammingPuzzle.java

示例3: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
    TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
    for(Map.Entry<String, ResourceLocation> e : textures.entrySet())
    {
        if(e.getValue().getResourcePath().startsWith("#"))
        {
            FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), modelLocation);
            builder.put(e.getKey(), missing);
        }
        else
        {
            builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue()));
        }
    }
    builder.put("missingno", missing);
    return new BakedWrapper(model.getRoot(), state, smooth, gui3d, format, meshes, builder.build());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:B3DLoader.java

示例4: apply

import net.minecraftforge.common.model.IModelState; //导入依赖的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

示例5: getQuads

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand)
{
    if (side != null) return ImmutableList.of();
    if (quads == null)
    {
        quads = buildQuads(this.state);
    }
    if (blockState instanceof IExtendedBlockState)
    {
        IExtendedBlockState exState = (IExtendedBlockState) blockState;
        if (exState.getUnlistedNames().contains(Properties.AnimationProperty))
        {

            IModelState newState = exState.getValue(Properties.AnimationProperty);
            if (newState != null)
            {
                newState = new ModelStateComposition(this.state, newState);
                return buildQuads(newState);
            }
        }
    }
    return quads;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:OBJModel.java

示例6: BakedWrapper

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
public BakedWrapper(final Node<?> node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
{
    this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder()
        .maximumSize(128)
        .expireAfterAccess(2, TimeUnit.MINUTES)
        .<Integer, B3DState>build(new CacheLoader<Integer, B3DState>()
        {
            public B3DState load(Integer frame) throws Exception
            {
                IModelState parent = state;
                Animation newAnimation = node.getAnimation();
                if(parent instanceof B3DState)
                {
                    B3DState ps = (B3DState)parent;
                    parent = ps.getParent();
                }
                return new B3DState(newAnimation, frame, frame, 0, parent);
            }
        }));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:B3DLoader.java

示例7: getParent

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Nullable
public IModelState getParent(IModelState parent)
{
    if (parent == null) return null;
    else if (parent instanceof OBJState) return ((OBJState) parent).parent;
    return parent;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:TintedOBJModel.java

示例8: TintedOBJBakedModel

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
public TintedOBJBakedModel(TintedOBJModel model, IModelState state, VertexFormat format, ImmutableMap<String, TextureAtlasSprite> textures)
{
    this.model = model;
    this.state = state;
    if (this.state instanceof OBJState) this.updateStateVisibilityMap((OBJState) this.state);
    this.format = format;
    this.textures = textures;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:TintedOBJModel.java

示例9: ModelHandle

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
private ModelHandle(ModelHandle handle, IModelState state)
{
    this.model = handle.model;
    this.vertexFormat = handle.vertexFormat;
    this.state = state;
    this.uvLock = handle.uvLock;
    textureReplacements.putAll(handle.textureReplacements);
    this.key = computeKey();
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:10,代码来源:ModelHandle.java

示例10: loadModel

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
private static IBakedModel loadModel(ModelHandle handle)
{
    IBakedModel model = loadedModels.get(handle.getKey());
    if (model != null)
        return model;

    try
    {
        IModel mod = ModelLoaderRegistry.getModel(handle.getModel());
        if (handle.getTextureReplacements().size() > 0)
        {
            mod = mod.retexture(ImmutableMap.copyOf(handle.getTextureReplacements()));
        }
        if (handle.uvLocked())
        {
            mod = mod.uvlock(true);
        }
        IModelState state = handle.getState();
        if (state == null) state = mod.getDefaultState();
        model = mod.bake(state, handle.getVertexFormat(), ModelLoader.defaultTextureGetter());
        loadedModels.put(handle.getKey(), model);
        return model;
    }
    catch (Exception e)
    {
        throw new ReportedException(new CrashReport("Error loading custom model " + handle.getModel(), e));
    }
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:29,代码来源:ModelHandle.java

示例11: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
	IBakedModel[] connections = new IBakedModel[6];
	IBakedModel[] endings = new IBakedModel[6];
	IBakedModel[] nodeSides = new IBakedModel[6];
	//IBakedModel node = null;

	// d u n s w e
	ModelRotation[] rotations = new ModelRotation[] { ModelRotation.X90_Y0, ModelRotation.X270_Y0,
			ModelRotation.X0_Y0, ModelRotation.X0_Y180, ModelRotation.X0_Y270, ModelRotation.X0_Y90 };

	try {
		IModel nodeSideModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_node_side"));
		IModel connectionModel = ModelLoaderRegistry
				.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_connection"));
		IModel endingModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_end"));

		//node = nodeModel.bake(new TRSRTransformation(ModelRotation.X0_Y0), DefaultVertexFormats.BLOCK,
		//		ModelLoader.defaultTextureGetter());
		for (int i = 0; i < connections.length; i++) {
			connections[i] = connectionModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
			endings[i] = endingModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
			nodeSides[i] = nodeSideModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK,
					ModelLoader.defaultTextureGetter());
		}
	} catch (Exception e) {
		Etheric.logger.warn(e.getMessage());
	}

	if (connections[0] == null) {
		return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
	}
	return new BakedPipeModel(nodeSides, connections, endings);
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:38,代码来源:PipeModel.java

示例12: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
public Map<ResourceLocation, IBakedModel> bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) throws Exception
{
    Map<ResourceLocation, IBakedModel> ret = Maps.newHashMap();

    for (TransportableChest chest : ChestRegistry.getChests())
    {
        for (ResourceLocation location : chest.getChestModels())
        {
            IModel model = ModelLoaderRegistry.getModel(location);
            ret.put(location, model.bake(state, format, bakedTextureGetter));
        }
    }

    return ret;
}
 
开发者ID:cubex2,项目名称:chesttransporter,代码行数:16,代码来源:ModelRegistry.java

示例13: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

	ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

	TRSRTransformation transform = (TRSRTransformation.identity());

	ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

	if (headTexture != null && haftTexture != null && handleTexture != null) {
		
		ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
		if (haftTexture != null) {
			texBuilder.add(haftTexture);
		}
		if (headTexture != null) {
			texBuilder.add(headTexture);
		}
		if (handleTexture != null) {
			texBuilder.add(handleTexture);
		}
		if (adornmentTexture != null) {
			texBuilder.add(adornmentTexture);
		}
		ImmutableList<ResourceLocation> textures = texBuilder.build();
		
		IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
		builder.addAll(model.getQuads(null, null, 0));
	}

	return new BakedMaceModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:MaceModel.java

示例14: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

	ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

	TRSRTransformation transform = (TRSRTransformation.identity());

	ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

	if (bladeTexture != null && handleTexture != null) {
		
		ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
		if (bladeTexture != null) {
			texBuilder.add(bladeTexture);
		}
		if (handleTexture != null) {
			texBuilder.add(handleTexture);
		}
		if (adornmentTexture != null) {
			texBuilder.add(adornmentTexture);
		}
		ImmutableList<ResourceLocation> textures = texBuilder.build();
		
		IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
		builder.addAll(model.getQuads(null, null, 0));
	}

	return new BakedDaggerModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:32,代码来源:DaggerModel.java

示例15: bake

import net.minecraftforge.common.model.IModelState; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

	ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

	TRSRTransformation transform = (TRSRTransformation.identity());

	ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

	if (headTexture != null && haftTexture != null && handleTexture != null) {
		
		ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
		if (haftTexture != null) {
			texBuilder.add(haftTexture);
		}
		if (headTexture != null) {
			texBuilder.add(headTexture);
		}
		if (handleTexture != null) {
			texBuilder.add(handleTexture);
		}
		if (adornmentTexture != null) {
			texBuilder.add(adornmentTexture);
		}
		ImmutableList<ResourceLocation> textures = texBuilder.build();
		
		IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
		builder.addAll(model.getQuads(null, null, 0));
	}

	return new BakedHoeModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:HoeModel.java


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