diff --git a/.gitignore b/.gitignore index 4778640..ccd9282 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ !/block !/gui !/item +!/entity +!/worldgen !/old !/guidelines diff --git a/block/build.gradle b/block/build.gradle index 36c74e8..03bc10d 100644 --- a/block/build.gradle +++ b/block/build.gradle @@ -1,2 +1,4 @@ -version = "0.1" +version = "0.1.0-SNAPSHOT" group = "nova.sample.block" + +archivesBaseName = "NOVA-Example-Block" diff --git a/block/src/main/java/nova/sample/block/BlockStateful.java b/block/src/main/java/nova/sample/block/BlockStateful.java index ea28a47..6d2b971 100644 --- a/block/src/main/java/nova/sample/block/BlockStateful.java +++ b/block/src/main/java/nova/sample/block/BlockStateful.java @@ -12,6 +12,7 @@ import nova.core.network.Packet; import nova.core.network.Syncable; import nova.core.network.Sync; +import nova.core.render.model.MeshModel; import nova.core.render.model.Model; import nova.core.retention.Storable; import nova.core.retention.Store; @@ -32,11 +33,9 @@ public class BlockStateful extends Block implements Storable, Stateful, Syncable private double angle = 0; public BlockStateful() { - - add(new Collider(this).isOpaqueCube(false)); - - add(new StaticRenderer(this) - .setOnRender(model -> { + components.add(new Collider(this).isOpaqueCube(false)); + components.add(new StaticRenderer() + .onRender(model -> { Model grinderModel = NovaBlock.grinderModel.getModel(); grinderModel @@ -44,13 +43,15 @@ public BlockStateful() { .matrix.rotate(new Rotation(RotationUtil.DEFAULT_ORDER,0, 0, angle)); model.children.add(grinderModel); - model.bindAll(NovaBlock.grinderTexture); + + if (model instanceof MeshModel) + ((MeshModel)model).bindAll(NovaBlock.grinderTexture); } ) ); - add(new ItemRenderer(this)); - add(new Category("buildingBlocks")); - //add(new TestComponent()); + components.add(new ItemRenderer(this)); + components.add(new Category("buildingBlocks")); + //components.add(new TestComponent()); events.on(RightClickEvent.class).bind(this::onRightClick); } @@ -70,11 +71,6 @@ public void read(Packet packet) { world().markStaticRender(position()); } - @Override - public String getID() { - return "stateful"; - } - public static interface TestInterface { public void test(); } diff --git a/block/src/main/java/nova/sample/block/BlockStateless.java b/block/src/main/java/nova/sample/block/BlockStateless.java index 3050b6a..09595df 100644 --- a/block/src/main/java/nova/sample/block/BlockStateless.java +++ b/block/src/main/java/nova/sample/block/BlockStateless.java @@ -1,12 +1,13 @@ package nova.sample.block; import nova.core.block.Block; -import nova.core.block.component.StaticBlockRenderer; import nova.core.component.Category; import nova.core.component.misc.Collider; import nova.core.component.renderer.ItemRenderer; +import nova.core.component.renderer.StaticRenderer; import nova.core.network.Packet; import nova.core.network.Syncable; +import nova.core.render.pipeline.BlockRenderPipeline; /** * Literally, this is a test block. @@ -15,13 +16,11 @@ public class BlockStateless extends Block implements Syncable { public BlockStateless() { - add(new StaticBlockRenderer(this)).setTexture(NovaBlock.steelTexture); + components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaBlock.steelTexture).build())); + components.add(new Collider(this)); + components.add(new ItemRenderer(this)); // TODO: Deprecated + components.add(new Category("buildingBlocks")); - add(new Collider(this)); - - add(new ItemRenderer(this)); - - add(new Category("buildingBlocks")); events.on(RightClickEvent.class).bind(this::onRightClick); } @@ -39,9 +38,4 @@ public void read(Packet packet) { public void write(Packet packet) { packet.writeInt(1234); } - - @Override - public String getID() { - return "simple"; - } } diff --git a/block/src/main/java/nova/sample/block/NovaBlock.java b/block/src/main/java/nova/sample/block/NovaBlock.java index b7f2adb..baecc44 100644 --- a/block/src/main/java/nova/sample/block/NovaBlock.java +++ b/block/src/main/java/nova/sample/block/NovaBlock.java @@ -5,8 +5,7 @@ import nova.core.item.ItemFactory; import nova.core.item.ItemManager; import nova.core.loader.Loadable; -import nova.core.loader.NovaMod; -import nova.core.nativewrapper.NativeManager; +import nova.core.loader.Mod; import nova.core.network.NetworkManager; import nova.core.recipes.RecipeManager; import nova.core.recipes.crafting.ItemIngredient; @@ -22,10 +21,10 @@ * * @author Calclavia */ -@NovaMod(id = NovaBlock.id, name = "Nova Example Block", version = "0.0.1", novaVersion = "0.0.1") +@Mod(id = NovaBlock.MOD_ID, name = "Nova Example Block", version = "0.0.1", novaVersion = "0.0.1") public class NovaBlock implements Loadable { - public static final String id = "novablock"; + public static final String MOD_ID = "novablock"; public static BlockFactory blockStateful; public static BlockFactory blockStateless; @@ -48,10 +47,10 @@ public class NovaBlock implements Loadable { public final RecipeManager recipeManager; public NovaBlock(BlockManager blockManager, - ItemManager itemManager, - RenderManager renderManager, - NetworkManager networkManager, - RecipeManager recipeManager) { + ItemManager itemManager, + RenderManager renderManager, + NetworkManager networkManager, + RecipeManager recipeManager) { this.blockManager = blockManager; this.itemManager = itemManager; this.renderManager = renderManager; @@ -62,23 +61,23 @@ public NovaBlock(BlockManager blockManager, @Override public void preInit() { - steelTexture = renderManager.registerTexture(new BlockTexture(id, "blockSteel")); - grinderTexture = renderManager.registerTexture(new BlockTexture(id, "grinder")); + steelTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "block_steel")); + grinderTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "grinder")); - blockStateful = blockManager.register(BlockStateful.class); - blockStateless = blockManager.register(BlockStateless.class); + blockStateful = blockManager.register(MOD_ID + ":stateful", BlockStateful::new); + blockStateless = blockManager.register(MOD_ID + ":simple", BlockStateless::new); itemBlockStateful = itemManager.getItemFromBlock(blockStateful); itemBlockStateless = itemManager.getItemFromBlock(blockStateless); - grinderEntityTexture = renderManager.registerTexture(new EntityTexture(id, "grinderEntity")); - - grinderModel = renderManager.registerModel(new TechneModelProvider(id, "grinder")); + grinderEntityTexture = renderManager.registerTexture(new EntityTexture(MOD_ID, "grinder_entity")); + grinderModel = renderManager.registerModel(new TechneModelProvider(MOD_ID, "grinder")); // try to add a recipe - ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too + //ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too + ItemIngredient stickIngredient = ItemIngredient.forDictionary("stickWood"); ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); - recipeManager.addRecipe(new ShapedCraftingRecipe(itemBlockStateless.makeItem(), "AAA-ABA-AAA", ingotIngredient, stickIngredient)); + recipeManager.addRecipe(new ShapedCraftingRecipe(itemBlockStateless.build(), "AAA-ABA-AAA", ingotIngredient, stickIngredient)); } } diff --git a/block/src/main/resources/assets/novablock/textures/blocks/blockSteel.png b/block/src/main/resources/assets/novablock/textures/blocks/block_steel.png similarity index 100% rename from block/src/main/resources/assets/novablock/textures/blocks/blockSteel.png rename to block/src/main/resources/assets/novablock/textures/blocks/block_steel.png diff --git a/block/src/main/resources/assets/novablock/textures/entities/grinderEntity.png b/block/src/main/resources/assets/novablock/textures/entities/grinder_entity.png similarity index 100% rename from block/src/main/resources/assets/novablock/textures/entities/grinderEntity.png rename to block/src/main/resources/assets/novablock/textures/entities/grinder_entity.png diff --git a/build.gradle b/build.gradle index ddfc07e..dcdc83d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,8 @@ plugins { id "java" - id "nova.gradle" version "0.2.4" + id "nova.gradle" version "0.2.6" } - subprojects { apply plugin: "java" apply plugin: "nova.gradle" @@ -23,10 +22,13 @@ subprojects { nova { wrappers { "17" { - wrapper "nova.wrapper.mc1710:NovaWrapper-MC1.7.10:0.1-SNAPSHOT" + wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$nova_version" } "18" { - wrapper "nova.wrapper.mc18:NovaWrapper-MC1.8:0.1-SNAPSHOT" + wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$nova_version" + } + "1_11" { + wrapper "nova.core:NOVA-Core-Wrapper-MC1.11:$nova_version" } } } diff --git a/entity/build.gradle b/entity/build.gradle new file mode 100644 index 0000000..f53ee88 --- /dev/null +++ b/entity/build.gradle @@ -0,0 +1,4 @@ +version = "0.1.0-SNAPSHOT" +group = "nova.sample.entity" + +archivesBaseName = "NOVA-Example-Entity" diff --git a/entity/src/main/java/nova/sample/entity/NovaEntity.java b/entity/src/main/java/nova/sample/entity/NovaEntity.java new file mode 100644 index 0000000..8f1e1dd --- /dev/null +++ b/entity/src/main/java/nova/sample/entity/NovaEntity.java @@ -0,0 +1,31 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package nova.sample.entity; + +import nova.core.entity.EntityManager; +import nova.core.loader.Loadable; +import nova.core.loader.Mod; +import nova.core.render.RenderManager; + +/** + * Used to test NOVA entities. + * + * @author ExE Boss + */ +@Mod(id = NovaEntity.MOD_ID, name = "Nova Example Entity", version = "0.0.1", novaVersion = "0.0.1") +public class NovaEntity implements Loadable { + + public static final String MOD_ID = "novaentity"; + + public final EntityManager entityManager; + public final RenderManager renderManager; + + public NovaEntity(EntityManager entityManager, + RenderManager renderManager) { + this.entityManager = entityManager; + this.renderManager = renderManager; + } +} diff --git a/gui/build.gradle b/gui/build.gradle index 77ba2eb..7dccd3b 100644 --- a/gui/build.gradle +++ b/gui/build.gradle @@ -1,6 +1,8 @@ -version = "0.1" +version = "0.1.0-SNAPSHOT" group = "nova.sample.gui" +archivesBaseName = "NOVA-Example-GUI" + dependencies { - compile "nova.gui:NOVA-GUI:0.0.1-SNAPSHOT" + compile group: "nova.gui", name: "NOVA-GUI", version: "0.0.1-SNAPSHOT", changing: true } \ No newline at end of file diff --git a/gui/src/main/java/nova/sample/gui/NovaGui.java b/gui/src/main/java/nova/sample/gui/NovaGui.java index fd91b00..3441428 100644 --- a/gui/src/main/java/nova/sample/gui/NovaGui.java +++ b/gui/src/main/java/nova/sample/gui/NovaGui.java @@ -2,22 +2,22 @@ import nova.core.block.BlockFactory; import nova.core.block.BlockManager; -import nova.core.gui.Background; -import nova.core.gui.ComponentEvent.ActionEvent; -import nova.core.gui.Gui; -import nova.core.gui.GuiEvent.BindEvent; -import nova.core.gui.GuiEvent.UnBindEvent; -import nova.core.gui.component.Button; -import nova.core.gui.component.Container; -import nova.core.gui.component.Label; -import nova.core.gui.component.inventory.Slot; -import nova.core.gui.factory.GuiManager; -import nova.core.gui.layout.Anchor; -import nova.core.gui.layout.FlowLayout; +import nova.gui.Background; +import nova.gui.ComponentEvent.ActionEvent; +import nova.gui.Gui; +import nova.gui.GuiEvent.BindEvent; +import nova.gui.GuiEvent.UnBindEvent; +import nova.gui.component.Button; +import nova.gui.component.Container; +import nova.gui.component.Label; +import nova.gui.component.inventory.Slot; +import nova.gui.factory.GuiManager; +import nova.gui.layout.Anchor; +import nova.gui.layout.FlowLayout; import nova.core.item.ItemFactory; import nova.core.item.ItemManager; import nova.core.loader.Loadable; -import nova.core.loader.NovaMod; +import nova.core.loader.Mod; import nova.core.network.NetworkManager; import nova.core.network.NetworkTarget.Side; import nova.core.recipes.RecipeManager; @@ -33,10 +33,10 @@ * * @author Calclavia */ -@NovaMod(id = NovaGui.id, name = "Nova GUI example", version = "0.0.1", novaVersion = "0.0.1") +@Mod(id = NovaGui.MOD_ID, name = "Nova GUI example", version = "0.0.1", novaVersion = "0.0.1") public class NovaGui implements Loadable { - public static final String id = "novagui"; + public static final String MOD_ID = "novaexamplegui"; public static BlockFactory blockTest; public static ItemFactory itemBlockTest; @@ -51,11 +51,11 @@ public class NovaGui implements Loadable { public final RecipeManager recipeManager; public NovaGui(BlockManager blockManager, - ItemManager itemManager, - RenderManager renderManager, - GuiManager guiFactory, - RecipeManager recipeManager, - NetworkManager networkManager) { + ItemManager itemManager, + RenderManager renderManager, + GuiManager guiFactory, + RecipeManager recipeManager, + NetworkManager networkManager) { this.blockManager = blockManager; this.itemManager = itemManager; this.renderManager = renderManager; @@ -67,7 +67,7 @@ public NovaGui(BlockManager blockManager, } public static void initializeGUI() { - guiFactory.register(() -> new Gui("testgui") + guiFactory.register("testgui", () -> new Gui("testgui") .add(new Button("testbutton2", "I'm EAST") .setMaximumSize(Integer.MAX_VALUE, 120) @@ -103,16 +103,17 @@ public static void initializeGUI() { @Override public void preInit() { - blockTest = blockManager.register(BlockSimpleTest.class); + blockTest = blockManager.register(MOD_ID + ":gui", BlockSimpleTest::new); itemBlockTest = itemManager.getItemFromBlock(blockTest); - steelTexture = renderManager.registerTexture(new BlockTexture(id, "blockSteel")); + steelTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "block_steel")); // try to add a recipe - ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too + //ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too + ItemIngredient stickIngredient = ItemIngredient.forDictionary("stickWood"); ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); - recipeManager.addRecipe(new ShapedCraftingRecipe(itemBlockTest.makeItem(), "AAA-ABA-AAA", ingotIngredient, stickIngredient)); + recipeManager.addRecipe(new ShapedCraftingRecipe(itemBlockTest.build(), "AAA-ABA-AAA", ingotIngredient, stickIngredient)); initializeGUI(); } diff --git a/gui/src/main/java/nova/sample/gui/block/BlockSimpleTest.java b/gui/src/main/java/nova/sample/gui/block/BlockSimpleTest.java index 6b6c774..d0fe3c3 100644 --- a/gui/src/main/java/nova/sample/gui/block/BlockSimpleTest.java +++ b/gui/src/main/java/nova/sample/gui/block/BlockSimpleTest.java @@ -1,17 +1,18 @@ package nova.sample.gui.block; import nova.core.block.Block; -import nova.core.block.component.StaticBlockRenderer; import nova.core.component.Category; +import nova.core.component.inventory.Inventory; +import nova.core.component.inventory.InventorySimple; import nova.core.component.misc.Collider; import nova.core.component.renderer.ItemRenderer; import nova.core.network.Syncable; -import nova.core.inventory.Inventory; -import nova.core.inventory.InventorySimple; import nova.core.network.Packet; import nova.sample.gui.NovaGui; -import java.util.Optional; +import nova.core.component.renderer.StaticRenderer; +import nova.core.render.model.MeshModel; +import nova.core.render.pipeline.BlockRenderPipeline; /** * Literally, this is a test block. @@ -22,13 +23,10 @@ public class BlockSimpleTest extends Block implements Syncable { public Inventory inventory = new InventorySimple(1); public BlockSimpleTest() { - add(new StaticBlockRenderer(this)).setTexture((dir) -> Optional.of(NovaGui.steelTexture)); - - add(new Collider(this)); - - add(new ItemRenderer(this)); - - add(new Category("buildingBlocks")); + components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaGui.steelTexture).build())); + components.add(new Collider(this)); + components.add(new ItemRenderer(this)); + components.add(new Category("buildingBlocks")); events.on(RightClickEvent.class).bind(this::onRightClick); } @@ -49,9 +47,4 @@ public void read(Packet packet) { public void write(Packet packet) { packet.writeInt(1234); } - - @Override - public String getID() { - return "gui"; - } } diff --git a/gui/src/main/resources/assets/novagui/textures/blocks/blockSteel.png b/gui/src/main/resources/assets/novagui/textures/blocks/block_steel.png similarity index 100% rename from gui/src/main/resources/assets/novagui/textures/blocks/blockSteel.png rename to gui/src/main/resources/assets/novagui/textures/blocks/block_steel.png diff --git a/item/build.gradle b/item/build.gradle index af95ad0..7a555e3 100644 --- a/item/build.gradle +++ b/item/build.gradle @@ -1,2 +1,4 @@ -version = "0.1" +version = "0.1.0-SNAPSHOT" group = "nova.sample.item" + +archivesBaseName = "NOVA-Example-Item" diff --git a/item/src/main/java/nova/sample/item/ItemScrewdriver.java b/item/src/main/java/nova/sample/item/ItemScrewdriver.java index b9a46e2..0b93c03 100644 --- a/item/src/main/java/nova/sample/item/ItemScrewdriver.java +++ b/item/src/main/java/nova/sample/item/ItemScrewdriver.java @@ -10,15 +10,9 @@ public class ItemScrewdriver extends Item { public ItemScrewdriver() { - add(new Category("tools")); - add(new ItemRenderer()) - .setTexture(NovaItem.screwTexture); + components.add(new Category("tools")); + components.add(new ItemRenderer()).setTexture(NovaItem.screwTexture); // TODO: Deprecated events.on(UseEvent.class).bind(event -> event.action = true); } - - @Override - public String getID() { - return "testscrewdriver"; - } } diff --git a/item/src/main/java/nova/sample/item/NovaItem.java b/item/src/main/java/nova/sample/item/NovaItem.java index 47ee2f6..80b45a1 100644 --- a/item/src/main/java/nova/sample/item/NovaItem.java +++ b/item/src/main/java/nova/sample/item/NovaItem.java @@ -3,7 +3,7 @@ import nova.core.item.ItemFactory; import nova.core.item.ItemManager; import nova.core.loader.Loadable; -import nova.core.loader.NovaMod; +import nova.core.loader.Mod; import nova.core.recipes.Recipe; import nova.core.recipes.RecipeManager; import nova.core.recipes.crafting.ItemIngredient; @@ -14,30 +14,33 @@ /** * Created by magik6k on 5/29/15. */ -@NovaMod(id = NovaItem.id, name = "Nova Example Item", version = "0.0.1", novaVersion = "0.0.1") +@Mod(id = NovaItem.MOD_ID, name = "Nova Example Item", version = "0.0.1", novaVersion = "0.0.1") public class NovaItem implements Loadable { - public static final String id = "novaitem"; + public static final String MOD_ID = "novaitem"; - public static ItemFactory itemScrewdriver; - public static ItemTexture screwTexture; + public static ItemFactory itemScrewdriver; + public static ItemTexture screwTexture; - public final ItemManager itemManager; - public final RenderManager renderManager; - public final RecipeManager recipeManager; + public final ItemManager itemManager; + public final RenderManager renderManager; + public final RecipeManager recipeManager; - public NovaItem(ItemManager itemManager, RenderManager renderManager, RecipeManager recipeManager) { + public NovaItem(ItemManager itemManager, + RenderManager renderManager, + RecipeManager recipeManager) { this.itemManager = itemManager; this.renderManager = renderManager; this.recipeManager = recipeManager; } - @Override - public void preInit() { - screwTexture = renderManager.registerTexture(new ItemTexture(id, "screwdriver")); - itemScrewdriver = itemManager.register(ItemScrewdriver.class); + @Override + public void preInit() { + screwTexture = renderManager.registerTexture(new ItemTexture(MOD_ID, "screwdriver")); + itemScrewdriver = itemManager.register(MOD_ID + ":testscrewdriver", ItemScrewdriver::new); - ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too - ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); - recipeManager.addRecipe(new ShapedCraftingRecipe(itemScrewdriver.makeItem(), "A- B", ingotIngredient, stickIngredient)); - } + //ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too + ItemIngredient stickIngredient = ItemIngredient.forDictionary("stickWood"); + ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); + recipeManager.addRecipe(new ShapedCraftingRecipe(itemScrewdriver.build(), "A- B", true, ingotIngredient, stickIngredient)); + } } diff --git a/settings.gradle b/settings.gradle index 03c7cce..53a6912 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'NovaExample' +rootProject.name = 'NOVA-Example' include 'block' include 'entity' diff --git a/worldgen/build.gradle b/worldgen/build.gradle index c9b9688..c502f49 100644 --- a/worldgen/build.gradle +++ b/worldgen/build.gradle @@ -1,6 +1,8 @@ -version = "0.1" +version = "0.1.0-SNAPSHOT" group = "nova.sample.worldgen" +archivesBaseName = "NOVA-Example-Worldgen" + dependencies { - compile "nova.worldgen:NOVA-Worldgen:0.0.1-SNAPSHOT" + compile group: "nova.worldgen", name: "NOVA-Worldgen", version: "0.0.1-SNAPSHOT", changing: true } \ No newline at end of file diff --git a/worldgen/src/main/java/nova/sample/worldgen/BlockSteelOre.java b/worldgen/src/main/java/nova/sample/worldgen/BlockSteelOre.java new file mode 100644 index 0000000..94ee0b2 --- /dev/null +++ b/worldgen/src/main/java/nova/sample/worldgen/BlockSteelOre.java @@ -0,0 +1,28 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package nova.sample.worldgen; + +import nova.core.block.Block; +import nova.core.component.Category; +import nova.core.component.misc.Collider; +import nova.core.component.renderer.ItemRenderer; +import nova.core.component.renderer.StaticRenderer; +import nova.core.render.model.MeshModel; +import nova.core.render.pipeline.BlockRenderPipeline; + +/** + * + * @author ExE Boss + */ +public class BlockSteelOre extends Block { + + public BlockSteelOre() { + components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaWorldgen.steelOreTexture).build())); + components.add(new Collider(this)); + components.add(new ItemRenderer(this)); + components.add(new Category("buildingBlocks")); + } +} diff --git a/worldgen/src/main/java/nova/sample/worldgen/ItemSteelIngot.java b/worldgen/src/main/java/nova/sample/worldgen/ItemSteelIngot.java new file mode 100644 index 0000000..a4fd64a --- /dev/null +++ b/worldgen/src/main/java/nova/sample/worldgen/ItemSteelIngot.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package nova.sample.worldgen; + +import nova.core.component.renderer.ItemRenderer; +import nova.core.item.Item; + +/** + * + * @author ExE Boss + */ +public class ItemSteelIngot extends Item { + + public ItemSteelIngot() { + components.add(new ItemRenderer(this)).setTexture(NovaWorldgen.steelIngotTexture); + } +} diff --git a/worldgen/src/main/java/nova/sample/worldgen/NovaWorldgen.java b/worldgen/src/main/java/nova/sample/worldgen/NovaWorldgen.java index 009d860..f754932 100644 --- a/worldgen/src/main/java/nova/sample/worldgen/NovaWorldgen.java +++ b/worldgen/src/main/java/nova/sample/worldgen/NovaWorldgen.java @@ -1,24 +1,63 @@ package nova.sample.worldgen; +import nova.core.block.BlockFactory; import nova.core.block.BlockManager; +import nova.core.item.ItemFactory; import nova.core.item.ItemManager; import nova.core.loader.Loadable; -import nova.core.loader.NovaMod; +import nova.core.loader.Mod; +import nova.core.recipes.RecipeManager; +import nova.core.render.RenderManager; +import nova.core.render.texture.BlockTexture; +import nova.core.render.texture.ItemTexture; +import nova.core.util.EnumSelector; import nova.worldgen.WorldgenManager; +import nova.worldgen.ore.Ore; +import nova.worldgen.ore.OreHeight; -@NovaMod(id = NovaWorldgen.id, name = "Nova Worldgen Example", version = "0.0.1", novaVersion = "0.0.1") +@Mod(id = NovaWorldgen.MOD_ID, name = "Nova Worldgen Example", version = "0.0.1", novaVersion = "0.0.1") public class NovaWorldgen implements Loadable { - public static final String id = "novaworldgen"; + public static final String MOD_ID = "novaexampleworldgen"; + + public static BlockFactory blockSteelOre; + + public static ItemFactory itemBlockSteelOre; + public static ItemFactory itemSteelIngot; + + public static Ore oreSteel; + + public static BlockTexture steelOreTexture; + public static ItemTexture steelIngotTexture; public final BlockManager blockManager; public final ItemManager itemManager; + public final RenderManager renderManager; + public final RecipeManager recipeManager; public final WorldgenManager worldgenManager; public NovaWorldgen(BlockManager blockManager, ItemManager itemManager, + RenderManager renderManager, + RecipeManager recipeManager, WorldgenManager worldgenManager) { this.blockManager = blockManager; this.itemManager = itemManager; + this.renderManager = renderManager; + this.recipeManager = recipeManager; this.worldgenManager = worldgenManager; } + + @Override + public void preInit() { + steelOreTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "ore_steel")); + steelIngotTexture = renderManager.registerTexture(new ItemTexture(MOD_ID, "ingot_steel")); + + blockSteelOre = blockManager.register(MOD_ID + ":steel_ore", BlockSteelOre::new); + itemSteelIngot = itemManager.register(MOD_ID + ":steel_ingot", ItemSteelIngot::new); + + itemBlockSteelOre = itemManager.getItemFromBlock(blockSteelOre); + + oreSteel = worldgenManager.register(new Ore(MOD_ID + ":steel_ore", blockSteelOre, 1, 1, + EnumSelector.of(OreHeight.class).blockAll().apart(OreHeight.DEEP).lock())); + } } diff --git a/worldgen/src/main/resources/assets/novaexampleworldgen/textures/blocks/ore_steel.png b/worldgen/src/main/resources/assets/novaexampleworldgen/textures/blocks/ore_steel.png new file mode 100644 index 0000000..fc5bb2d Binary files /dev/null and b/worldgen/src/main/resources/assets/novaexampleworldgen/textures/blocks/ore_steel.png differ diff --git a/worldgen/src/main/resources/assets/novaexampleworldgen/textures/items/ingot_steel.png b/worldgen/src/main/resources/assets/novaexampleworldgen/textures/items/ingot_steel.png new file mode 100644 index 0000000..fc5bb2d Binary files /dev/null and b/worldgen/src/main/resources/assets/novaexampleworldgen/textures/items/ingot_steel.png differ