Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
!/block
!/gui
!/item
!/entity
!/worldgen
!/old
!/guidelines

Expand Down
4 changes: 3 additions & 1 deletion block/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
version = "0.1"
version = "0.1.0-SNAPSHOT"
group = "nova.sample.block"

archivesBaseName = "NOVA-Example-Block"
35 changes: 13 additions & 22 deletions block/src/main/java/nova/sample/block/BlockStateful.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import nova.core.component.Component;
import nova.core.component.Passthrough;
import nova.core.component.misc.Collider;
import nova.core.component.renderer.ItemRenderer;
import nova.core.component.renderer.StaticRenderer;
import nova.core.network.NetworkTarget;
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;
Expand All @@ -32,25 +32,21 @@ public class BlockStateful extends Block implements Storable, Stateful, Syncable
private double angle = 0;

public BlockStateful() {
components.add(new Collider(this).isOpaqueCube(false));
components.add(new StaticRenderer().onRender(model -> {
Model grinderModel = NovaBlock.grinderModel.getModel();

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

add(new StaticRenderer(this)
.setOnRender(model -> {
Model grinderModel = NovaBlock.grinderModel.getModel();
if (grinderModel instanceof MeshModel)
((MeshModel)grinderModel).bindAll(NovaBlock.grinderTexture);

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

model.children.add(grinderModel);
model.bindAll(NovaBlock.grinderTexture);
}
)
);
add(new ItemRenderer(this));
add(new Category("buildingBlocks"));
//add(new TestComponent());
model.children.add(grinderModel);
}));
components.add(new Category("buildingBlocks"));
//components.add(new TestComponent());

events.on(RightClickEvent.class).bind(this::onRightClick);
}
Expand All @@ -70,11 +66,6 @@ public void read(Packet packet) {
world().markStaticRender(position());
}

@Override
public String getID() {
return "stateful";
}

public static interface TestInterface {
public void test();
}
Expand Down
18 changes: 5 additions & 13 deletions block/src/main/java/nova/sample/block/BlockStateless.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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.
Expand All @@ -15,13 +15,10 @@
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 Category("buildingBlocks"));

add(new Collider(this));

add(new ItemRenderer(this));

add(new Category("buildingBlocks"));
events.on(RightClickEvent.class).bind(this::onRightClick);
}

Expand All @@ -39,9 +36,4 @@ public void read(Packet packet) {
public void write(Packet packet) {
packet.writeInt(1234);
}

@Override
public String getID() {
return "simple";
}
}
33 changes: 16 additions & 17 deletions block/src/main/java/nova/sample/block/NovaBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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));
}
}
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -23,12 +22,11 @@ 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"
}
}
}

}
4 changes: 4 additions & 0 deletions entity/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version = "0.1.0-SNAPSHOT"
group = "nova.sample.entity"

archivesBaseName = "NOVA-Example-Entity"
26 changes: 26 additions & 0 deletions entity/src/main/java/nova/sample/entity/NovaEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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;
}
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
version = 0.1.0-SNAPSHOT
group = nova.sample

nova_version = 0.1.0-SNAPSHOT
6 changes: 4 additions & 2 deletions gui/build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
51 changes: 26 additions & 25 deletions gui/src/main/java/nova/sample/gui/NovaGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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)

Expand Down Expand Up @@ -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();
}
Expand Down
Loading