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


Java ModelBakeEvent类代码示例

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


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

示例1: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent event)
{
    try
    {
        IModel model = ModelLoaderRegistry.getModel(MODEL_grave);
        if (model instanceof IRetexturableModel)
        {
            IRetexturableModel graveModel = (IRetexturableModel) model;
            IBakedModel standard = event.getModelRegistry().getObject(locGrave);
            IBakedModel finalModel = new GoodGraveModel(standard, graveModel);
            event.getModelRegistry().putObject(locGrave, finalModel);
        }
    } catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:19,代码来源:TombManyGravesClientEvents.java

示例2: modelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SuppressWarnings("unused")
@SubscribeEvent
public void modelBake(ModelBakeEvent event)
{
    List<IBakedModel> capacitors = new ArrayList<IBakedModel>();

    IBakedModel teBasic      = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=1"));
    IBakedModel teHardened   = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=2"));
    IBakedModel teReinforced = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=3"));
    IBakedModel teResonant   = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=4"));
    IBakedModel eioBasic     = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=5"));
    IBakedModel eioDouble    = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=6"));
    IBakedModel eioVibrant   = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=7"));

    capacitors.add(teBasic);
    capacitors.add(teHardened);
    capacitors.add(teReinforced);
    capacitors.add(teResonant);
    capacitors.add(eioBasic);
    capacitors.add(eioDouble);
    capacitors.add(eioVibrant);

    SmartModelCapacitor capacitorModel = new SmartModelCapacitor(capacitors);
    event.modelRegistry.putObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "inventory"), capacitorModel);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:26,代码来源:ClientEventHandler.java

示例3: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent (priority = EventPriority.HIGHEST)
public void onModelBake(ModelBakeEvent event) {

    IModel missingIModel = ModelLoaderRegistry.getMissingModel();
    IBakedModel missingModel = missingIModel.bake(missingIModel.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter);
    Map<IModel, IBakedModel> bakedModels = new HashMap<>();
    HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
    Multimaps.invertFrom(Multimaps.forMap(toBake), models);

    ProgressBar bar = ProgressManager.push("CCL ModelLoading: Baking", models.keySet().size());

    for (IModel model : models.keySet()) {
        bar.step(String.format("[%s]", Joiner.on(", ").join(models.get(model))));
        if (model == missingIModel) {
            bakedModels.put(model, missingModel);
            continue;
        }
        bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter));
    }
    ProgressManager.pop(bar);

    for (Entry<ModelResourceLocation, IModel> entry : toBake.entrySet()) {
        event.getModelRegistry().putObject(entry.getKey(), bakedModels.get(entry.getValue()));
    }

}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:27,代码来源:CCBlockStateLoader.java

示例4: onModelBakeEvent

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBakeEvent(ModelBakeEvent event) {
	models.clear();
	/*{
		Object object =  event.getModelRegistry().getObject(EnderPlayerSensor.SmartBlockModel.modelResourceLocation);
		Object object2 =  event.getModelRegistry().getObject(EnderPlayerSensor.SmartBlockModel.modelTResourceLocation);
		if (object instanceof IBakedModel && object2 instanceof IBakedModel) {
			IBakedModel existingModel = (IBakedModel)object;
			IBakedModel existingModel2 = (IBakedModel)object2;
			EnderPlayerSensor.SmartBlockModel customModel = new EnderPlayerSensor.SmartBlockModel(existingModel,existingModel2);
			event.getModelRegistry().putObject(EnderPlayerSensor.SmartBlockModel.modelResourceLocation, customModel);
			//event.modelRegistry.putObject(EnderPlayerSensor.SmartBlockModel.modelTResourceLocation, customModel);
		}
	}
	{
		Object object =  event.getModelRegistry().getObject(BlockRsDoor.SmartBlockModel.modelResourceLocation);
		if (object instanceof IBakedModel) {
			IBakedModel existingModel = (IBakedModel)object;
			BlockRsDoor.SmartBlockModel customModel = new BlockRsDoor.SmartBlockModel(existingModel);
			event.getModelRegistry().putObject(BlockRsDoor.SmartBlockModel.modelResourceLocation, customModel);
			//event.modelRegistry.putObject(EnderPlayerSensor.SmartBlockModel.modelTResourceLocation, customModel);
		}
	}*/
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:25,代码来源:EventHandlerClient.java

示例5: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onModelBake (ModelBakeEvent event) {

    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky", "normal"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_lever", "powered=true"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_lever", "powered=false"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_button", "powered=true"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_button", "powered=false"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_ghost", "normal"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_torch", "normal"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_obsidian", "normal"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_plate", "powered=true"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_plate", "powered=false"), new ModelSneakyBlock());
    event.getModelRegistry().putObject(new ModelResourceLocation("darkutils:sneaky_bedrock", "normal"), new ModelSneakyBlock());
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:17,代码来源:FeatureSneaky.java

