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


Java Category类代码示例

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


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

示例1: BlockStateful

import nova.core.component.Category; //导入依赖的package包/类
public BlockStateful() {
	components.add(new Collider(this).isOpaqueCube(false));
	components.add(new StaticRenderer().onRender(model -> {
		Model grinderModel = NovaBlock.grinderModel.getModel();

		grinderModel
			.combineChildren("crank", "crank1", "crank2", "crank3")
			.matrix.rotate(new Rotation(RotationUtil.DEFAULT_ORDER, 0, 0, angle));

		if (grinderModel instanceof MeshModel)
			((MeshModel)grinderModel).bindAll(NovaBlock.grinderTexture);

		model.children.add(grinderModel);
	}));
	components.add(new Category("buildingBlocks"));
	//components.add(new TestComponent());

	events.on(RightClickEvent.class).bind(this::onRightClick);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Example,代码行数:20,代码来源:BlockStateful.java

示例2: registerNovaBlock

import nova.core.component.Category; //导入依赖的package包/类
private void registerNovaBlock(BlockFactory blockFactory) {
	FWBlock blockWrapper = new FWBlock(blockFactory);
	blockFactoryMap.put(blockFactory, blockWrapper);
	String blockId = blockFactory.getID();
	if (!blockId.contains(":"))
		blockId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + blockId;
	GameRegistry.registerBlock(blockWrapper, FWItemBlock.class, blockId);
	NovaMinecraft.proxy.postRegisterBlock(blockWrapper);

	if (blockWrapper.dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
		//Add into creative tab
		Category category = blockWrapper.dummy.components.get(Category.class);
		blockWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, blockWrapper));
	}

	Game.logger().info("Registered block: {}", blockFactory.getID());
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:18,代码来源:BlockConverter.java

示例3: registerNovaBlock

import nova.core.component.Category; //导入依赖的package包/类
private void registerNovaBlock(BlockFactory blockFactory) {
	FWBlock blockWrapper = new FWBlock(blockFactory);
	blockFactoryMap.put(blockFactory, blockWrapper);
	NovaMinecraft.proxy.registerBlock(blockWrapper);
	String blockId = blockFactory.getID();
	if (!blockId.contains(":"))
		blockId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + blockId;
	GameRegistry.registerBlock(blockWrapper, FWItemBlock.class, blockId);

	if (blockWrapper.dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
		//Add into creative tab
		Category category = blockWrapper.dummy.components.get(Category.class);
		blockWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, blockWrapper));
	}

	Game.logger().info("Registered block: {}", blockFactory.getID());
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:18,代码来源:BlockConverter.java

示例4: BlockStateless

import nova.core.component.Category; //导入依赖的package包/类
public BlockStateless() {
	components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaBlock.steelTexture).build()));
	components.add(new Collider(this));
	components.add(new Category("buildingBlocks"));

	events.on(RightClickEvent.class).bind(this::onRightClick);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Example,代码行数:8,代码来源:BlockStateless.java

示例5: testComponentException

