本文整理汇总了Java中net.minecraftforge.client.model.ModelLoader类的典型用法代码示例。如果您正苦于以下问题:Java ModelLoader类的具体用法?Java ModelLoader怎么用?Java ModelLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelLoader类属于net.minecraftforge.client.model包,在下文中一共展示了ModelLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerItemRenderer
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
public void registerItemRenderer(Item i, int meta, String id) {
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(ModInfo.MODID + ":" + id, "inventory"));
}
示例2: registerRenders
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRenders() {
enumInstanceMap.values().stream().map(Map::entrySet).map(Collection::stream).forEach(entries -> entries.forEach(entry -> {
if (Item.class.isAssignableFrom(entry.getValue().getClass())) {
if (entry.getValue() instanceof CustomModelMasking) {
registerRender((Item) entry.getValue(), 0, ((CustomModelMasking) entry.getValue()).getModelLocation());
FoodCraftReloaded.getLogger().debug("Registered custom model " + entry.getValue().getClass() + " as " + ((CustomModelMasking) entry.getValue()).getModelLocation());
} else if (((Item) entry.getValue()).getRegistryName() != null) {
registerRender((Item) entry.getValue(), 0, new ModelResourceLocation(((Item) entry.getValue()).getRegistryName(), "inventory"));
}
} else if (BlockFluidBase.class.isAssignableFrom(entry.getValue().getClass())) {
// TODO Null condition
registerFluidRender((BlockFluidBase) entry.getValue(), ((Block)entry.getValue()).getRegistryName().getResourcePath());
} else if (Block.class.isAssignableFrom(entry.getValue().getClass())) {
if (entry.getValue() instanceof CustomModelMasking)
ModelLoader.setCustomStateMapper((Block) entry.getValue(), block -> ((CustomModelMasking) entry.getValue()).getStateModelLocations());
}
}));
}
示例3: initModel
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
public void initModel() {
ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(),"inventory"));
ModelLoader.setCustomModelResourceLocation(this, 1, new ModelResourceLocation(getRegistryName(),"inventory"));
ModelLoader.setCustomModelResourceLocation(this, 2, new ModelResourceLocation(getRegistryName(),"inventory"));
ModelLoader.setCustomModelResourceLocation(this, 3, new ModelResourceLocation(getRegistryName(),"inventory"));
ModelLoader.setCustomModelResourceLocation(this, 4, new ModelResourceLocation(getRegistryName(),"inventory"));
}
示例4: registerInventoryModels
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerInventoryModels(final ModelRegistryEvent event)
{
for (Item item : items)
{
if (item instanceof IMultiItem)
{
final Class enumClass = (Class<?>)ReflectionUtils.getGenericInterfaceType(item.getClass(), IMultiItem.class);
for (ISubItem value : (ISubItem[])enumClass.getEnumConstants())
{
ModelLoader.setCustomModelResourceLocation(item, value.getMetadata(), new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
}
else
{
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
}
}
示例5: registerItemModel
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
public void registerItemModel(Item item) {
ResourceLocation loc = Item.REGISTRY.getNameForObject(item);
if (item instanceof ItemBlockEquivalentState) {
NonNullList<ItemStack> subItems = NonNullList.create();
item.getSubItems(ThermionicsWorld.TAB_THERMIONICS_WORLD, subItems);
for(ItemStack stack : subItems) {
Item stackItem = stack.getItem();
if (stackItem!=item) continue; //The contract of getSubItems prohibits this condition.
String keys = ((ItemBlockEquivalentState)item).getStateStringForItem(stack);
//System.out.println("Registering model for "+loc+"#"+keys+" == meta:"+stack.getItemDamage());
ModelLoader.setCustomModelResourceLocation(stackItem, stack.getItemDamage(),
new ModelResourceLocation(loc, keys)
);
}
} else if (item instanceof ItemBlockGemrock) {
for(int i=0; i<16; i++) {
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc,"variant="+i));
}
} else if (item instanceof ItemBlockVarieties) {
for(int i=0; i<16; i++) {
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc,"variant="+i));
}
} else {
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "inventory"));
}
}
示例6: registerRender
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Item item, int meta, String name) {
ModelResourceLocation model = new ModelResourceLocation(name, "inventory");
ModelLoader.setCustomModelResourceLocation(item, meta, model);
}
示例7: registerShrubberyModels
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
public static void registerShrubberyModels()
{
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 0, new ModelResourceLocation(new ResourceLocation("exp", "tropical_shrubbery"), "color=none,leaf=0"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 1, new ModelResourceLocation(new ResourceLocation("exp", "flower_shrubbery"), "color=white"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 2, new ModelResourceLocation(new ResourceLocation("exp", "small_shrubbery"), "color=white"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 3, new ModelResourceLocation(new ResourceLocation("exp", "mushroom_shrubbery"), "color=red"));
}
示例8: registerRender
import net.minecraftforge.client.model.ModelLoader; //导入依赖的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.minecraftforge.client.model.ModelLoader; //导入依赖的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: initModel
import net.minecraftforge.client.model.ModelLoader; //导入依赖的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");
}
示例11: registerModels
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SubscribeEvent
public static void registerModels(ModelRegistryEvent event){
StateMapperBase mapper=new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation(new ResourceLocation(Constants.MODID, "creosote"), "creosote");
}
};
if(FluidsRegistry.BlockCreosote!=null)
ModelLoader.setCustomStateMapper(FluidsRegistry.BlockCreosote, mapper);
}
示例12: registerItem
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
public static <BBItem extends Item & IBBName> void registerItem(BBItem item)
{
if(item instanceof ISpecialRender)
((ISpecialRender) item).registerRender();
else
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
示例13: registerModel
import net.minecraftforge.client.model.ModelLoader; //导入依赖的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);
}
}
示例14: setupModels
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void setupModels()
{
for(MagibenchRegistry.Tier t : PurMag.INSTANCE.getMagibenchRegistry().getTiers())
{
ModelLoader.setCustomModelResourceLocation(this, t.getTier(), new ModelResourceLocation(t.getSmartModel(), "normal"));
}
}
示例15: registerFluidBlockRendering
import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
public void registerFluidBlockRendering(Block block, String name)
{
final ModelResourceLocation fluidLocation = new ModelResourceLocation(HarshenCastle.MODID.toLowerCase() + ":fluids", name);
ModelLoader.setCustomStateMapper(block, new StateMapperBase()
{
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
return fluidLocation;
}
});
}