示例6: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
    // bake and register our models here
    Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter = ModelLoader.defaultTextureGetter();

    // get all of the sprites that we will use
    TextureAtlasSprite stone = bakedTextureGetter.apply(new ResourceLocation("Minecraft:blocks/stone"));
    TextureAtlasSprite nether = bakedTextureGetter.apply(new ResourceLocation("Minecraft:blocks/netherrack"));
    TextureAtlasSprite end = bakedTextureGetter.apply(new ResourceLocation("Minecraft:blocks/end_stone"));
    TextureAtlasSprite uranium = bakedTextureGetter.apply(new ResourceLocation(Constants.MODID, "blocks/uranium_bits"));
    TextureAtlasSprite thorium = bakedTextureGetter.apply(new ResourceLocation(Constants.MODID, "blocks/thorium_bits"));
    TextureAtlasSprite blazonium = bakedTextureGetter.apply(new ResourceLocation(Constants.MODID, "blocks/blazonium_bits"));
    TextureAtlasSprite terminium = bakedTextureGetter.apply(new ResourceLocation(Constants.MODID, "blocks/terminium_bits"));

    // Add all of the models
    event.getModelRegistry().putObject(
                                       new ModelResourceLocation(Constants.MODID+":GlowOre_" + BlockRegistry.UraniumOre.Type),
                                       	new GlowOreBakedModel(stone, uranium));
    event.getModelRegistry().putObject(new ModelResourceLocation(Constants.MODID+":GlowOre_" + BlockRegistry.ThoriumOre.Type),
    									new GlowOreBakedModel(stone, thorium));
    event.getModelRegistry().putObject(new ModelResourceLocation(Constants.MODID+":GlowOre_" + BlockRegistry.BlazoniumOre.Type),
    									new GlowOreBakedModel(nether, blazonium));
    event.getModelRegistry().putObject(new ModelResourceLocation(Constants.MODID+":GlowOre_" + BlockRegistry.TerminiumOre.Type),
    									new GlowOreBakedModel(end, terminium));
}
 
开发者ID:EnderiumSmith,项目名称:Nuclear-Foundation,代码行数:26,代码来源:ClientProxy.java