import nova.core.component.Category; //导入依赖的package包/类
@Test
public void testComponentException() {
	ComponentException ex = new ComponentException("Object %s is %s", Category.class, Object.class);
	assertThat(ex.getMessage()).isEqualTo("Object " + Category.class + " is " + Object.class);
	assertThat(ex.component).isEqualTo(Category.class);

	ex = new ComponentException("Component %s is %s", new Category("Test"), Object.class);
	assertThat(ex.getMessage()).isEqualTo("Component " + Category.class + " is " + Object.class);
	assertThat(ex.component).isEqualTo(Category.class);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:11,代码来源:ComponentExceptionTest.java

示例6: toNova

import nova.core.component.Category; //导入依赖的package包/类
@Override
public Category toNova(CreativeTabs creativeTab) {
	switch (creativeTab.getTabLabel()) {
		case "buildingBlocks":
			return Category.BUILDING_BLOCKS;
		case "decorations":
			return Category.DECORATIONS;
		case "redstone":
			return Category.TECHNOLOGY;
		case "transportation":
			return Category.TRANSPORTATION;
		case "food":
			return Category.FOOD;
		case "tools":
			return Category.TOOLS;
		case "combat":
			return Category.COMBAT;
		case "brewing":
			return Category.ALCHEMY;
		case "materials":
			return Category.MATERIALS;
		case "misc":
			return Category.MISCELLANEOUS;
		default:
			return new Category(creativeTab.getTabLabel(), ItemConverter.instance().toNova(creativeTab.getIconItemStack()));
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:28,代码来源:CategoryConverter.java

示例7: toNative

import nova.core.component.Category; //导入依赖的package包/类
public CreativeTabs toNative(Category category, ItemStack item) {
	if (category.name.startsWith("nova:")) {
		switch (category.name) {
			case Category.BUILDING_BLOCKS_NAME:
				return CreativeTabs.tabBlock;
			case Category.DECORATIONS_NAME:
				return CreativeTabs.tabDecorations;
			case Category.TECHNOLOGY_NAME:
				return CreativeTabs.tabRedstone;
			case Category.TRANSPORTATION_NAME:
				return CreativeTabs.tabTransport;
			case Category.FOOD_NAME:
				return CreativeTabs.tabFood;
			case Category.TOOLS_NAME:
				return CreativeTabs.tabTools;
			case Category.COMBAT_NAME:
				return CreativeTabs.tabCombat;
			case Category.ALCHEMY_NAME:
				return CreativeTabs.tabBrewing;
			case Category.MATERIALS_NAME:
				return CreativeTabs.tabMaterials;
			case Category.MISCELLANEOUS_NAME:
				return CreativeTabs.tabMisc;
		}
	}
	return Arrays.stream(CreativeTabs.creativeTabArray)
		.filter(tab -> tab.getTabLabel().equals(category.name))
		.findFirst()
		.orElseGet(() -> new ModCreativeTab(category.name, category.item.map(ItemConverter.instance()::toNative).orElse(item)));
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:31,代码来源:CategoryConverter.java

示例8: registerNOVAItem

import nova.core.component.Category; //导入依赖的package包/类
private void registerNOVAItem(ItemFactory itemFactory) {
	if (map.containsKey(itemFactory)) {
		// just a safeguard - don't map stuff twice
		return;
	}

	net.minecraft.item.Item itemWrapper;

	Item dummy = itemFactory.build();
	if (dummy instanceof ItemBlock) {
		BlockFactory blockFactory = ((ItemBlock) dummy).blockFactory;
		net.minecraft.block.Block mcBlock = BlockConverter.instance().toNative(blockFactory);
		itemWrapper = net.minecraft.item.Item.getItemFromBlock(mcBlock);
		if (itemWrapper == null) {
			throw new InitializationException("ItemConverter: Missing block: " + itemFactory.getID());
		}
	} else {
		itemWrapper = new FWItem(itemFactory);
	}

	MinecraftItemMapping minecraftItemMapping = new MinecraftItemMapping(itemWrapper, 0);
	map.put(itemFactory, minecraftItemMapping);

	// Don't register ItemBlocks twice
	if (!(dummy instanceof ItemBlock)) {
		NovaMinecraft.proxy.registerItem((FWItem) itemWrapper);
		String itemId = itemFactory.getID();
		if (!itemId.contains(":"))
			itemId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + itemId;
		GameRegistry.registerItem(itemWrapper, itemId);

		if (dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
			//Add into creative tab
			Category category = dummy.components.get(Category.class);
			itemWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, itemWrapper));
		}

		Game.logger().info("Registered item: {}", itemFactory.getID());
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:41,代码来源:ItemConverter.java

示例9: preInit

import nova.core.component.Category; //导入依赖的package包/类
@Override
public void preInit() {
	NovaMicroblock.instance.network.register(new MicroblockPacket());

	componentInjection.register("collider", () -> new ForwardInjector<>(Collider.class, ContainerCollider::new));
	componentInjection.register("dynamicRenderer", () -> new ForwardInjector<>(DynamicRenderer.class, ContainerDynamicRenderer::new));
	componentInjection.register("staticRenderer", () -> new ForwardInjector<>(StaticRenderer.class, ContainerStaticRenderer::new));
	componentInjection.register("blockTransform", () -> new CopyInjector<>(BlockTransform.class));
	componentInjection.register("factoryProvider", () -> new CopyInjector<>(FactoryProvider.class));
	componentInjection.register("category", () -> new CopyInjector<>(Category.class));

	//Replace block registration by sneakily providing our own way to put container blocks instead of the actual block.
	events.on(BlockEvent.Register.class).withPriority(EventBus.PRIORITY_HIGH).bind(this::blockRegisterEvent);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Microblock,代码行数:15,代码来源:NovaMicroblock.java

示例10: ItemScrewdriver

import nova.core.component.Category; //导入依赖的package包/类
public ItemScrewdriver() {
	components.add(new Category("tools"));
	components.add(new StaticRenderer().onRender(new ItemRenderPipeline(this).withTexture(NovaItem.screwTexture).build()));

	events.on(UseEvent.class).bind(event -> event.action = true);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Example,代码行数:7,代码来源:ItemScrewdriver.java

示例11: ItemSteelIngot

import nova.core.component.Category; //导入依赖的package包/类
public ItemSteelIngot() {
	components.add(new Category("materials"));
	components.add(new StaticRenderer().onRender(new ItemRenderPipeline(this).withTexture(NovaWorldgen.steelIngotTexture).build()));
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Example,代码行数:5,代码来源:ItemSteelIngot.java

示例12: BlockSteelOre

import nova.core.component.Category; //导入依赖的package包/类
public BlockSteelOre() {
	components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaWorldgen.steelOreTexture).build()));
	components.add(new Collider(this));
	components.add(new Category("buildingBlocks"));
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Example,代码行数:6,代码来源:BlockSteelOre.java

示例13: BlockSimpleTest

import nova.core.component.Category; //导入依赖的package包/类
public BlockSimpleTest() {
	components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaGui.steelTexture).build()));
	components.add(new Collider(this));
	components.add(new Category("buildingBlocks"));
	events.on(RightClickEvent.class).bind(this::onRightClick);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Example,代码行数:7,代码来源:BlockSimpleTest.java

示例14: instance

import nova.core.component.Category; //导入依赖的package包/类
public static CategoryConverter instance() {
	return Game.natives().getNative(Category.class, CreativeTabs.class);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:4,代码来源:CategoryConverter.java

示例15: getNovaSide

import nova.core.component.Category; //导入依赖的package包/类
@Override
public Class<Category> getNovaSide() {
	return Category.class;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:5,代码来源:CategoryConverter.java


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