package CustomOreGen.Integration.MystCraft;

import java.util.logging.Level;

import net.minecraft.server.MinecraftServer;
import net.minecraftforge.event.ForgeSubscribe;
import CustomOreGen.CustomOreGenBase;
import CustomOreGen.Server.ServerState;
import CustomOreGen.Server.WorldConfig;
import CustomOreGen.Server.WorldGenSubstitution;
import CustomOreGen.Util.BlockDescriptor;

import com.xcompwiz.mystcraft.api.event.DenseOresEvent;

public class MystcraftObserver {
	private static MystcraftObserver _instance = new MystcraftObserver();
	
	private MystcraftObserver() {
		
	}
	
	public static MystcraftObserver instance() {
		return _instance;
	}
	
    @ForgeSubscribe
    public void onDenseOres(DenseOresEvent event) {
    	ServerState.checkIfServerChanged(MinecraftServer.getServer(), event.worldObj.getWorldInfo());
    	WorldConfig config = ServerState.getWorldConfig(event.worldObj);
    	BlockDescriptor desc = config.getEquivalentBlockDescriptor();
    	WorldGenSubstitution substitution = new WorldGenSubstitution(config.getOreDistributions().size(), true);
    	BlockDescriptor subDesc = (BlockDescriptor) substitution.getDistributionSetting("OreBlock");
    	subDesc.clear();
    	subDesc.add(desc, 0.33F);
    	substitution.populate(event.worldObj, event.xPos, event.zPos);
    }
}

@@ -42,41 +42,8 @@
 t;%0A%0A
-import java.util.logging.Level;%0A%0A
 impo
@@ -87,94 +87,8 @@
 er;%0A
-import net.minecraftforge.event.ForgeSubscribe;%0Aimport CustomOreGen.CustomOreGenBase;%0A
 impo
@@ -258,17 +258,16 @@
 or;%0A
-%0A
 import c
 om.x
@@ -266,49 +266,49 @@
 rt c
-om.xcompwiz.mystcraft.api.event.DenseOres
+pw.mods.fml.common.eventhandler.Subscribe
 Even
@@ -530,19 +530,16 @@
 %09%7D%0A%09
+/*
 %0A    @
-Forge
 Subs
@@ -543,16 +543,21 @@
 ubscribe
+Event
 %0A    pub
@@ -1172,10 +1172,17 @@
 ;%0A    %7D%0A
+    */%0A
 %7D%0A

disable listening to DenseOresEvent; no Mystcraft yet