當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。