本文整理汇总了Java中net.minecraft.client.renderer.block.model.ModelResourceLocation类的典型用法代码示例。如果您正苦于以下问题:Java ModelResourceLocation类的具体用法?Java ModelResourceLocation怎么用?Java ModelResourceLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelResourceLocation类属于net.minecraft.client.renderer.block.model包,在下文中一共展示了ModelResourceLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerRenderer
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public void registerRenderer() {
ArrayList<ItemStack> subtypes = new ArrayList<ItemStack>();
this.getSubItems(this, this.getCreativeTab(), subtypes);
for (ItemStack subtype : subtypes) {
String unlocalizedName = this.getUnlocalizedName(subtype);
String modelName = unlocalizedName.replace("item.", "");
System.out.println("Registering "+this.getRegistryName()+" metadata "+subtype.getMetadata()+" as model "+modelName);
ModelLoader.setCustomModelResourceLocation(
this, subtype.getMetadata(),
new ModelResourceLocation(modelName, "inventory")
);
}
//Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
// .register(this, 0, new ModelResourceLocation(this.getRegistryName().toString(), "inventory"));
}
示例2: registerItemRenderer
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@Override
public void registerItemRenderer(Item i, int meta, String id) {
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(ModInfo.MODID + ":" + id, "inventory"));
}
示例3: process
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@Override
public MultiLayerModel process(ImmutableMap<String, String> customData)
{
ImmutableMap.Builder<Optional<BlockRenderLayer>, ModelResourceLocation> builder = ImmutableMap.builder();
for(String key : customData.keySet())
{
if("base".equals(key))
{
builder.put(Optional.<BlockRenderLayer>absent(), getLocation(customData.get(key)));
}
for(BlockRenderLayer layer : BlockRenderLayer.values())
{
if(layer.toString().equals(key))
{
builder.put(Optional.of(layer), getLocation(customData.get(key)));
}
}
}
ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models = builder.build();
if(models.isEmpty()) return INSTANCE;
return new MultiLayerModel(models);
}
示例4: handleModels
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void handleModels(ModelRegistryEvent event)
{
for (Map.Entry<ItemStack, ModelResourceLocation> entry : LOCATIONS.entrySet())
{
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
}
}
示例5: register
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public void register(Item item, int meta, ModelResourceLocation location)
{
TIntObjectHashMap<ModelResourceLocation> locs = locations.get(item);
TIntObjectHashMap<IBakedModel> mods = models.get(item);
if (locs == null)
{
locs = new TIntObjectHashMap<ModelResourceLocation>();
locations.put(item, locs);
}
if (mods == null)
{
mods = new TIntObjectHashMap<IBakedModel>();
models.put(item, mods);
}
locs.put(meta, location);
mods.put(meta, getModelManager().getModel(location));
}
示例6: initModel
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
default public void initModel(ModelRegistryEvent e)
{
System.out.println(((IForgeRegistryEntry<?>) this).getRegistryName());
if (this instanceof Item)
ModelLoader.setCustomModelResourceLocation((Item) this, 0,
new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
else if (this instanceof Block)
{
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0,
new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
System.out.println("block");
}
else
throw new IllegalArgumentException("No/invalid object for model");
}
示例7: mkCustomModelResourceLocations
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public static void mkCustomModelResourceLocations(Item item, int amount, Function<Integer, String> ptrFunc)
{
for (int i = 0; i < amount; i++)
{
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName(), ptrFunc == null ? "inventory" : ptrFunc.apply(i)));
}
}
示例8: registerRender
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public void registerRender() {
int i = 0;
Item item = Item.getItemFromBlock(this);
ResourceLocation[] list = new ResourceLocation[getVariantNames().size()];
for (String s : getVariantNames()) {
String loc = this.getRegistryName().toString();// +"#variants="+s;
ResourceLocation res = new ResourceLocation(loc);
ModelResourceLocation mrl = new ModelResourceLocation(loc, "variants=" + s);
ModelLoader.setCustomModelResourceLocation(item, i, mrl);
list[i] = res;
i++;
}
ModelBakery.registerItemVariants(Item.getItemFromBlock(this), list);
}
示例9: registerBlock
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public static <BBBlock extends Block & IBBName> void registerBlock(BBBlock block)
{
Item item = Item.getItemFromBlock(block);
if(item != null)
{
if(item instanceof ISpecialRender)
((ISpecialRender) item).registerRender();
else
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
}
示例10: setBucketModel
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
private void setBucketModel(Item item)
{
for(String s : getVariantNames(item))
{
ModelResourceLocation memory = getInventoryVariant(s);
IModel model = stateModels.get(ModelDynBucket.LOCATION);
if(model != null)
{
stateModels.put(memory, model);
}
}
}
示例11: registerItemRenderer
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public static void registerItemRenderer() {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(ModItems.woodSpear.getItem(), 0, new ModelResourceLocation("polearms:woodSpear", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(ModItems.stoneSpear.getItem(), 0, new ModelResourceLocation("polearms:stoneSpear", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(ModItems.ironSpear.getItem(), 0, new ModelResourceLocation("polearms:ironSpear", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(ModItems.goldSpear.getItem(), 0, new ModelResourceLocation("polearms:goldSpear", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(ModItems.diamondSpear.getItem(), 0, new ModelResourceLocation("polearms:diamondSpear", "inventory"));
Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
.register(ModItems.pole.getItem(), 0, new ModelResourceLocation("polearms:pole", "inventory"));
}
示例12: registerModel
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
public static <T extends Enum<T> & IStringSerializable> void registerModel(Item item, Class<T> clazz) {
for (T t : clazz.getEnumConstants()) {
ResourceLocation location = new ResourceLocation(item.getRegistryName() + "_" + t.getName());
ModelResourceLocation modelResourceLocation = new ModelResourceLocation(location, "inventory");
ModelLoader.setCustomModelResourceLocation(item, t.ordinal(), modelResourceLocation);
}
}
示例13: initModel
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void initModel(){
ModelBakery.registerItemVariants(this, new ModelResourceLocation(Melodium.MODID+":composition_paper"), new ModelResourceLocation(Melodium.MODID+":song_paper"));
ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition(){
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (isLearned(stack)){
return new ModelResourceLocation(Melodium.MODID+":song_paper");
}
return new ModelResourceLocation(Melodium.MODID+":composition_paper");
}
});
}
示例14: registerModel
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@Override
public void registerModel() {
for (int meta = 0; meta < 4; meta++) {
ResourceLocation rl = new ResourceLocation(getRegistryName() + "_" + BlockCircleGlyph.GlyphType.values()[meta].name().toLowerCase());
ModelResourceLocation mrl = new ModelResourceLocation(rl, "inventory");
ModelLoader.setCustomModelResourceLocation(this, meta, mrl);
}
}
示例15: registerFluidRender
import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
protected void registerFluidRender(BlockFluidBase blockFluid, String blockStateName) {
final String location = FoodCraftReloaded.MODID + ":" + blockStateName;
final Item itemFluid = Item.getItemFromBlock(blockFluid);
ModelLoader.setCustomMeshDefinition(itemFluid, stack -> new ModelResourceLocation(location, "fluid"));
ModelLoader.setCustomStateMapper(blockFluid, new StateMapperBase() {
@Nonnull
@Override
protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
return new ModelResourceLocation(location, "fluid");
}
});
}