本文整理汇总了Java中net.minecraft.client.renderer.block.statemap.BlockStateMapper类的典型用法代码示例。如果您正苦于以下问题:Java BlockStateMapper类的具体用法?Java BlockStateMapper怎么用?Java BlockStateMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockStateMapper类属于net.minecraft.client.renderer.block.statemap包,在下文中一共展示了BlockStateMapper类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadBlocks
import net.minecraft.client.renderer.block.statemap.BlockStateMapper; //导入依赖的package包/类
protected void loadBlocks()
{
BlockStateMapper blockstatemapper = this.blockModelShapes.getBlockStateMapper();
for (Block block : Block.REGISTRY)
{
for (final ResourceLocation resourcelocation : blockstatemapper.getBlockstateLocations(block))
{
try
{
loadBlock(blockstatemapper, block, resourcelocation);
}
catch (Exception exception)
{
LOGGER.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception);
}
}
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:ModelBakery.java
示例2: getTexture
import net.minecraft.client.renderer.block.statemap.BlockStateMapper; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static String getTexture(IBlockState state, String defaultTexture) {
try {
ModelLoader loader = ModelLoader.VanillaLoader.INSTANCE.getLoader();
BlockStateMapper mapper = loader.blockModelShapes.getBlockStateMapper();
Map<IBlockState, ModelResourceLocation> map = mapper.getVariants(state.getBlock());
ModelResourceLocation stateLocation = map.get(state);
ModelBlockDefinition definition = loader.getModelBlockDefinition(stateLocation);
ResourceLocation modelLocation = definition.getVariant(stateLocation.getVariant()).getVariantList().get(0).getModelLocation();
ModelBlock modelBlock = loader.loadModel(
new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelLocation.getResourcePath()));
String texture = getTexture(modelBlock);
return ObjectUtils.firstNonNull(texture, defaultTexture);
} catch (Exception e) {
e.printStackTrace();
return defaultTexture;
}
}
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:19,代码来源:WoodType.java
示例3: execute
import net.minecraft.client.renderer.block.statemap.BlockStateMapper; //导入依赖的package包/类
@Override
public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) throws CommandException {
ItemStack stack = Minecraft.getMinecraft().player.getHeldItemMainhand();
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
Block block = Block.getBlockFromItem(stack.getItem());
BlockStateMapper stateMapper = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getBlockStateMapper();
for (Entry<IBlockState, ModelResourceLocation> entry : stateMapper.getVariants(block).entrySet()) {
CCLLog.log(Level.INFO, entry.getKey().toString() + " | " + entry.getValue().toString());
}
}
}
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:12,代码来源:DumpModelLocationsCommand.java
示例4: getBlockStateMapper
import net.minecraft.client.renderer.block.statemap.BlockStateMapper; //导入依赖的package包/类
public BlockStateMapper getBlockStateMapper()
{
return this.blockStateMapper;
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockModelShapes.java
示例5: loadBlocks
import net.minecraft.client.renderer.block.statemap.BlockStateMapper; //导入依赖的package包/类
private void loadBlocks()
{
BlockStateMapper blockstatemapper = this.blockModelShapes.getBlockStateMapper();
for (Block block : Block.REGISTRY)
{
for (final ResourceLocation resourcelocation : blockstatemapper.getBlockstateLocations(block))
{
try
{
ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation);
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.getVariants(block);
if (modelblockdefinition.hasMultipartData())
{
Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
modelblockdefinition.getMultipartData().setStateContainer(block.getBlockState());
Collection<ModelResourceLocation> collection1 = (Collection)this.multipartVariantMap.get(modelblockdefinition);
if (collection1 == null)
{
collection1 = Lists.<ModelResourceLocation>newArrayList();
this.multipartVariantMap.put(modelblockdefinition, collection1);
}
collection1.addAll(Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
{
public boolean apply(@Nullable ModelResourceLocation p_apply_1_)
{
return resourcelocation.equals(p_apply_1_);
}
})));
}
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
{
ModelResourceLocation modelresourcelocation = (ModelResourceLocation)entry.getValue();
if (resourcelocation.equals(modelresourcelocation))
{
try
{
this.variants.put(modelresourcelocation, modelblockdefinition.getVariant(modelresourcelocation.getVariant()));
}
catch (RuntimeException var12)
{
if (!modelblockdefinition.hasMultipartData())
{
LOGGER.warn("Unable to load variant: {} from {}", new Object[] {modelresourcelocation.getVariant(), modelresourcelocation});
}
}
}
}
}
catch (Exception exception)
{
LOGGER.warn("Unable to load definition {}", new Object[] {resourcelocation, exception});
}
}
}
}
开发者ID:sudofox,项目名称:Backmemed,代码行数:62,代码来源:ModelBakery.java
示例6: loadBlock
import net.minecraft.client.renderer.block.statemap.BlockStateMapper; //导入依赖的package包/类
protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation)
{
{
{
{
ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation);
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.getVariants(block);
if (modelblockdefinition.hasMultipartData())
{
Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
modelblockdefinition.getMultipartData().setStateContainer(block.getBlockState());
registerMultipartVariant(modelblockdefinition, Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
{
public boolean apply(@Nullable ModelResourceLocation p_apply_1_)
{
return resourcelocation.equals(p_apply_1_);
}
})));
}
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
{
ModelResourceLocation modelresourcelocation = (ModelResourceLocation)entry.getValue();
if (resourcelocation.equals(modelresourcelocation))
{
try
{
this.registerVariant(modelblockdefinition, modelresourcelocation);
}
catch (RuntimeException var12)
{
if (!modelblockdefinition.hasMultipartData())
{
LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var12);
}
}
}
}
}
}
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:45,代码来源:ModelBakery.java
注:本文中的net.minecraft.client.renderer.block.statemap.BlockStateMapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论