示例7: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) 
{
	// tool tables
	replaceAnvilModel(locAnvilN, Core.CreateRes(Reference.ModID + ":block/anvil"), event);
	replaceAnvilModel(locAnvilS, Core.CreateRes(Reference.ModID + ":block/anvil"), event);
	replaceAnvilModel(locAnvilE, Core.CreateRes(Reference.ModID + ":block/anvil"), event);
	replaceAnvilModel(locAnvilW, Core.CreateRes(Reference.ModID + ":block/anvil"), event);

	replacePitKilnModel(locPitKilnCharcoal, Core.CreateRes(Reference.ModID + ":block/pitkiln/pitkiln_0"), event);
	replacePitKilnModel(locPitKilnStraw, Core.CreateRes(Reference.ModID + ":block/pitkiln/pitkiln_0"), event);

	replaceSmallVesselModel(locSmallVessel, Core.CreateRes(Reference.ModID + ":block/smallvessel"), event);

	// silence the missing-model message for the default itemblock
	//event.getModelRegistry().putObject(locAnvil, event.getModelRegistry().getObject(locAnvil));
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:18,代码来源:ModelBakeHandler.java

示例8: onModelBakePost

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBakePost(ModelBakeEvent event) {
    if (supressErrors) {
        Map<ResourceLocation, Exception> modelErrors = (Map<ResourceLocation, Exception>) ReflectionHelper.getPrivateValue(ModelLoader.class, event.getModelLoader(), "loadingExceptions");
        Set<ModelResourceLocation> missingVariants = (Set<ModelResourceLocation>) ReflectionHelper.getPrivateValue(ModelLoader.class, event.getModelLoader(), "missingVariants");

        List<ResourceLocation> errored = modelErrors.keySet().stream().filter((r) -> IGNORES.contains(r.getResourceDomain())).collect(Collectors.toList());
        List<ResourceLocation> missing = missingVariants.stream().filter((r) -> IGNORES.contains(r.getResourceDomain())).collect(Collectors.toList());

        errored.forEach(modelErrors::remove);
        missing.forEach(missingVariants::remove);

        AgriCore.getLogger("agricraft").info("Suppressed {0} Model Loading Errors!", errored.size());
        AgriCore.getLogger("agricraft").info("Suppressed {0} Missing Model Variants!", missing.size());
    }
}
 
开发者ID:AgriCraft,项目名称:AgriCraft,代码行数:17,代码来源:ModelErrorSuppressor.java

示例9: onModelBakeEvent

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBakeEvent(ModelBakeEvent event){
    TextureMap blockMap = FMLClientHandler.instance().getClient().getTextureMapBlocks();
    TextureAtlasSprite textures[]  = new TextureAtlasSprite[15];
    textures[0] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/machine_Top");
    textures[1] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/machine_Bottom");
    textures[2] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/machine_Side_0");
    textures[3] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/oreTumbler_Front");
    textures[4] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/oreTumbler_Front_Active");
    textures[5] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/flowstoneBottler_Front");
    textures[6] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/flowstoneBottler_Front_Activate");
    textures[7] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/furnace_Front");
    textures[8] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/furnace_Front_Active");
    textures[9] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/lumberMill_Front");
    textures[10] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/lumberMill_Front_Active");
    textures[11] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/metalMixer_Front");
    textures[12] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/metalMixer_Front_Active");
    textures[13] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/cooler_Front");
    textures[14] = blockMap.getAtlasSprite("flowstoneenergy:blocks/machines/cooler_Front_Active");
    
    
    IBakedModel machineModel = new SmartModelMachines(textures);
    
    event.modelRegistry.putObject(ClientProxy.machinesBlockLocation, machineModel);
    event.modelRegistry.putObject(ClientProxy.machinesItemLocation, machineModel);
}
 
开发者ID:FlowstoneTeam,项目名称:FlowstoneEnergy,代码行数:27,代码来源:BakeEventHandler.java

示例10: onModelBaked

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBaked(ModelBakeEvent modelBakeEvent){
    setLoader(modelBakeEvent.getModelLoader());
    for(Item shield : BattlegearConfig.shield) {
        if(shield!=null) {
            ModelResourceLocation mainLoc = DefaultMesh.INVENTORY.getModelLocation(new ItemStack(shield));
            ResourceLocation itemLoc = new ResourceLocation(mainLoc.getResourceDomain(), "item/" + mainLoc.getResourcePath());
            IModel originalModel = getModel(itemLoc);
            if(originalModel instanceof IRetexturableModel){
                ModelBlock internalFrontModel = getInternalModel(originalModel);
                if (internalFrontModel != null) {
                    ModelBlock front = makeItem(internalFrontModel);
                    IBakedModel baked = wrap(join((IRetexturableModel) originalModel, front), itemLoc);
                    if(baked != null)
                        modelBakeEvent.getModelRegistry().putObject(mainLoc, baked);
                }
            }
        }
    }
    setLoader(null);
}
 
开发者ID:Mine-and-blade-admin,项目名称:Battlegear2,代码行数:22,代码来源:ShieldModelLoader.java

示例11: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent evt) {
	final IModel model = ModelLoaderRegistry.getModelOrMissing(MARKER_MODEL_LOCATION);

	final TextureMap textureMapBlocks = Minecraft.getMinecraft().getTextureMapBlocks();
	final IBakedModel bakedModel = model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM,
			input -> textureMapBlocks.getAtlasSprite(input.toString()));

	renderer.onModelBake(() -> {
		final Tessellator tessellator = Tessellator.getInstance();

		BufferBuilder vertexBuffer = tessellator.getBuffer();
		vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);

		for (EnumFacing enumfacing : EnumFacing.values())
			renderQuads(vertexBuffer, bakedModel.getQuads(null, enumfacing, 0L));

		renderQuads(vertexBuffer, bakedModel.getQuads(null, null, 0L));

		vertexBuffer.finishDrawing();

		return vertexBuffer;
	});
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:25,代码来源:TileEntityGuideRenderer.java

