Skip to content

Instantly share code, notes, and snippets.

@killerjdog51
Created January 25, 2016 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save killerjdog51/f561d8df8fc7a68d3339 to your computer and use it in GitHub Desktop.
Save killerjdog51/f561d8df8fc7a68d3339 to your computer and use it in GitHub Desktop.
package com.chocolatemod.worldgen;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MapGenChocolateStructureIO
{
private static final Logger logger = LogManager.getLogger();
private static Map field_143040_a = new HashMap();
private static Map field_143038_b = new HashMap();
private static Map field_143039_c = new HashMap();
private static Map field_143037_d = new HashMap();
private static final String __OBFID = "CL_00000509";
public static void registerStructure(Class p_143034_0_, String p_143034_1_)
{
field_143040_a.put(p_143034_1_, p_143034_0_);
field_143038_b.put(p_143034_0_, p_143034_1_);
}
public static void func_143031_a(Class p_143031_0_, String p_143031_1_)
{
field_143039_c.put(p_143031_1_, p_143031_0_);
field_143037_d.put(p_143031_0_, p_143031_1_);
}
public static String func_143033_a(ChocolateStructureStart chocolateStructureStart)
{
return (String)field_143038_b.get(chocolateStructureStart.getClass());
}
public static String func_143036_a(ChocolateStructureComponent chocolateStructureComponent)
{
return (String)field_143037_d.get(chocolateStructureComponent.getClass());
}
public static ChocolateStructureStart func_143035_a(NBTTagCompound p_143035_0_, World p_143035_1_)
{
ChocolateStructureStart structurestart = null;
try
{
Class oclass = (Class)field_143040_a.get(p_143035_0_.getString("id"));
if (oclass != null)
{
structurestart = (ChocolateStructureStart)oclass.newInstance();
}
}
catch (Exception exception)
{
logger.warn("Failed Start with id " + p_143035_0_.getString("id"));
exception.printStackTrace();
}
if (structurestart != null)
{
structurestart.func_143020_a(p_143035_1_, p_143035_0_);
}
else
{
logger.warn("Skipping Structure with id " + p_143035_0_.getString("id"));
}
return structurestart;
}
public static ChocolateStructureComponent func_143032_b(NBTTagCompound p_143032_0_, World p_143032_1_)
{
ChocolateStructureComponent structurecomponent = null;
try
{
Class oclass = (Class)field_143039_c.get(p_143032_0_.getString("id"));
if (oclass != null)
{
structurecomponent = (ChocolateStructureComponent)oclass.newInstance();
}
}
catch (Exception exception)
{
logger.warn("Failed Piece with id " + p_143032_0_.getString("id"));
exception.printStackTrace();
}
if (structurecomponent != null)
{
structurecomponent.func_143009_a(p_143032_1_, p_143032_0_);
}
else
{
logger.warn("Skipping Piece with id " + p_143032_0_.getString("id"));
}
return structurecomponent;
}
static
{
registerStructure(StructureChocolateMineshaftStart.class, "Chocolate Mineshaft");
// registerStructure(MapGenVillage.Start.class, "Village");
// registerStructure(MapGenNetherBridge.Start.class, "Fortress");
// registerStructure(MapGenStronghold.Start.class, "Stronghold");
// registerStructure(MapGenScatteredFeature.Start.class, "Temple");
StructureChocolateMineshaftPieces.registerStructurePieces();
// StructureVillagePieces.registerVillagePieces();
// StructureNetherBridgePieces.registerNetherFortressPieces();
// StructureStrongholdPieces.registerStrongholdPieces();
// ComponentScatteredFeaturePieces.registerScatteredFeaturePieces();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment