mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 16:58:34 +01:00
Added a Blacklist for the Ore Magnet, made ores not generate in flat worlds
This commit is contained in:
parent
e88d5b0d46
commit
93835ca3ff
3 changed files with 14 additions and 1 deletions
|
@ -15,6 +15,7 @@ public class ConfigValues{
|
||||||
|
|
||||||
public static String[] crusherRecipeExceptions;
|
public static String[] crusherRecipeExceptions;
|
||||||
public static String[] mashedFoodCraftingExceptions;
|
public static String[] mashedFoodCraftingExceptions;
|
||||||
|
public static String[] oreMagnetExceptions;
|
||||||
|
|
||||||
public static void defineConfigValues(Configuration config){
|
public static void defineConfigValues(Configuration config){
|
||||||
|
|
||||||
|
@ -33,5 +34,6 @@ public class ConfigValues{
|
||||||
|
|
||||||
crusherRecipeExceptions = config.getStringList("Crusher Recipe Exceptions", ConfigCategories.CRUSHER_RECIPES.name, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only.");
|
crusherRecipeExceptions = config.getStringList("Crusher Recipe Exceptions", ConfigCategories.CRUSHER_RECIPES.name, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only.");
|
||||||
mashedFoodCraftingExceptions = config.getStringList("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING.name, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.");
|
mashedFoodCraftingExceptions = config.getStringList("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING.name, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command.");
|
||||||
|
oreMagnetExceptions = config.getStringList("Ore Magnet Exceptions", ConfigCategories.MACHINE_VALUES.name, new String[0], "By default, the Ore Magnet pulls up everything that is registered in the OreDictionary as a String that starts with 'ore'. If you want any Ore not to be pulled up by the Magnet, put its ORE DICTIONARY name here.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldType;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
@ -21,6 +22,8 @@ public class OreGen implements IWorldGenerator{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
|
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
|
||||||
|
if(world.provider.terrainType == WorldType.FLAT) return;
|
||||||
|
|
||||||
switch(world.provider.dimensionId){
|
switch(world.provider.dimensionId){
|
||||||
case -1:
|
case -1:
|
||||||
generateNether(world, random, chunkX*16, chunkZ*16);
|
generateNether(world, random, chunkX*16, chunkZ*16);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||||
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||||
|
import ellpeck.actuallyadditions.config.ConfigValues;
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||||
|
@ -92,7 +93,7 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
||||||
for(int ID : oreIDs){
|
for(int ID : oreIDs){
|
||||||
String oreName = OreDictionary.getOreName(ID);
|
String oreName = OreDictionary.getOreName(ID);
|
||||||
//Is the block an ore according to the OreDictionary?
|
//Is the block an ore according to the OreDictionary?
|
||||||
if(oreName.substring(0, 3).equals("ore")){
|
if(oreName.substring(0, 3).equals("ore") && !this.hasException(oreName)){
|
||||||
//Remove the Block
|
//Remove the Block
|
||||||
worldObj.setBlockToAir(xCoord+x, y, zCoord+z);
|
worldObj.setBlockToAir(xCoord+x, y, zCoord+z);
|
||||||
worldObj.playAuxSFX(2001, xCoord+x, y, zCoord+z, Block.getIdFromBlock(block)+(meta << 12));
|
worldObj.playAuxSFX(2001, xCoord+x, y, zCoord+z, Block.getIdFromBlock(block)+(meta << 12));
|
||||||
|
@ -129,6 +130,13 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasException(String name){
|
||||||
|
for(String except : ConfigValues.oreMagnetExceptions){
|
||||||
|
if(except.equals(name)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getEnergyScaled(int i){
|
public int getEnergyScaled(int i){
|
||||||
return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored();
|
return this.storage.getEnergyStored() * i / this.storage.getMaxEnergyStored();
|
||||||
|
|
Loading…
Reference in a new issue