示例12: onModelBake

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
    for (Entry<Block, BlockInfo> e : ConfigHandler.ores.entrySet()) {
        for (ModelResourceLocation res : e.getValue().getModels()) {
            IBakedModel model = event.getModelRegistry().getObject(res);
            if (!(model instanceof BlendedModel)) {
                Map<ModelResourceLocation, IModel> stateModels = ReflectionHelper.getPrivateValue(ModelLoader.class, event.getModelLoader(), "stateModels");
                IModel imodel = stateModels.get(res);
                BlendedModel wrapped = new BlendedModel(imodel, model);
                wrapped.setOreTexture(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/" + e.getValue().getTexture().getResourcePath() + "_differential"));
                wrapped.setBaseState(e.getValue().getState());
                event.getModelRegistry().putObject(res, wrapped);
            }
        }
    }
}
 
开发者ID:tterrag1098,项目名称:BlendedOres,代码行数:17,代码来源:BlendedModelLoader.java

示例13: bakeModels

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SubscribeEvent()
@SideOnly(Side.CLIENT)
public void bakeModels(ModelBakeEvent event) {
  cache.clear();

  for (Entry<String, Pair<ResourceLocation, PaintMode>> entry : modelLocations.entrySet()) {
    try {
      ResourceLocation resourceLocation = entry.getValue().getLeft();
      if (resourceLocation != null) {
        IModel model = ModelLoaderRegistry.getModel(resourceLocation);
        models.put(entry.getKey(), model);
      } else {
        models.put(entry.getKey(), ModelLoaderRegistry.getMissingModel());
      }
    } catch (Exception e) {
      Log.warn("Model '" + entry.getValue() + "' failed to load: " + e);
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:20,代码来源:PaintRegistry.java

示例14: onModelSpellPageBakeEvent

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onModelSpellPageBakeEvent(ModelBakeEvent event) {
	Object object = event.getModelRegistry().getObject(ModelSpellPage.modelResourceLocation);
	if (object instanceof IBakedModel) {
		IBakedModel existingModel = (IBakedModel) object;
		ModelSpellPage spellPageModel = new ModelSpellPage(existingModel);
		event.getModelRegistry().putObject(ModelSpellPage.modelResourceLocation, spellPageModel);
		ModelSpellPage.SpellPageOverrideList.INSTANCE.clearCache();
	}
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:12,代码来源:EventHandlerClient.java

示例15: onModelKnowledgeBookBakeEvent

import net.minecraftforge.client.event.ModelBakeEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onModelKnowledgeBookBakeEvent(ModelBakeEvent event) {
	Object object = event.getModelRegistry().getObject(ModelKnowledgeBook.modelResourceLocation);
	if (object instanceof IBakedModel) {
		IBakedModel existingModel = (IBakedModel) object;
		ModelKnowledgeBook knowledgeBookModel = new ModelKnowledgeBook(existingModel);
		event.getModelRegistry().putObject(ModelKnowledgeBook.modelResourceLocation, knowledgeBookModel);
		ModelKnowledgeBook.KnowledgeBookOverrideList.INSTANCE.clearCache();
	}
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:12,代码来源:EventHandlerClient.java


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