Added a proper logger, added the beginnings of a "SubBlocks" layer for blocks with metadata.
This commit is contained in:
parent
cbaa851f98
commit
9e1de9a173
|
@ -1,7 +1,7 @@
|
||||||
package biomesoplenty.common.blocks;
|
package biomesoplenty.common.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
import biomesoplenty.BiomesOPlenty;
|
||||||
|
import biomesoplenty.api.BOPItemHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
@ -12,8 +12,8 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import biomesoplenty.BiomesOPlenty;
|
|
||||||
import biomesoplenty.api.BOPItemHelper;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockAsh extends Block
|
public class BlockAsh extends Block
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,80 +1,52 @@
|
||||||
package biomesoplenty.common.blocks;
|
package biomesoplenty.common.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
import biomesoplenty.api.BOPItemHelper;
|
||||||
import java.util.Random;
|
import biomesoplenty.common.blocks.utils.BOPBlock;
|
||||||
|
import biomesoplenty.common.blocks.utils.SubBlock;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import biomesoplenty.BiomesOPlenty;
|
|
||||||
import biomesoplenty.api.BOPItemHelper;
|
|
||||||
|
|
||||||
public class BlockMud extends Block
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BlockMud extends BOPBlock
|
||||||
{
|
{
|
||||||
private static final String[] types = new String[] {"mud", "quicksand"};
|
|
||||||
|
|
||||||
private IIcon[] textures;
|
|
||||||
|
|
||||||
public BlockMud()
|
public BlockMud()
|
||||||
{
|
{
|
||||||
//TODO: Material.sand
|
|
||||||
super(Material.sand);
|
super(Material.sand);
|
||||||
|
|
||||||
//TODO: this.setHardness
|
|
||||||
this.setHardness(0.6F);
|
this.setHardness(0.6F);
|
||||||
this.setHarvestLevel("shovel", 0);
|
this.setHarvestLevel("shovel", 0);
|
||||||
|
|
||||||
//TODO setStepSound(Block.soundSandFootstep)
|
|
||||||
this.setStepSound(Block.soundTypeSand);
|
this.setStepSound(Block.soundTypeSand);
|
||||||
|
|
||||||
//TODO: this.setCreativeTab()
|
|
||||||
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//TODO: registerIcons()
|
protected void initializeSubBlocks()
|
||||||
|
{
|
||||||
|
this.registerSubBlock(0, "mud");
|
||||||
|
this.registerSubBlock(1, "quicksand");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister iconRegister)
|
public void registerBlockIcons(IIconRegister iconRegister)
|
||||||
{
|
{
|
||||||
textures = new IIcon[types.length];
|
SubBlock mud = getSubBlock(0);
|
||||||
|
|
||||||
for (int i = 0; i < types.length; ++i)
|
mud.setMainIcon(iconRegister.registerIcon("biomesoplenty:mud"));
|
||||||
{
|
|
||||||
textures[i] = iconRegister.registerIcon("biomesoplenty:"+ types[i]);
|
SubBlock quicksand = getSubBlock(1);
|
||||||
}
|
|
||||||
|
quicksand.setMainIcon(iconRegister.registerIcon("biomesoplenty:quicksand"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//TODO: getIcon()
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= textures.length) {
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return textures[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
//TODO: getSubBlocks()
|
|
||||||
public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < types.length; ++i)
|
|
||||||
{
|
|
||||||
list.add(new ItemStack(block, 1, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
//TODO: getCollisionBoundingBoxFromPool
|
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
if (world.getBlockMetadata(x, y, z) == 0)
|
if (world.getBlockMetadata(x, y, z) == 0)
|
||||||
|
@ -87,7 +59,6 @@ public class BlockMud extends Block
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//TODO: onEntityCollidedWithBlock()
|
|
||||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||||
{
|
{
|
||||||
if (world.getBlockMetadata(x, y, z) == 0)
|
if (world.getBlockMetadata(x, y, z) == 0)
|
||||||
|
@ -111,24 +82,15 @@ public class BlockMud extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
@Override
|
||||||
//TODO: getItemDropped()
|
|
||||||
public Item getItemDropped(int metadata, Random random, int fortune)
|
public Item getItemDropped(int metadata, Random random, int fortune)
|
||||||
{
|
{
|
||||||
if (metadata == 0)
|
if (metadata == 0)
|
||||||
return BOPItemHelper.get("mudball");
|
return BOPItemHelper.get("mudball");
|
||||||
else
|
else
|
||||||
//TODO: getItemFromBlock()
|
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
//TODO damageDropped()
|
|
||||||
public int damageDropped(int meta)
|
|
||||||
{
|
|
||||||
return meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(int meta, int fortune, Random random)
|
public int quantityDropped(int meta, int fortune, Random random)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package biomesoplenty.common.blocks.utils;
|
||||||
|
|
||||||
|
import biomesoplenty.BiomesOPlenty;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class BOPBlock extends Block
|
||||||
|
{
|
||||||
|
private SubBlock[] subBlocks = new SubBlock[16];
|
||||||
|
|
||||||
|
public BOPBlock(Material material)
|
||||||
|
{
|
||||||
|
super(material);
|
||||||
|
|
||||||
|
initializeSubBlocks();
|
||||||
|
|
||||||
|
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initializeSubBlocks()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubBlock registerSubBlock(int metadata, String name)
|
||||||
|
{
|
||||||
|
if (subBlocks[metadata] == null)
|
||||||
|
{
|
||||||
|
SubBlock subBlock = new SubBlock(this, metadata, name);
|
||||||
|
|
||||||
|
return subBlocks[metadata] = subBlock;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Metadata " + metadata + " already occupied");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubBlock[] getSubBlocks()
|
||||||
|
{
|
||||||
|
return subBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubBlock getSubBlock(int metadata)
|
||||||
|
{
|
||||||
|
return getSubBlocks()[metadata];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int damageDropped(int meta)
|
||||||
|
{
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(int side, int metadata)
|
||||||
|
{
|
||||||
|
SubBlock subBlock = getSubBlock(metadata);
|
||||||
|
|
||||||
|
if (subBlock.getIcons()[side] != null) return subBlock.getIcons()[side];
|
||||||
|
else if (subBlock.getMainIcon() != null) return subBlock.getMainIcon();
|
||||||
|
else return super.getIcon(side, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list)
|
||||||
|
{
|
||||||
|
for (SubBlock subBlock : subBlocks)
|
||||||
|
{
|
||||||
|
if (subBlock != null) list.add(new ItemStack(block, 1, subBlock.getMetadata()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package biomesoplenty.common.blocks.utils;
|
||||||
|
|
||||||
|
public class BlockPos
|
||||||
|
{
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int z;
|
||||||
|
|
||||||
|
public BlockPos(int x, int y, int z)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package biomesoplenty.common.blocks.utils;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
public class SubBlock
|
||||||
|
{
|
||||||
|
private Block parent;
|
||||||
|
private int metadata;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private IIcon mainIcon;
|
||||||
|
|
||||||
|
private IIcon[] icons = new IIcon[6];
|
||||||
|
|
||||||
|
public SubBlock(Block parent, int metadata, String name)
|
||||||
|
{
|
||||||
|
this.parent = parent;
|
||||||
|
this.metadata = metadata;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainIcon(IIcon mainIcon)
|
||||||
|
{
|
||||||
|
this.mainIcon = mainIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSidedIcon(IIcon sidedIcon, int side)
|
||||||
|
{
|
||||||
|
this.icons[side] = sidedIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getParent()
|
||||||
|
{
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMetadata()
|
||||||
|
{
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIcon getMainIcon()
|
||||||
|
{
|
||||||
|
return mainIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIcon[] getIcons()
|
||||||
|
{
|
||||||
|
return icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIcon getIconForSide(int side)
|
||||||
|
{
|
||||||
|
return getIcons()[side];
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,96 +1,20 @@
|
||||||
package biomesoplenty.common.core;
|
package biomesoplenty.common.core;
|
||||||
|
|
||||||
|
import biomesoplenty.api.BOPBlockHelper;
|
||||||
|
import biomesoplenty.common.blocks.*;
|
||||||
|
import biomesoplenty.common.blocks.BlockBOPColorizedLeaves.ColourizedLeafCategory;
|
||||||
|
import biomesoplenty.common.blocks.BlockBOPGeneric.BlockType;
|
||||||
|
import biomesoplenty.common.blocks.BlockBOPLeaves.LeafCategory;
|
||||||
|
import biomesoplenty.common.blocks.BlockBOPLog.LogCategory;
|
||||||
|
import biomesoplenty.common.blocks.BlockBOPSlab.SlabCategory;
|
||||||
|
import biomesoplenty.common.blocks.BlockBOPStairs.Category;
|
||||||
|
import biomesoplenty.common.itemblocks.*;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
|
|
||||||
import biomesoplenty.api.BOPBlockHelper;
|
|
||||||
import biomesoplenty.common.blocks.BlockAsh;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPAppleLeaves;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPColorizedLeaves;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPColorizedLeaves.ColourizedLeafCategory;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPColorizedSapling;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPCoral;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPFlower;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPFlower2;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPFoliage;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPGems;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPGeneric;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPGeneric.BlockType;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPGrass;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPLeaves;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPLeaves.LeafCategory;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPLog;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPLog.LogCategory;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPMushroom;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPPersimmonLeaves;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPPetals;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPPlank;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPPlant;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPRedRock;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPSapling;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPSkystone;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPSlab;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPSlab.SlabCategory;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPStairs;
|
|
||||||
import biomesoplenty.common.blocks.BlockBOPStairs.Category;
|
|
||||||
import biomesoplenty.common.blocks.BlockBamboo;
|
|
||||||
import biomesoplenty.common.blocks.BlockBones;
|
|
||||||
import biomesoplenty.common.blocks.BlockCloud;
|
|
||||||
import biomesoplenty.common.blocks.BlockFlesh;
|
|
||||||
import biomesoplenty.common.blocks.BlockGrave;
|
|
||||||
import biomesoplenty.common.blocks.BlockHive;
|
|
||||||
import biomesoplenty.common.blocks.BlockHoney;
|
|
||||||
import biomesoplenty.common.blocks.BlockIvy;
|
|
||||||
import biomesoplenty.common.blocks.BlockLongGrass;
|
|
||||||
import biomesoplenty.common.blocks.BlockMoss;
|
|
||||||
import biomesoplenty.common.blocks.BlockMud;
|
|
||||||
import biomesoplenty.common.blocks.BlockOriginGrass;
|
|
||||||
import biomesoplenty.common.blocks.BlockOvergrownNetherrack;
|
|
||||||
import biomesoplenty.common.blocks.BlockPromisedPortal;
|
|
||||||
import biomesoplenty.common.blocks.BlockStoneFormations;
|
|
||||||
import biomesoplenty.common.blocks.BlockTreeMoss;
|
|
||||||
import biomesoplenty.common.blocks.BlockTurnip;
|
|
||||||
import biomesoplenty.common.blocks.BlockWillow;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockAppleLeaves;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockBamboo;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockBones;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockColorizedLeaves;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockColorizedSapling;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockCoral;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockFlower;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockFlower2;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockFoliage;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockGems;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockGrave;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockHive;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockIvy;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockLeaves;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockLog;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockMoss;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockMud;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockMushroom;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockPersimmonLeaves;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockPetals;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockPlank;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockPlant;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockRedRock;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockSapling;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockSkystone;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockSlab;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockStoneFormations;
|
|
||||||
import biomesoplenty.common.itemblocks.ItemBlockWillow;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.LoaderException;
|
|
||||||
import cpw.mods.fml.common.LoaderState;
|
|
||||||
import cpw.mods.fml.common.registry.GameData;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
|
||||||
|
|
||||||
public class BOPBlocks
|
public class BOPBlocks
|
||||||
{
|
{
|
||||||
public static void init()
|
public static void init()
|
||||||
|
@ -101,9 +25,6 @@ public class BOPBlocks
|
||||||
|
|
||||||
private static void registerBlocks()
|
private static void registerBlocks()
|
||||||
{
|
{
|
||||||
// Block declaration
|
|
||||||
|
|
||||||
//TODO: setBlockName
|
|
||||||
registerBlock(new BlockMud().setBlockName("mud"), ItemBlockMud.class);
|
registerBlock(new BlockMud().setBlockName("mud"), ItemBlockMud.class);
|
||||||
//TODO: rock
|
//TODO: rock
|
||||||
registerBlock(new BlockBOPGeneric(Material.rock, BlockType.DRIED_DIRT).setBlockName("driedDirt"));
|
registerBlock(new BlockBOPGeneric(Material.rock, BlockType.DRIED_DIRT).setBlockName("driedDirt"));
|
||||||
|
@ -272,19 +193,16 @@ public class BOPBlocks
|
||||||
|
|
||||||
public static void registerBlock(Block block)
|
public static void registerBlock(Block block)
|
||||||
{
|
{
|
||||||
//TODO: getUnlocalizedName()
|
|
||||||
GameRegistry.registerBlock(block, block.getUnlocalizedName().replace("tile.", ""));
|
GameRegistry.registerBlock(block, block.getUnlocalizedName().replace("tile.", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass)
|
public static void registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass)
|
||||||
{
|
{
|
||||||
//TODO: getUnlocalizedName()
|
|
||||||
GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""));
|
GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass, Object... constructorArgs)
|
public static void registerBlock(Block block, Class<? extends ItemBlock> itemBlockClass, Object... constructorArgs)
|
||||||
{
|
{
|
||||||
//TODO: getUnlocalizedName()
|
|
||||||
GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""), null, constructorArgs);
|
GameRegistry.registerBlock(block, itemBlockClass, block.getUnlocalizedName().replace("tile.", ""), null, constructorArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package biomesoplenty.common.utils;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class BOPLogger
|
||||||
|
{
|
||||||
|
private static Logger bopLogger = LogManager.getLogger("BiomesOPlenty");
|
||||||
|
|
||||||
|
public static void log(Level level, String format, Object... data)
|
||||||
|
{
|
||||||
|
bopLogger.log(level, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void severe(String format, Object... data)
|
||||||
|
{
|
||||||
|
log(Level.ERROR, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warning(String format, Object... data)
|
||||||
|
{
|
||||||
|
log(Level.WARN, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(String format, Object... data)
|
||||||
|
{
|
||||||
|
log(Level.INFO, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fine(String format, Object... data)
|
||||||
|
{
|
||||||
|
log(Level.DEBUG, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void finer(String format, Object... data)
|
||||||
|
{
|
||||||
|
log(Level.TRACE, format, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getLogger()
|
||||||
|
{
|
||||||
|
return bopLogger;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
package biomesoplenty.common.utils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class ListUtils
|
|
||||||
{
|
|
||||||
public static <T> T getItemStackMapValue(HashMap<ItemStack, T> list, ItemStack stack)
|
|
||||||
{
|
|
||||||
for (Entry<ItemStack, T> entry : list.entrySet())
|
|
||||||
{
|
|
||||||
ItemStack stackToCompareTo = entry.getKey();
|
|
||||||
|
|
||||||
if (stackToCompareTo.getItem() == stack.getItem() && (stack.getItemDamage() == 32767 || stackToCompareTo.getItemDamage() == stack.getItemDamage())) return entry.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package biomesoplenty.common.utils;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
/**
|
|
||||||
* @prevent crashes in non overworld biome generation
|
|
||||||
* due to calls to decorator getting -1 height values
|
|
||||||
* Random.nextInt(-1) = crash
|
|
||||||
*/
|
|
||||||
public class RandomFiltered extends Random{
|
|
||||||
public RandomFiltered(long par2) {
|
|
||||||
super(par2);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int nextInt() {
|
|
||||||
return this.nextInt(1);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int nextInt (int n) {
|
|
||||||
if (n > 0) {
|
|
||||||
return super.nextInt(n);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue