本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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()));
}
}
示例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)));
}
示例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());
}
}
示例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);
}
示例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);
}
示例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()));
}
示例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"));
}
示例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);
}
示例14: instance
import nova.core.component.Category; //导入依赖的package包/类
public static CategoryConverter instance() {
return Game.natives().getNative(Category.class, CreativeTabs.class);
}
示例15: getNovaSide
import nova.core.component.Category; //导入依赖的package包/类
@Override
public Class<Category> getNovaSide() {
return Category.class;
}