Removed the biome decoration Mixin
This commit is contained in:
parent
cbcde8c458
commit
b6ec851878
12 changed files with 188 additions and 209 deletions
|
@ -8,9 +8,10 @@
|
|||
|
||||
package biomesoplenty.api.biome;
|
||||
|
||||
import java.util.Map;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry.GenerationManager;
|
||||
|
||||
public interface IExtendedBiome
|
||||
{
|
||||
public BiomeOwner getBiomeOwner();
|
||||
public GenerationManager getGenerationManager();
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2015, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
|
||||
package biomesoplenty.api.biome;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
|
||||
|
||||
public interface IExtendedDecorator
|
||||
{
|
||||
public void addGenerator(String key, IGenerator<?> generator, Decorate.EventType nextFeature);
|
||||
public void addGenerator(String key, IGenerator<?> generator);
|
||||
|
||||
public void configureGenerators(Map<String, IGenerator<?>> generatorMap);
|
||||
|
||||
public Map<String, IGenerator<?>> getGeneratorMap();
|
||||
public Decorate.EventType getGeneratorStage(String key);
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2015, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
|
||||
package biomesoplenty.common.biome;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import biomesoplenty.api.biome.BiomeOwner;
|
||||
import biomesoplenty.api.biome.IExtendedBiome;
|
||||
import biomesoplenty.api.biome.IGenerator;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
|
||||
|
||||
public class ExtendedBiomeRegistry
|
||||
{
|
||||
private static Map<BiomeGenBase, BiomeExtension> externalExtensions = new HashMap();
|
||||
|
||||
public static BiomeExtension createExtension(BiomeGenBase biome)
|
||||
{
|
||||
return externalExtensions.put(biome, new BiomeExtension(biome));
|
||||
}
|
||||
|
||||
public static IExtendedBiome getExtension(BiomeGenBase biome)
|
||||
{
|
||||
if (biome instanceof IExtendedBiome)
|
||||
{
|
||||
return (IExtendedBiome)biome;
|
||||
}
|
||||
else if (externalExtensions.containsKey(biome))
|
||||
{
|
||||
return externalExtensions.get(biome);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class BiomeExtension implements IExtendedBiome
|
||||
{
|
||||
public BiomeGenBase biome;
|
||||
private GenerationManager generationManager = new GenerationManager();
|
||||
|
||||
private BiomeExtension(BiomeGenBase biome)
|
||||
{
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeOwner getBiomeOwner()
|
||||
{
|
||||
return BiomeOwner.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenerationManager getGenerationManager()
|
||||
{
|
||||
return this.generationManager;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GenerationManager
|
||||
{
|
||||
private Map<String, IGenerator<?>> generatorMap = new HashMap();
|
||||
//TODO: Come up with a better sequencing system
|
||||
private Map<String, Decorate.EventType> generatorSequenceMap = new HashMap();;
|
||||
|
||||
public void addGenerator(String key, IGenerator<?> generator, Decorate.EventType nextFeature)
|
||||
{
|
||||
this.generatorMap.put(key, generator);
|
||||
this.generatorSequenceMap.put(key, nextFeature);
|
||||
}
|
||||
|
||||
public void addGenerator(String key, IGenerator<?> generator)
|
||||
{
|
||||
this.addGenerator(key, generator, Decorate.EventType.CUSTOM);
|
||||
}
|
||||
|
||||
public void configureGenerators(Map<String, IGenerator<?>> generatorMap)
|
||||
{
|
||||
this.generatorMap.putAll(generatorMap);
|
||||
}
|
||||
|
||||
public Map<String, IGenerator<?>> getGeneratorMap()
|
||||
{
|
||||
return Collections.unmodifiableMap(this.generatorMap);
|
||||
}
|
||||
|
||||
public Decorate.EventType getGeneratorStage(String key)
|
||||
{
|
||||
return generatorSequenceMap.get(key);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ package biomesoplenty.common.config;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
@ -21,8 +22,8 @@ import org.apache.commons.io.FileUtils;
|
|||
|
||||
import biomesoplenty.api.biome.BiomeOwner;
|
||||
import biomesoplenty.api.biome.IExtendedBiome;
|
||||
import biomesoplenty.api.biome.IExtendedDecorator;
|
||||
import biomesoplenty.api.biome.IGenerator;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry.GenerationManager;
|
||||
import biomesoplenty.common.decoration.extensions.IExtendedCactusGen;
|
||||
import biomesoplenty.common.util.config.JsonBiome;
|
||||
import biomesoplenty.common.util.config.JsonEntitySpawn;
|
||||
|
@ -31,58 +32,13 @@ import com.google.gson.JsonSyntaxException;
|
|||
|
||||
public class BiomeConfigurationHandler
|
||||
{
|
||||
private static HashMap<BiomeGenBase, String> configFileMap = new HashMap();
|
||||
private static Map<BiomeGenBase, String> configFileMap = new HashMap();
|
||||
|
||||
public static void init(File configDirectory)
|
||||
{
|
||||
registerConfigurableBiomes();
|
||||
load(configDirectory);
|
||||
}
|
||||
|
||||
private static void registerConfigurableBiomes()
|
||||
{
|
||||
registerConfigurableBiome(BiomeGenBase.ocean, "ocean");
|
||||
registerConfigurableBiome(BiomeGenBase.plains, "plains");
|
||||
registerConfigurableBiome(BiomeGenBase.desert, "desert");
|
||||
registerConfigurableBiome(BiomeGenBase.extremeHills, "extreme_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.forest, "forest");
|
||||
registerConfigurableBiome(BiomeGenBase.taiga, "taiga");
|
||||
registerConfigurableBiome(BiomeGenBase.swampland, "swampland");
|
||||
registerConfigurableBiome(BiomeGenBase.river, "river");
|
||||
registerConfigurableBiome(BiomeGenBase.hell, "hell");
|
||||
registerConfigurableBiome(BiomeGenBase.sky, "sky");
|
||||
registerConfigurableBiome(BiomeGenBase.frozenOcean, "frozen_ocean");
|
||||
registerConfigurableBiome(BiomeGenBase.frozenRiver, "frozen_river");
|
||||
registerConfigurableBiome(BiomeGenBase.icePlains, "ice_plains");
|
||||
registerConfigurableBiome(BiomeGenBase.iceMountains, "ice_mountains");
|
||||
registerConfigurableBiome(BiomeGenBase.mushroomIsland, "mushroom_island");
|
||||
registerConfigurableBiome(BiomeGenBase.mushroomIslandShore, "mushroom_island_shore");
|
||||
registerConfigurableBiome(BiomeGenBase.beach, "beach");
|
||||
registerConfigurableBiome(BiomeGenBase.desertHills, "beach_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.forestHills, "forest_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.taigaHills, "taiga_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.extremeHillsEdge, "extreme_hills_edge");
|
||||
registerConfigurableBiome(BiomeGenBase.jungle, "jungle");
|
||||
registerConfigurableBiome(BiomeGenBase.jungleHills, "jungle_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.jungleEdge, "jungle_edge");
|
||||
registerConfigurableBiome(BiomeGenBase.deepOcean, "deep_ocean");
|
||||
registerConfigurableBiome(BiomeGenBase.stoneBeach, "stone_beach");
|
||||
registerConfigurableBiome(BiomeGenBase.coldBeach, "cold_beach");
|
||||
registerConfigurableBiome(BiomeGenBase.birchForest, "birch_forest");
|
||||
registerConfigurableBiome(BiomeGenBase.birchForestHills, "birch_forest_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.roofedForest, "roofed_forest");
|
||||
registerConfigurableBiome(BiomeGenBase.coldTaiga, "cold_taiga");
|
||||
registerConfigurableBiome(BiomeGenBase.coldTaigaHills, "cold_taiga_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.megaTaiga, "mega_taiga");
|
||||
registerConfigurableBiome(BiomeGenBase.megaTaigaHills, "mega_taiga_hills");
|
||||
registerConfigurableBiome(BiomeGenBase.extremeHillsPlus, "extreme_hills_plus");
|
||||
registerConfigurableBiome(BiomeGenBase.savanna, "savanna");
|
||||
registerConfigurableBiome(BiomeGenBase.savannaPlateau, "savanna_plateau");
|
||||
registerConfigurableBiome(BiomeGenBase.mesa, "mesa");
|
||||
registerConfigurableBiome(BiomeGenBase.mesaPlateau_F, "mesa_plateau_f");
|
||||
registerConfigurableBiome(BiomeGenBase.mesaPlateau, "mesa_plateau");
|
||||
}
|
||||
|
||||
private static void load(File configDirectory)
|
||||
{
|
||||
for (Entry<BiomeGenBase, String> entry : configFileMap.entrySet())
|
||||
|
@ -122,16 +78,10 @@ public class BiomeConfigurationHandler
|
|||
}
|
||||
}
|
||||
|
||||
public static void registerConfigurableBiome(BiomeGenBase biome, String configFileName)
|
||||
public static void translateVanillaValues(BiomeGenBase biome)
|
||||
{
|
||||
translateVanillaValues(biome);
|
||||
configFileMap.put(biome, configFileName);
|
||||
}
|
||||
|
||||
private static void translateVanillaValues(BiomeGenBase biome)
|
||||
{
|
||||
IExtendedBiome extendedBiome = (IExtendedBiome) biome;
|
||||
IExtendedDecorator extendedDecorator = (IExtendedDecorator) biome.theBiomeDecorator;
|
||||
IExtendedBiome extendedBiome = ExtendedBiomeRegistry.getExtension(biome);
|
||||
GenerationManager generationManager = extendedBiome.getGenerationManager();
|
||||
|
||||
if (extendedBiome.getBiomeOwner() == BiomeOwner.OTHER)
|
||||
{
|
||||
|
@ -141,7 +91,7 @@ public class BiomeConfigurationHandler
|
|||
IExtendedCactusGen extendedCactusGen = (IExtendedCactusGen) cactusGen;
|
||||
|
||||
extendedCactusGen.setCactiPerChunk(biome.theBiomeDecorator.cactiPerChunk);
|
||||
extendedDecorator.addGenerator("cactus", extendedCactusGen, Decorate.EventType.CACTUS);
|
||||
generationManager.addGenerator("cactus", extendedCactusGen, Decorate.EventType.CACTUS);
|
||||
biome.theBiomeDecorator.cactiPerChunk = 0;
|
||||
}
|
||||
}
|
||||
|
@ -161,8 +111,13 @@ public class BiomeConfigurationHandler
|
|||
biome.waterColorMultiplier = jsonBiome.waterColorMultiplier;
|
||||
JsonEntitySpawn.addBiomeEntitySpawns(biome, jsonBiome);
|
||||
|
||||
IExtendedDecorator extendedDecorator = (IExtendedDecorator) biome.theBiomeDecorator;
|
||||
GenerationManager generationManager = ExtendedBiomeRegistry.getExtension(biome).getGenerationManager();
|
||||
|
||||
extendedDecorator.configureGenerators(jsonBiome.decoration);
|
||||
generationManager.configureGenerators(jsonBiome.decoration);
|
||||
}
|
||||
|
||||
public static Map<BiomeGenBase, String> getConfigFileMap()
|
||||
{
|
||||
return BiomeConfigurationHandler.configFileMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,9 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import biomesoplenty.api.biome.IExtendedDecorator;
|
||||
import biomesoplenty.api.biome.IGenerator;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry.GenerationManager;
|
||||
|
||||
public class DecorateBiomeEventHandler
|
||||
{
|
||||
|
@ -26,14 +27,14 @@ public class DecorateBiomeEventHandler
|
|||
World world = event.world;
|
||||
BlockPos pos = event.pos.add(16, 0, 16);
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
|
||||
IExtendedDecorator extendedDecorator = (IExtendedDecorator)biome.theBiomeDecorator;
|
||||
GenerationManager generationManager = ExtendedBiomeRegistry.getExtension(biome).getGenerationManager();
|
||||
|
||||
for (Entry<String, IGenerator<?>> entry : extendedDecorator.getGeneratorMap().entrySet())
|
||||
for (Entry<String, IGenerator<?>> entry : generationManager.getGeneratorMap().entrySet())
|
||||
{
|
||||
String key = entry.getKey();
|
||||
IGenerator<?> generator = entry.getValue();
|
||||
|
||||
if (extendedDecorator.getGeneratorStage(key) == event.type)
|
||||
if (generationManager.getGeneratorStage(key) == event.type)
|
||||
{
|
||||
generator.generate(world, event.rand, event.pos);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
|
||||
package biomesoplenty.common.init;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry;
|
||||
import biomesoplenty.common.config.BiomeConfigurationHandler;
|
||||
import biomesoplenty.common.world.WorldTypeBOP;
|
||||
|
||||
public class ModBiomes
|
||||
|
@ -17,5 +20,59 @@ public class ModBiomes
|
|||
public static void init()
|
||||
{
|
||||
worldTypeBOP = new WorldTypeBOP();
|
||||
|
||||
registerExternalBiomes();
|
||||
}
|
||||
|
||||
private static void registerExternalBiomes()
|
||||
{
|
||||
registerExternalBiome(BiomeGenBase.ocean, "ocean");
|
||||
registerExternalBiome(BiomeGenBase.plains, "plains");
|
||||
registerExternalBiome(BiomeGenBase.desert, "desert");
|
||||
registerExternalBiome(BiomeGenBase.extremeHills, "extreme_hills");
|
||||
registerExternalBiome(BiomeGenBase.forest, "forest");
|
||||
registerExternalBiome(BiomeGenBase.taiga, "taiga");
|
||||
registerExternalBiome(BiomeGenBase.swampland, "swampland");
|
||||
registerExternalBiome(BiomeGenBase.river, "river");
|
||||
registerExternalBiome(BiomeGenBase.hell, "hell");
|
||||
registerExternalBiome(BiomeGenBase.sky, "sky");
|
||||
registerExternalBiome(BiomeGenBase.frozenOcean, "frozen_ocean");
|
||||
registerExternalBiome(BiomeGenBase.frozenRiver, "frozen_river");
|
||||
registerExternalBiome(BiomeGenBase.icePlains, "ice_plains");
|
||||
registerExternalBiome(BiomeGenBase.iceMountains, "ice_mountains");
|
||||
registerExternalBiome(BiomeGenBase.mushroomIsland, "mushroom_island");
|
||||
registerExternalBiome(BiomeGenBase.mushroomIslandShore, "mushroom_island_shore");
|
||||
registerExternalBiome(BiomeGenBase.beach, "beach");
|
||||
registerExternalBiome(BiomeGenBase.desertHills, "beach_hills");
|
||||
registerExternalBiome(BiomeGenBase.forestHills, "forest_hills");
|
||||
registerExternalBiome(BiomeGenBase.taigaHills, "taiga_hills");
|
||||
registerExternalBiome(BiomeGenBase.extremeHillsEdge, "extreme_hills_edge");
|
||||
registerExternalBiome(BiomeGenBase.jungle, "jungle");
|
||||
registerExternalBiome(BiomeGenBase.jungleHills, "jungle_hills");
|
||||
registerExternalBiome(BiomeGenBase.jungleEdge, "jungle_edge");
|
||||
registerExternalBiome(BiomeGenBase.deepOcean, "deep_ocean");
|
||||
registerExternalBiome(BiomeGenBase.stoneBeach, "stone_beach");
|
||||
registerExternalBiome(BiomeGenBase.coldBeach, "cold_beach");
|
||||
registerExternalBiome(BiomeGenBase.birchForest, "birch_forest");
|
||||
registerExternalBiome(BiomeGenBase.birchForestHills, "birch_forest_hills");
|
||||
registerExternalBiome(BiomeGenBase.roofedForest, "roofed_forest");
|
||||
registerExternalBiome(BiomeGenBase.coldTaiga, "cold_taiga");
|
||||
registerExternalBiome(BiomeGenBase.coldTaigaHills, "cold_taiga_hills");
|
||||
registerExternalBiome(BiomeGenBase.megaTaiga, "mega_taiga");
|
||||
registerExternalBiome(BiomeGenBase.megaTaigaHills, "mega_taiga_hills");
|
||||
registerExternalBiome(BiomeGenBase.extremeHillsPlus, "extreme_hills_plus");
|
||||
registerExternalBiome(BiomeGenBase.savanna, "savanna");
|
||||
registerExternalBiome(BiomeGenBase.savannaPlateau, "savanna_plateau");
|
||||
registerExternalBiome(BiomeGenBase.mesa, "mesa");
|
||||
registerExternalBiome(BiomeGenBase.mesaPlateau_F, "mesa_plateau_f");
|
||||
registerExternalBiome(BiomeGenBase.mesaPlateau, "mesa_plateau");
|
||||
}
|
||||
|
||||
private static void registerExternalBiome(BiomeGenBase biome, String id)
|
||||
{
|
||||
ExtendedBiomeRegistry.createExtension(biome);
|
||||
BiomeConfigurationHandler.translateVanillaValues(biome);
|
||||
BiomeConfigurationHandler.getConfigFileMap().put(biome, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,11 @@ import biomesoplenty.common.config.BiomeConfigurationHandler;
|
|||
public class ModConfiguration
|
||||
{
|
||||
public static void init(File configDirectory)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void initEnd(File configDirectory)
|
||||
{
|
||||
BiomeConfigurationHandler.init(new File(configDirectory, "biomes"));
|
||||
}
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2015, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
|
||||
package biomesoplenty.common.mixin.biome;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.world.biome.BiomeDecorator;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import biomesoplenty.api.biome.IExtendedDecorator;
|
||||
import biomesoplenty.api.biome.IGenerator;
|
||||
|
||||
@Mixin(BiomeDecorator.class)
|
||||
public class MixinBiomeDecorator implements IExtendedDecorator
|
||||
{
|
||||
private Map<String, IGenerator<?>> generatorMap;
|
||||
//TODO: Come up with a better sequencing system
|
||||
private Map<String, Decorate.EventType> generatorSequenceMap;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void onConstructed(CallbackInfo callbackInfo)
|
||||
{
|
||||
this.generatorMap = new HashMap();
|
||||
this.generatorSequenceMap = new HashMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGenerator(String key, IGenerator<?> generator, Decorate.EventType nextFeature)
|
||||
{
|
||||
this.generatorMap.put(key, generator);
|
||||
this.generatorSequenceMap.put(key, nextFeature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGenerator(String key, IGenerator<?> generator)
|
||||
{
|
||||
this.addGenerator(key, generator, Decorate.EventType.CUSTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureGenerators(Map<String, IGenerator<?>> generatorMap)
|
||||
{
|
||||
this.generatorMap.putAll(generatorMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, IGenerator<?>> getGeneratorMap()
|
||||
{
|
||||
return Collections.unmodifiableMap(this.generatorMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Decorate.EventType getGeneratorStage(String key)
|
||||
{
|
||||
return generatorSequenceMap.get(key);
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2015, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
|
||||
package biomesoplenty.common.mixin.biome;
|
||||
|
||||
import net.minecraft.world.biome.BiomeDecorator;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import biomesoplenty.api.biome.BiomeOwner;
|
||||
import biomesoplenty.api.biome.IExtendedBiome;
|
||||
|
||||
@Mixin(BiomeGenBase.class)
|
||||
public abstract class MixinBiomeGenBase implements IExtendedBiome
|
||||
{
|
||||
@Shadow
|
||||
public BiomeDecorator theBiomeDecorator;
|
||||
|
||||
private BiomeOwner biomeOwner;
|
||||
|
||||
@Inject(method = "<init>(IZ)V", at = @At("RETURN"))
|
||||
private void onConstructed(int biomeId, boolean register, CallbackInfo callbackInfo)
|
||||
{
|
||||
this.biomeOwner = BiomeOwner.OTHER;
|
||||
|
||||
//Prevents Forge from wiping all of our added data
|
||||
this.theBiomeDecorator = new BiomeDecorator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeOwner getBiomeOwner()
|
||||
{
|
||||
return biomeOwner;
|
||||
}
|
||||
}
|
|
@ -13,8 +13,9 @@ import java.util.Map;
|
|||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import biomesoplenty.api.biome.IExtendedDecorator;
|
||||
import biomesoplenty.api.biome.IGenerator;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry;
|
||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry.GenerationManager;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
|
@ -53,9 +54,9 @@ public class JsonBiome
|
|||
biome.waterColorMultiplier = baseBiome.waterColorMultiplier;
|
||||
biome.entities = JsonEntitySpawn.getBiomeEntitySpawns(baseBiome);
|
||||
|
||||
IExtendedDecorator extendedDecorator = (IExtendedDecorator) baseBiome.theBiomeDecorator;
|
||||
GenerationManager generationManager = ExtendedBiomeRegistry.getExtension(baseBiome).getGenerationManager();
|
||||
|
||||
biome.decoration = extendedDecorator.getGeneratorMap();
|
||||
biome.decoration = generationManager.getGeneratorMap();
|
||||
|
||||
return biome;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public class BiomesOPlenty
|
|||
ModBlocks.init();
|
||||
ModBiomes.init();
|
||||
ModHandlers.init();
|
||||
ModConfiguration.initEnd(configDirectory);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
"package": "biomesoplenty.common.mixin",
|
||||
"mixins": [
|
||||
"biome.MixinBiomeDecorator",
|
||||
"biome.MixinBiomeGenBase",
|
||||
"decoration.MixinWorldGenCactus"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue