This commit is contained in:
DarkGuardsman 2013-12-23 01:52:13 -05:00
parent c7a572609b
commit e5811d09a7
19 changed files with 244 additions and 284 deletions

View file

@ -2,22 +2,15 @@ package com.builtbroken.assemblyline.api;
import net.minecraftforge.common.ForgeDirection;
/**
* The interface is applied to TileEntities that can rotate.
/** The interface is applied to TileEntities that can rotate.
*
* @author Calclavia
*
*/
* @author Calclavia */
public interface IRotatable
{
/**
* @return Gets the facing direction. Always returns the front side of the block.
*/
public ForgeDirection getDirection();
/** @return Gets the facing direction. Always returns the front side of the block. */
public ForgeDirection getDirection();
/**
* @param Sets the facing direction.
*/
public void setDirection(ForgeDirection direection);
/** @param Sets the facing direction. */
public void setDirection(ForgeDirection direection);
}

View file

@ -4,7 +4,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
/** The interface is applied to Blocks that can rotate.
*
*
* @author DarkGuardsman */
public interface IRotatableBlock

View file

@ -122,6 +122,7 @@ public class ClientProxy extends CommonProxy
return null;
}
@Override
public boolean isCtrKeyDown()
{

View file

@ -36,7 +36,7 @@ public class RenderSteamGen extends TileEntitySpecialRenderer
if (model != null)
{
bindTexture(this.getTexture(meta));
bindTexture(RenderSteamGen.getTexture(meta));
rot1 = MathHelper.wrapAngleTo180_float(rot1 + 1);
GL11.glPushMatrix();

View file

@ -16,9 +16,8 @@ import net.minecraft.world.World;
import com.builtbroken.minecraft.DarkCore;
import com.builtbroken.minecraft.IndustryTabs;
/** Basic item used to spawn a vehicle
*
*
* @author DarkGuardsman */
public class ItemVehicleSpawn extends Item
{

View file

@ -441,7 +441,7 @@ public abstract class TileEntityFluidNetworkTile extends TileEntityFluidDevice i
data[4] = this.renderConnection[3];
data[5] = this.renderConnection[4];
data[6] = this.renderConnection[5];
PacketHandler.instance().sendPacketToClients(PacketHandler.instance().getTilePacket(DarkCore.CHANNEL,"RenderPacket", this, data));
PacketHandler.instance().sendPacketToClients(PacketHandler.instance().getTilePacket(DarkCore.CHANNEL, "RenderPacket", this, data));
}
public void sendTankUpdate(int index)

View file

@ -23,7 +23,7 @@ public class TileEntitySolarPanel extends TileEntityGenerator
@Override
public void consumeFuel()
{
this.burnTime = BlockSolarPanel.tickRate;
this.burnTime = BlockSolarPanel.tickRate;
if (!this.worldObj.isRemote && this.ticks % BlockSolarPanel.tickRate == 0)
{

View file

@ -11,7 +11,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.vector.Vector3;
@ -22,9 +21,7 @@ import com.builtbroken.assemblyline.api.IArmbot;
import com.builtbroken.assemblyline.api.IArmbotUseable;
import com.builtbroken.assemblyline.api.coding.args.ArgumentData;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.DarkCore;
import com.builtbroken.minecraft.TranslationHelper;
import com.builtbroken.minecraft.network.PacketHandler;
import com.builtbroken.minecraft.prefab.TileEntityAdvanced;
import com.builtbroken.minecraft.prefab.TileEntityMulti;
import com.builtbroken.minecraft.prefab.invgui.ISlotPickResult;

View file

@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.blocks.BlockOre.OreData;
public class ItemBlockOre extends ItemBlock
{

View file

@ -153,7 +153,7 @@ public class ItemReadoutTools extends ItemBasic
player.sendChatToPlayer(ChatMessageComponent.createFromText("Network:" + network.toString()));
player.sendChatToPlayer(ChatMessageComponent.createFromText("E~In:" + UnitDisplay.getDisplay(network.getRequest(), Unit.JOULES, 2, false)));
player.sendChatToPlayer(ChatMessageComponent.createFromText("E~Out:" + UnitDisplay.getDisplay(network.getLastBuffer(), Unit.JOULES, 2, false)));
player.sendChatToPlayer(ChatMessageComponent.createFromText("R~Ohm:" + UnitDisplay.getDisplay(network.getAverageResistance(), Unit.RESISTANCE, 2, false)));
player.sendChatToPlayer(ChatMessageComponent.createFromText("R~Ohm:" + UnitDisplay.getDisplay(network.getResistance(), Unit.RESISTANCE, 2, false)));
}
}
else if (tileEntity instanceof IEnergyContainer)

View file

@ -64,6 +64,7 @@ public class TileEntityBatteryBox extends TileEntityEnergyMachine
*
* @return The direction that electricity is entered into the tile. Return null for no input. By
* default you can accept power from all sides. */
@Override
public EnumSet<ForgeDirection> getInputDirections()
{
EnumSet<ForgeDirection> et = EnumSet.allOf(ForgeDirection.class);

View file

@ -19,7 +19,6 @@ import com.builtbroken.common.lang.TextHelper.TextColor;
import com.builtbroken.minecraft.fluid.FluidHelper;
import com.builtbroken.minecraft.interfaces.IBlockActivated;
public class TileEntityInfFluid extends TileEntity implements IFluidHandler, IBlockActivated
{
FluidTank tank = new FluidTank(Integer.MAX_VALUE);

View file

@ -1,7 +1,5 @@
package com.builtbroken.assemblyline.machine.processor;
import universalelectricity.api.item.IElectricalItem;
import ic2.api.item.IElectricItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@ -9,6 +7,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;
import universalelectricity.api.item.IElectricalItem;
import com.builtbroken.minecraft.recipes.MachineRecipeHandler;

View file

@ -16,7 +16,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.oredict.OreDictionary;
import universalelectricity.api.energy.IConductor;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.assemblyline.AssemblyLine;

View file

@ -1,10 +1,8 @@
package com.builtbroken.assemblyline.transmit;
import net.minecraft.block.Block;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.energy.EnergyNetworkLoader;
@ -145,7 +143,7 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor, IS
@Override
public void setNetwork(IEnergyNetwork network)
{
this.network = (EnergyNetwork) network;
this.network = network;
}
@Override
@ -187,6 +185,7 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor, IS
return false;
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{

View file

@ -11,88 +11,77 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.FMLLog;
/**
* This class is used for storing ore generation data. If you are too lazy to generate your own
/** This class is used for storing ore generation data. If you are too lazy to generate your own
* ores, you can do {@link #OreGenerator.addOre()} to add your ore to the list of ores to generate.
*
* @author Calclavia
*
*/
* @author Calclavia */
public abstract class OreGenBase
{
public String name;
public String name;
public String oreDictionaryName;
public String oreDictionaryName;
public boolean shouldGenerate = false;
public boolean shouldGenerate = false;
public int blockIndexTexture;
public int blockIndexTexture;
public ItemStack oreStack;
public ItemStack oreStack;
public int oreID;
public int oreID;
public int oreMeta;
public int oreMeta;
/**
* What harvest level does this machine need to be acquired?
*/
public int harvestLevel;
/** What harvest level does this machine need to be acquired? */
public int harvestLevel;
/**
* The predefined tool classes are "pickaxe", "shovel", "axe". You can add others for custom
* tools.
*/
public String harvestTool;
/** The predefined tool classes are "pickaxe", "shovel", "axe". You can add others for custom
* tools. */
public String harvestTool;
/**
* @param name - The name of the ore for display
* @param textureFile - The 16x16 png texture of your ore to override
* @param minGenerateLevel - The highest generation level of your ore
* @param maxGenerateLevel - The lowest generation level of your ore
* @param amountPerChunk - The amount of ores to generate per chunk
* @param amountPerBranch - The amount of ores to generate in a clutter. E.g coal generates with
* a lot of other coal next to it. How much do you want?
*/
public OreGenBase(String name, String oreDiectionaryName, ItemStack stack, String harvestTool, int harvestLevel)
{
if (stack != null)
{
this.name = name;
this.harvestTool = harvestTool;
this.harvestLevel = harvestLevel;
this.oreDictionaryName = oreDiectionaryName;
this.oreStack = stack;
this.oreID = stack.itemID;
this.oreMeta = stack.getItemDamage();
/** @param name - The name of the ore for display
* @param textureFile - The 16x16 png texture of your ore to override
* @param minGenerateLevel - The highest generation level of your ore
* @param maxGenerateLevel - The lowest generation level of your ore
* @param amountPerChunk - The amount of ores to generate per chunk
* @param amountPerBranch - The amount of ores to generate in a clutter. E.g coal generates with
* a lot of other coal next to it. How much do you want? */
public OreGenBase(String name, String oreDiectionaryName, ItemStack stack, String harvestTool, int harvestLevel)
{
if (stack != null)
{
this.name = name;
this.harvestTool = harvestTool;
this.harvestLevel = harvestLevel;
this.oreDictionaryName = oreDiectionaryName;
this.oreStack = stack;
this.oreID = stack.itemID;
this.oreMeta = stack.getItemDamage();
OreDictionary.registerOre(oreDictionaryName, stack);
MinecraftForge.setBlockHarvestLevel(Block.blocksList[stack.itemID], stack.getItemDamage(), harvestTool, harvestLevel);
}
else
{
FMLLog.severe("ItemStack is null while registering ore generation!");
}
}
OreDictionary.registerOre(oreDictionaryName, stack);
MinecraftForge.setBlockHarvestLevel(Block.blocksList[stack.itemID], stack.getItemDamage(), harvestTool, harvestLevel);
}
else
{
FMLLog.severe("ItemStack is null while registering ore generation!");
}
}
public OreGenBase enable(Configuration config)
{
this.shouldGenerate = shouldGenerateOre(config, this.name);
return this;
}
public OreGenBase enable(Configuration config)
{
this.shouldGenerate = shouldGenerateOre(config, this.name);
return this;
}
/**
* Checks the config file and see if Universal Electricity should generate this ore
*/
private static boolean shouldGenerateOre(Configuration configuration, String oreName)
{
configuration.load();
boolean shouldGenerate = configuration.get("Ore_Generation", "Generate " + oreName, true).getBoolean(true);
configuration.save();
return shouldGenerate;
}
/** Checks the config file and see if Universal Electricity should generate this ore */
private static boolean shouldGenerateOre(Configuration configuration, String oreName)
{
configuration.load();
boolean shouldGenerate = configuration.get("Ore_Generation", "Generate " + oreName, true).getBoolean(true);
configuration.save();
return shouldGenerate;
}
public abstract void generate(World world, Random random, int varX, int varZ);
public abstract void generate(World world, Random random, int varX, int varZ);
public abstract boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator);
public abstract boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator);
}

View file

@ -10,144 +10,137 @@ import net.minecraft.world.gen.ChunkProviderEnd;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.ChunkProviderHell;
/**
* This class is used for storing ore generation data. If you are too lazy to generate your own
/** This class is used for storing ore generation data. If you are too lazy to generate your own
* ores, you can do {@link #OreGenerator.ORES_TO_GENERATE.add()} to add your ore to the list of ores
* to generate.
*
* @author Calclavia
*
*/
* @author Calclavia */
public class OreGenReplace extends OreGenBase
{
public int minGenerateLevel;
public int maxGenerateLevel;
public int amountPerChunk;
public int amountPerBranch;
public int replaceID;
public int minGenerateLevel;
public int maxGenerateLevel;
public int amountPerChunk;
public int amountPerBranch;
public int replaceID;
/**
* Dimensions to ignore ore generation
*/
public boolean ignoreSurface = false;
public boolean ignoreNether = true;
public boolean ignoreEnd = true;
/** Dimensions to ignore ore generation */
public boolean ignoreSurface = false;
public boolean ignoreNether = true;
public boolean ignoreEnd = true;
/**
* @param name - The name of the ore for display
* @param textureFile - The 16x16 png texture of your ore to override
* @param minGenerateLevel - The highest generation level of your ore
* @param maxGenerateLevel - The lowest generation level of your ore
* @param amountPerChunk - The amount of ores to generate per chunk
* @param amountPerBranch - The amount of ores to generate in a clutter. E.g coal generates with
* a lot of other coal next to it. How much do you want?
*/
public OreGenReplace(String name, String oreDiectionaryName, ItemStack stack, int replaceID, int minGenerateLevel, int maxGenerateLevel, int amountPerChunk, int amountPerBranch, String harvestTool, int harvestLevel)
{
super(name, oreDiectionaryName, stack, harvestTool, harvestLevel);
this.minGenerateLevel = minGenerateLevel;
this.maxGenerateLevel = maxGenerateLevel;
this.amountPerChunk = amountPerChunk;
this.amountPerBranch = amountPerBranch;
this.replaceID = replaceID;
}
/** @param name - The name of the ore for display
* @param textureFile - The 16x16 png texture of your ore to override
* @param minGenerateLevel - The highest generation level of your ore
* @param maxGenerateLevel - The lowest generation level of your ore
* @param amountPerChunk - The amount of ores to generate per chunk
* @param amountPerBranch - The amount of ores to generate in a clutter. E.g coal generates with
* a lot of other coal next to it. How much do you want? */
public OreGenReplace(String name, String oreDiectionaryName, ItemStack stack, int replaceID, int minGenerateLevel, int maxGenerateLevel, int amountPerChunk, int amountPerBranch, String harvestTool, int harvestLevel)
{
super(name, oreDiectionaryName, stack, harvestTool, harvestLevel);
this.minGenerateLevel = minGenerateLevel;
this.maxGenerateLevel = maxGenerateLevel;
this.amountPerChunk = amountPerChunk;
this.amountPerBranch = amountPerBranch;
this.replaceID = replaceID;
}
@Override
public void generate(World world, Random random, int varX, int varZ)
{
try
{
for (int i = 0; i < this.amountPerChunk; i++)
{
int x = varX + random.nextInt(16);
int z = varZ + random.nextInt(16);
int y = random.nextInt(Math.max(this.maxGenerateLevel - this.minGenerateLevel, 0)) + this.minGenerateLevel;
this.generateReplace(world, random, x, y, z);
}
}
catch (Exception e)
{
System.out.println("Error generating ore: " + this.name);
e.printStackTrace();
}
}
@Override
public void generate(World world, Random random, int varX, int varZ)
{
try
{
for (int i = 0; i < this.amountPerChunk; i++)
{
int x = varX + random.nextInt(16);
int z = varZ + random.nextInt(16);
int y = random.nextInt(Math.max(this.maxGenerateLevel - this.minGenerateLevel, 0)) + this.minGenerateLevel;
this.generateReplace(world, random, x, y, z);
}
}
catch (Exception e)
{
System.out.println("Error generating ore: " + this.name);
e.printStackTrace();
}
}
public boolean generateReplace(World par1World, Random par2Random, int par3, int par4, int par5)
{
float var6 = par2Random.nextFloat() * (float) Math.PI;
double var7 = par3 + 8 + MathHelper.sin(var6) * this.amountPerBranch / 8.0F;
double var9 = par3 + 8 - MathHelper.sin(var6) * this.amountPerBranch / 8.0F;
double var11 = par5 + 8 + MathHelper.cos(var6) * this.amountPerBranch / 8.0F;
double var13 = par5 + 8 - MathHelper.cos(var6) * this.amountPerBranch / 8.0F;
double var15 = par4 + par2Random.nextInt(3) - 2;
double var17 = par4 + par2Random.nextInt(3) - 2;
public boolean generateReplace(World par1World, Random par2Random, int par3, int par4, int par5)
{
float var6 = par2Random.nextFloat() * (float) Math.PI;
double var7 = par3 + 8 + MathHelper.sin(var6) * this.amountPerBranch / 8.0F;
double var9 = par3 + 8 - MathHelper.sin(var6) * this.amountPerBranch / 8.0F;
double var11 = par5 + 8 + MathHelper.cos(var6) * this.amountPerBranch / 8.0F;
double var13 = par5 + 8 - MathHelper.cos(var6) * this.amountPerBranch / 8.0F;
double var15 = par4 + par2Random.nextInt(3) - 2;
double var17 = par4 + par2Random.nextInt(3) - 2;
for (int var19 = 0; var19 <= this.amountPerBranch; ++var19)
{
double var20 = var7 + (var9 - var7) * var19 / this.amountPerBranch;
double var22 = var15 + (var17 - var15) * var19 / this.amountPerBranch;
double var24 = var11 + (var13 - var11) * var19 / this.amountPerBranch;
double var26 = par2Random.nextDouble() * this.amountPerBranch / 16.0D;
double var28 = (MathHelper.sin(var19 * (float) Math.PI / this.amountPerBranch) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float) Math.PI / this.amountPerBranch) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int var19 = 0; var19 <= this.amountPerBranch; ++var19)
{
double var20 = var7 + (var9 - var7) * var19 / this.amountPerBranch;
double var22 = var15 + (var17 - var15) * var19 / this.amountPerBranch;
double var24 = var11 + (var13 - var11) * var19 / this.amountPerBranch;
double var26 = par2Random.nextDouble() * this.amountPerBranch / 16.0D;
double var28 = (MathHelper.sin(var19 * (float) Math.PI / this.amountPerBranch) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float) Math.PI / this.amountPerBranch) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int var38 = var32; var38 <= var35; ++var38)
{
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
for (int var38 = var32; var38 <= var35; ++var38)
{
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D)
{
for (int var41 = var33; var41 <= var36; ++var41)
{
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 < 1.0D)
{
for (int var41 = var33; var41 <= var36; ++var41)
{
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D)
{
for (int var44 = var34; var44 <= var37; ++var44)
{
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D)
{
for (int var44 = var34; var44 <= var37; ++var44)
{
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
int block = par1World.getBlockId(var38, var41, var44);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (this.replaceID == 0 || block == this.replaceID))
{
par1World.setBlock(var38, var41, var44, this.oreID, this.oreMeta, 2);
}
}
}
}
}
}
}
int block = par1World.getBlockId(var38, var41, var44);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (this.replaceID == 0 || block == this.replaceID))
{
par1World.setBlock(var38, var41, var44, this.oreID, this.oreMeta, 2);
}
}
}
}
}
}
}
return true;
}
return true;
}
@Override
public boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator)
{
if (!this.shouldGenerate)
{
return false;
}
if (this.ignoreSurface && chunkGenerator instanceof ChunkProviderGenerate)
{
return false;
}
if (this.ignoreNether && chunkGenerator instanceof ChunkProviderHell)
{
return false;
}
if (this.ignoreEnd && chunkGenerator instanceof ChunkProviderEnd)
{
return false;
}
return true;
}
@Override
public boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator)
{
if (!this.shouldGenerate)
{
return false;
}
if (this.ignoreSurface && chunkGenerator instanceof ChunkProviderGenerate)
{
return false;
}
if (this.ignoreNether && chunkGenerator instanceof ChunkProviderHell)
{
return false;
}
if (this.ignoreEnd && chunkGenerator instanceof ChunkProviderEnd)
{
return false;
}
return true;
}
}

