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


Java ItemLayerModel类代码示例

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


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

示例1: bake

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

示例2: bake

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

示例3: bake

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

示例4: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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 BakedPickaxeModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:PickaxeModel.java

示例5: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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 BakedAxeModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:AxeModel.java

示例6: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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 BakedHammerModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:HammerModel.java

示例7: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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 BakedShovelModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:ShovelModel.java

示例8: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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();
	ImmutableList<ResourceLocation> textures = ImmutableList.<ResourceLocation>of(new ResourceLocation(modid, "items/" + toolName + "/" + partName + "_" + matName));
	builder.addAll(new ItemLayerModel(textures).bake(state, format, bakedTextureGetter).getQuads(null, null, 0));
	return new BakedToolHeadModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:15,代码来源:ToolHeadModel.java

示例9: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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 && crossguardTexture != null && handleTexture != null) {
		
		ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
		if (bladeTexture != null) {
			texBuilder.add(bladeTexture);
		}
		if (handleTexture != null) {
			texBuilder.add(handleTexture);
		}
		if (crossguardTexture != null) {
			texBuilder.add(crossguardTexture);
		}
		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 BakedSwordModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:SwordModel.java

示例10: onModelBake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent event)
{
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    builder.addAll(ItemLayerModel.getQuadsForSprite(0, txInstrument, DefaultVertexFormats.ITEM, Optional.empty()));
    event.getModelRegistry().putObject(new ModelResourceLocation("clef:instrument", "inventory"), new BakedModelInstrument(builder.build(), txInstrument, ImmutableMap.copyOf(new HashMap<>()), null, null));
}
 
开发者ID:iChun,项目名称:Clef,代码行数:8,代码来源:EventHandlerClient.java

示例11: loadTexture

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的package包/类
@Override
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), image, false, false);

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    tasi = new TextureAtlasSpriteBufferedImage(this.rl, this.image);
    tasi.load(Minecraft.getMinecraft().getResourceManager(), rl);
    builder.addAll(ItemLayerModel.getQuadsForSprite(0, tasi, DefaultVertexFormats.ITEM, Optional.empty()));
    quads = builder.build();
}
 
开发者ID:iChun,项目名称:Clef,代码行数:12,代码来源:Instrument.java

示例12: bakeItem

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的package包/类
public static List<BakedQuad> bakeItem(VertexFormat format, IModelState state, TextureAtlasSprite... sprites) {

        LambdaUtils.checkArgument(sprites, "Sprites must not be Null or empty!", ArrayUtils::isNullOrContainsNull);

        List<BakedQuad> quads = new LinkedList<>();
        Optional<TRSRTransformation> transform = state.apply(Optional.empty());
        for (int i = 0; i < sprites.length; i++) {
            TextureAtlasSprite sprite = sprites[i];
            quads.addAll(ItemLayerModel.getQuadsForSprite(i, sprite, format, transform));
        }
        return quads;
    }
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:13,代码来源:ItemQuadBakery.java

示例13: bake

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的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 BakedHandpickModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
			Maps.<String, IBakedModel>newHashMap());
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:35,代码来源:HandpickModel.java

示例14: loadModel

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的package包/类
@Alpha
@Override
public IModel loadModel(ResourceLocation resourceLocation) throws Exception {
	try {
		ModelResourceLocation modelLocation;
		if (resourceLocation instanceof ModelResourceLocation)
			modelLocation = (ModelResourceLocation) resourceLocation;
		else
			return null;
		if (!modelLocation.getVariant().equals("inventory") && !modelLocation.getResourcePath().endsWith("_loc")) {
			List<Variant> list = Lists.newLinkedList();
			ModelRotation rotation = ModelRotation.X0_Y0;
			switch (Tool.get(modelLocation.getVariant(), "facing=([a-z]*)")) {
				case "east":
					rotation = ModelRotation.X0_Y270;
					break;
				case "north":
					rotation = ModelRotation.X0_Y180;
					break;
				case "west":
					rotation = ModelRotation.X0_Y90;
					break;
			}
			list.add(new Variant(new ModelResourceLocation(modelLocation.getResourceDomain() + ":" +
					modelLocation.getResourcePath() + "_loc", modelLocation.getVariant()),
					rotation, false, 1));
			VariantList variantList = new VariantList(list);
			return new ModelLoader.WeightedRandomModel(modelLocation, variantList);
		}
		modelLocation = new ModelResourceLocation(modelLocation.getResourceDomain() + 
				modelLocation.getResourcePath().replace("_loc", ""), modelLocation.getVariant());
		String name = modelLocation.getVariant().contains("part=head") ? "head" : "foot";
		String rely = Tool.isEmptyOr(Tool.get(modelLocation.getVariant(), "rely=([a-z]*)"), "null");
		try (IResource resource = Minecraft.getMinecraft().getResourceManager()
					.getResource(new ResourceLocation("skin:models/wardrobe_" + rely + "_" + name + ".json"))) {
			String json = Joiner.on('\n').join(IOUtils.readLines(resource.getInputStream(), Charsets.UTF_8));
			try (Reader reader = new StringReader(WoodType.conversion.apply(json, Tool.get(
					modelLocation.getResourcePath(), "_(.*?_T_.*?_T_[0-9]*_T_.*?_T_.*?_T_[0-9]*)")))) {
				ModelBlock modelBlock = ModelBlock.deserialize(reader);
				return modelLocation.getVariant().equals("inventory") ? new ItemLayerModel(modelBlock) :
					ModelLoader.VanillaLoader.INSTANCE.getLoader().new VanillaModelWrapper(modelLocation,
							modelBlock, false, ModelBlockAnimation.defaultModelBlockAnimation);
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
		throw e;
	}
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:50,代码来源:WardrobeModelLoader.java

示例15: generateItemQuads

import net.minecraftforge.client.model.ItemLayerModel; //导入依赖的package包/类
public static List<BakedQuad> generateItemQuads(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, String base, List<ItemModelTexture> textures) {

		List<BakedQuad> quads = new ArrayList<>();
		
		TRSRTransformation transform = TRSRTransformation.identity();
		TextureAtlasSprite base_icon = bakedTextureGetter.apply(new ResourceLocation(base));

		quads.addAll(ItemLayerModel.getQuadsForSprite(0, base_icon, format, Optional.of(transform)));

		for (ItemModelTexture tex : textures) {
			TextureAtlasSprite icon = bakedTextureGetter.apply(tex.texture);
			quads.add(genQuad(format, transform, tex.x1, tex.y1, tex.x2, tex.y2, tex.u1, tex.v1, tex.u2, tex.v2, NORTH_Z_BASE, icon, EnumFacing.NORTH, 0xffffffff));
			quads.add(genQuad(format, transform, tex.x1, tex.y1, tex.x2, tex.y2, tex.u1, tex.v1, tex.u2, tex.v2, SOUTH_Z_BASE, icon, EnumFacing.SOUTH, 0xffffffff));
		}

		return quads;

	}
 
开发者ID:InfinityRaider,项目名称:InfinityLib,代码行数:19,代码来源:ItemQuadGenerator.java


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