-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
360 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,7 @@ | |
|
||
# Sources | ||
!/src | ||
!/mc17 | ||
!/mc18 | ||
!/minecraft | ||
|
||
# github | ||
!/.gitignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
|
||
!/build.gradle | ||
!/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
subprojects { | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
name "forge" | ||
url "http://files.minecraftforge.net/maven" | ||
} | ||
maven { | ||
name "sonatype" | ||
url "https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
} | ||
dependencies { | ||
// Minecraft 1.11 requires newer ForgeGradle, while 1.7 and 1.8 require older. | ||
classpath 'net.minecraftforge.gradle:ForgeGradle:' + property('forgeGradleVersion') | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
rootProject.name = "NOVA-WORLDGEN" | ||
rootProject.name = "NOVA-Worldgen" | ||
|
||
include "mc17", "mc18" | ||
include "minecraft:1.8" | ||
include "minecraft:1.7" |
38 changes: 38 additions & 0 deletions
38
src/main/java/nova/internal/worldgen/depmodules/WorldgenModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2017 NOVA, All rights reserved. | ||
* This library is free software, licensed under GNU Lesser General Public License version 3 | ||
* | ||
* This file is part of NOVA. | ||
* | ||
* NOVA is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* NOVA is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with NOVA. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package nova.internal.worldgen.depmodules; | ||
|
||
import nova.worldgen.WorldgenManager; | ||
import nova.worldgen.world.WorldInfo; | ||
import se.jbee.inject.bind.BinderModule; | ||
import se.jbee.inject.util.Scoped; | ||
|
||
/** | ||
* | ||
* @author ExE Boss | ||
*/ | ||
public class WorldgenModule extends BinderModule { | ||
|
||
@Override | ||
protected void declare() { | ||
per(Scoped.APPLICATION).bind(WorldgenManager.class).toConstructor(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2015 NOVA, All rights reserved. | ||
* This library is free software, licensed under GNU Lesser General Public License version 3 | ||
* | ||
* This file is part of NOVA. | ||
* | ||
* NOVA is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* NOVA is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with NOVA. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package nova.worldgen; | ||
|
||
import nova.worldgen.generator.Generator; | ||
import nova.core.event.bus.GlobalEvents; | ||
import nova.core.util.registry.Manager; | ||
import nova.core.util.registry.Registry; | ||
import nova.worldgen.event.WorldgenEvent; | ||
import nova.worldgen.ore.Ore; | ||
import nova.worldgen.world.WorldInfo; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* | ||
* @author ExE Boss | ||
*/ | ||
public class WorldgenManager extends Manager<WorldgenManager> { | ||
public final Registry<Generator> registry; | ||
|
||
private final WorldInfo worldInfo; | ||
private final GlobalEvents events; | ||
|
||
public WorldgenManager(Registry<Generator> registry, GlobalEvents events, WorldInfo worldInfo) { | ||
this.registry = registry; | ||
this.events = events; | ||
this.worldInfo = worldInfo; | ||
} | ||
|
||
public Ore register(Ore ore) { | ||
WorldgenEvent.Register<Ore> event = new WorldgenEvent.Register<>(ore); | ||
this.events.publish(event); | ||
registry.register(event.generable); | ||
return event.generable; | ||
} | ||
|
||
public Optional<Generator> get(String ID) { | ||
return registry.get(ID); | ||
} | ||
|
||
public WorldInfo getWorldInfo() { | ||
return this.worldInfo; | ||
} | ||
|
||
@Override | ||
public void init() { | ||
this.events.publish(new Init(this)); | ||
} | ||
|
||
public class Init extends ManagerEvent<WorldgenManager> { | ||
public Init(WorldgenManager manager) { | ||
super(manager); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2015 NOVA, All rights reserved. | ||
* This library is free software, licensed under GNU Lesser General Public License version 3 | ||
* | ||
* This file is part of NOVA. | ||
* | ||
* NOVA is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* NOVA is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with NOVA. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package nova.worldgen.event; | ||
|
||
import nova.core.event.bus.CancelableEvent; | ||
import nova.worldgen.generator.Generator; | ||
import nova.worldgen.ore.Ore; | ||
|
||
/** | ||
* | ||
* @author ExE Boss | ||
*/ | ||
public abstract class WorldgenEvent extends CancelableEvent { | ||
|
||
public static class Register<T extends Generator> extends CancelableEvent { | ||
public T generable; | ||
|
||
public Register(T generable) { | ||
this.generable = generable; | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/nova/worldgen/generator/CustomGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2017 NOVA, All rights reserved. | ||
* This library is free software, licensed under GNU Lesser General Public License version 3 | ||
* | ||
* This file is part of NOVA. | ||
* | ||
* NOVA is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* NOVA is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with NOVA. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package nova.worldgen.generator; | ||
|
||
import nova.core.world.World; | ||
import nova.worldgen.WorldgenManager; | ||
import nova.worldgen.world.WorldInfo; | ||
|
||
import java.util.Random; | ||
|
||
/** | ||
* This is a black box generator. | ||
* Unlike {@link nova.worldgen.ore.Ore}, | ||
* this one is implemented by the mod, not the game. | ||
* | ||
* @author ExE Boss | ||
*/ | ||
public abstract class CustomGenerator extends Generator { | ||
|
||
protected final WorldgenManager worldgenManager; | ||
|
||
public CustomGenerator(String id, WorldgenManager worldgenManager) { | ||
super(id); | ||
this.worldgenManager = worldgenManager; | ||
} | ||
|
||
public abstract void generate(Random random, int chunkX, int chunkZ, double worldScale, World worlda, WorldInfo worldInfo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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.worldgen.generator; | ||
|
||
import nova.core.util.Identifiable; | ||
|
||
/** | ||
* This class describes a structure that will be generated | ||
* in the world by the world generator. | ||
* | ||
* @author ExE Boss | ||
*/ | ||
public abstract class Generator implements Identifiable { | ||
public final String id; | ||
|
||
public Generator(String id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public final String getID() { | ||
return id; | ||
} | ||
} |
Oops, something went wrong.