View file

@ -4,14 +4,14 @@ import net.minecraft.item.ItemStack;
public class OreGenReplaceStone extends OreGenReplace
{
public OreGenReplaceStone(String name, String oreDiectionaryName, ItemStack stack, int minGenerateLevel, int maxGenerateLevel, int amountPerChunk, int amountPerBranch, String harvestTool, int harvestLevel)
{
super(name, oreDiectionaryName, stack, 1, minGenerateLevel, maxGenerateLevel, amountPerChunk, amountPerBranch, harvestTool, harvestLevel);
}
public OreGenReplaceStone(String name, String oreDiectionaryName, ItemStack stack, int minGenerateLevel, int maxGenerateLevel, int amountPerChunk, int amountPerBranch, String harvestTool, int harvestLevel)
{
super(name, oreDiectionaryName, stack, 1, minGenerateLevel, maxGenerateLevel, amountPerChunk, amountPerBranch, harvestTool, harvestLevel);
}
// A simplified version of the constructor
public OreGenReplaceStone(String name, String oreDiectionaryName, ItemStack stack, int maxGenerateLevel, int amountPerChunk, int amountPerBranch)
{
this(name, oreDiectionaryName, stack, 0, maxGenerateLevel, amountPerChunk, amountPerBranch, "pickaxe", 1);
}
// A simplified version of the constructor
public OreGenReplaceStone(String name, String oreDiectionaryName, ItemStack stack, int maxGenerateLevel, int amountPerChunk, int amountPerBranch)
{
this(name, oreDiectionaryName, stack, 0, maxGenerateLevel, amountPerChunk, amountPerBranch, "pickaxe", 1);
}
}

