Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
Fix dependency injection + Fix FWWorldGenerator
Browse files Browse the repository at this point in the history
Additional changes: OreGenerationRegistry was replaced with
Registry<Ore>, as it was redundant.
  • Loading branch information
ExE-Boss committed Jan 5, 2017
1 parent 8a80864 commit fa624d1
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import net.minecraftforge.fml.common.registry.GameRegistry;
import nova.core.loader.Loadable;
import nova.core.loader.Mod;
import nova.internal.worldgen.depmodules.WorldgenModule;
import nova.worldgen.WorldgenManager;
import nova.worldgen.wrapper.mc.forge.v1_11.wrapper.world.forward.FWWorldGenerator;

/**
*
* @author ExE Boss
*/
@Mod(id = NovaWorldgenWrapper.id, name = NovaWorldgenWrapper.name, version = NovaWorldgenWrapper.version, novaVersion = "0.0.1")
@Mod(id = NovaWorldgenWrapper.id, name = NovaWorldgenWrapper.name, version = NovaWorldgenWrapper.version, modules = { WorldgenModule.class }, novaVersion = "0.0.1")
public class NovaWorldgenWrapper implements Loadable {

public static final String version = "0.0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public FWWorldGenerator(WorldgenManager worldgenManager) {
this.worldgenManager = worldgenManager;
this.oreGen = new HashMap<>();
Game.events().on(WorldgenEvent.RegisterOre.class).bind(evt -> {
this.oreGen.put(evt.ore, new WorldGenMinable(((Block)Game.natives().toNative(evt.ore.block)).getDefaultState(),
this.oreGen.put(evt.ore, new WorldGenMinable(((Block)Game.natives().toNative(evt.ore.block.build())).getDefaultState(),
(int) Math.round(evt.ore.clusterSize * 5)));
});
}
Expand Down
3 changes: 1 addition & 2 deletions minecraft/1.7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ buildscript {

apply plugin: "maven-publish"
apply plugin: "com.jfrog.artifactory"
//apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle"
apply from: "../../../../.Libraries/java.gradle"
apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle"

publishing {
publications {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import cpw.mods.fml.common.registry.GameRegistry;
import nova.core.loader.Loadable;
import nova.core.loader.Mod;
import nova.internal.worldgen.depmodules.WorldgenModule;
import nova.worldgen.WorldgenManager;
import nova.worldgen.wrapper.mc.forge.v17.wrapper.world.forward.FWWorldGenerator;

/**
*
* @author ExE Boss
*/
@Mod(id = NovaWorldgenWrapper.id, name = NovaWorldgenWrapper.name, version = NovaWorldgenWrapper.version, novaVersion = "0.0.1")
@Mod(id = NovaWorldgenWrapper.id, name = NovaWorldgenWrapper.name, version = NovaWorldgenWrapper.version, modules = { WorldgenModule.class }, novaVersion = "0.0.1")
public class NovaWorldgenWrapper implements Loadable {

public static final String version = "0.0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public FWWorldGenerator(WorldgenManager worldgenManager) {
this.worldgenManager = worldgenManager;
this.oreGen = new HashMap<>();
Game.events().on(WorldgenEvent.RegisterOre.class).bind(evt -> {
this.oreGen.put(evt.ore, new WorldGenMinable(((Block)Game.natives().toNative(evt.ore.block)),
this.oreGen.put(evt.ore, new WorldGenMinable(((Block)Game.natives().toNative(evt.ore.block.build())),
(int) Math.round(evt.ore.clusterSize * 5)));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import net.minecraftforge.fml.common.registry.GameRegistry;
import nova.core.loader.Loadable;
import nova.core.loader.Mod;
import nova.internal.worldgen.depmodules.WorldgenModule;
import nova.worldgen.WorldgenManager;
import nova.worldgen.wrapper.mc.forge.v18.wrapper.world.forward.FWWorldGenerator;

/**
*
* @author ExE Boss
*/
@Mod(id = NovaWorldgenWrapper.id, name = NovaWorldgenWrapper.name, version = NovaWorldgenWrapper.version, novaVersion = "0.0.1")
@Mod(id = NovaWorldgenWrapper.id, name = NovaWorldgenWrapper.name, version = NovaWorldgenWrapper.version, modules = { WorldgenModule.class }, novaVersion = "0.0.1")
public class NovaWorldgenWrapper implements Loadable {

public static final String version = "0.0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public FWWorldGenerator(WorldgenManager worldgenManager) {
this.worldgenManager = worldgenManager;
this.oreGen = new HashMap<>();
Game.events().on(WorldgenEvent.RegisterOre.class).bind(evt -> {
this.oreGen.put(evt.ore, new WorldGenMinable(((Block)Game.natives().toNative(evt.ore.block)).getDefaultState(),
this.oreGen.put(evt.ore, new WorldGenMinable(((Block)Game.natives().toNative(evt.ore.block.build())).getDefaultState(),
(int) Math.round(evt.ore.clusterSize * 5)));
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 NOVA, All rights reserved.
* 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.
Expand All @@ -18,10 +18,20 @@
* along with NOVA. If not, see <http://www.gnu.org/licenses/>.
*/

package nova.worldgen.ore;
package nova.internal.worldgen.depmodules;

import nova.core.util.registry.Registry;
import nova.worldgen.WorldgenManager;
import se.jbee.inject.bind.BinderModule;
import se.jbee.inject.util.Scoped;

public class OreGenerationRegistry extends Registry<Ore> {
/**
*
* @author ExE Boss
*/
public class WorldgenModule extends BinderModule {

@Override
protected void declare() {
per(Scoped.APPLICATION).bind(WorldgenManager.class).toConstructor();
}
}
2 changes: 1 addition & 1 deletion src/main/java/nova/worldgen/Generable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class Generable implements Identifiable {
public final String id;

public Generable(String id) {
this.id = Identifiable.addPrefix(id, false);
this.id = id;
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/nova/worldgen/WorldgenManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import nova.internal.core.Game;
import nova.worldgen.event.WorldgenEvent;
import nova.worldgen.ore.Ore;
import nova.worldgen.ore.OreGenerationRegistry;

import java.util.Optional;

Expand All @@ -36,7 +35,7 @@
public class WorldgenManager extends Manager<WorldgenManager> {
public final Registry<Ore> registry;

public WorldgenManager(OreGenerationRegistry registry) {
public WorldgenManager(Registry<Ore> registry) {
this.registry = registry;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/nova/worldgen/event/WorldgenEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* 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;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/nova/worldgen/world/WorldInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@

package nova.worldgen.world;

import nova.core.util.registry.Registry;
import nova.core.util.shape.Cuboid;
import nova.worldgen.ore.OreGenerationRegistry;
import nova.worldgen.ore.Ore;

/**
* This class profides information on world that world generator may need
* This class provides information on world that world generator may need
*/
public abstract class WorldInfo {
/**
Expand All @@ -40,5 +41,5 @@ public abstract class WorldInfo {
/**
* @return {@link OreGenerationRegistry} for the world
*/
public abstract OreGenerationRegistry getOreGenerationRegistry();
public abstract Registry<Ore> getOreGenerationRegistry();
}

0 comments on commit fa624d1

Please sign in to comment.