View file

@ -11,68 +11,60 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class OreGenerator implements IWorldGenerator
{
public static boolean isInitiated = false;
public static boolean isInitiated = false;
/**
* Add your ore data to this list of ores for it to automatically generate! No hassle indeed!
*/
private static final List<OreGenBase> ORES_TO_GENERATE = new ArrayList<OreGenBase>();
/** Add your ore data to this list of ores for it to automatically generate! No hassle indeed! */
private static final List<OreGenBase> ORES_TO_GENERATE = new ArrayList<OreGenBase>();
/**
* Adds an ore to the ore generate list. Do this in pre-init.
*/
public static void addOre(OreGenBase data)
{
if (!isInitiated)
{
GameRegistry.registerWorldGenerator(new OreGenerator());
}
/** Adds an ore to the ore generate list. Do this in pre-init. */
public static void addOre(OreGenBase data)
{
if (!isInitiated)
{
GameRegistry.registerWorldGenerator(new OreGenerator());
}
ORES_TO_GENERATE.add(data);
}
ORES_TO_GENERATE.add(data);
}
/**
* Checks to see if this ore
*
* @param oreName
* @return
*/
public static boolean oreExists(String oreName)
{
for (OreGenBase ore : ORES_TO_GENERATE)
{
if (ore.oreDictionaryName == oreName)
{
return true;
}
}
/** Checks to see if this ore
*
* @param oreName
* @return */
public static boolean oreExists(String oreName)
{
for (OreGenBase ore : ORES_TO_GENERATE)
{
if (ore.oreDictionaryName == oreName)
{
return true;
}
}
return false;
}
return false;
}
/**
* Removes an ore to the ore generate list. Do this in init.
*/
public static void removeOre(OreGenBase data)
{
ORES_TO_GENERATE.remove(data);
}
/** Removes an ore to the ore generate list. Do this in init. */
public static void removeOre(OreGenBase data)
{
ORES_TO_GENERATE.remove(data);
}
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
chunkX = chunkX << 4;
chunkZ = chunkZ << 4;
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
chunkX = chunkX << 4;
chunkZ = chunkZ << 4;
// Checks to make sure this is the normal
// world
for (OreGenBase oreData : ORES_TO_GENERATE)
{
if (oreData.shouldGenerate && oreData.isOreGeneratedInWorld(world, chunkGenerator))
{
oreData.generate(world, rand, chunkX, chunkZ);
}
// Checks to make sure this is the normal
// world
for (OreGenBase oreData : ORES_TO_GENERATE)
{
if (oreData.shouldGenerate && oreData.isOreGeneratedInWorld(world, chunkGenerator))
{
oreData.generate(world, rand, chunkX, chunkZ);
}
}
}
}
}
}