This commit is contained in:
kuba6000 committed 2022-10-12 21:09:45 +02:00
1 parent d993c90c3e
commit 14a712260b
156 files changed
+14896 -13422

No files matched your search

@@ -18,96 +18,84 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockEffectJar extends BlockContainer
{
public BlockEffectJar()
{
super(Material.glass);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("effectJar");
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
this.setHardness(0.1f);
this.setResistance(1.5f);
}
public class BlockEffectJar extends BlockContainer {
public BlockEffectJar() {
super(Material.glass);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("effectJar");
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
this.setHardness(0.1f);
this.setResistance(1.5f);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
boolean activate = false;
if (!player.isSneaking())
{
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
activate = true;
}
return activate;
}
@Override
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
boolean activate = false;
@Override
public TileEntity createNewTileEntity(World w, int metadata)
{
return new TileEntityEffectJar();
}
if (!player.isSneaking()) {
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
activate = true;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
return activate;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World w, int metadata) {
return new TileEntityEffectJar();
}
@Override
public int getRenderType()
{
return CommonProxy.RenderIdEffectJar;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
private void dropInventory(World world, int x, int y, int z)
{
TileEntity e = world.getTileEntity(x, y, z);
if (e != null && e instanceof TileEntityEffectJar)
{
TileEntityEffectJar jar = (TileEntityEffectJar)e;
// 0 is the only droppable stack.
ItemStack stack = jar.getStackInSlot(0);
if (stack != null && stack.stackSize > 0)
{
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
world.spawnEntityInWorld(entityItem);
stack.stackSize = 0;
}
}
}
@Override
public int getRenderType() {
return CommonProxy.RenderIdEffectJar;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.blockIcon = Blocks.glass.getIcon(0, 0);
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, meta);
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity e = world.getTileEntity(x, y, z);
if (e != null && e instanceof TileEntityEffectJar) {
TileEntityEffectJar jar = (TileEntityEffectJar) e;
// 0 is the only droppable stack.
ItemStack stack = jar.getStackInSlot(0);
if (stack != null && stack.stackSize > 0) {
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
world.spawnEntityInWorld(entityItem);
stack.stackSize = 0;
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
this.blockIcon = Blocks.glass.getIcon(0, 0);
}
}
@@ -1,7 +1,8 @@
package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees;
import net.minecraft.block.Block;
@@ -12,64 +13,62 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockEnchantedEarth extends Block {
@SideOnly(Side.CLIENT)
private IIcon top;
public BlockEnchantedEarth() {
super(Material.ground);
setCreativeTab(TabMagicBees.tabMagicBees);
setBlockName("enchantedEarth");
setBlockTextureName(CommonProxy.DOMAIN + ":enchantedEarth");
setTickRandomly(true);
setStepSound(soundTypeGravel);
}
@SideOnly(Side.CLIENT)
private IIcon top;
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
for (int height = y + 1; height <= 256; ++height) {
Block b = world.getBlock(x, height, z);
if (b == this) {
continue;
}
else {
if (b.getTickRandomly()) {
world.scheduleBlockUpdate(x, height, z, b, 0);
}
break;
}
}
if (y < 256 && random.nextInt(2) == 0) {
int newX = x + (random.nextInt(3) - 1);
int newZ = z + (random.nextInt(3) - 1);
int newY = y + 1;
Block b = world.getBlock(newX, newY, newZ);
if (b.getTickRandomly()) {
world.scheduleBlockUpdate(newX, newY, newZ, b, random.nextInt(5) + 1);
}
}
}
public BlockEnchantedEarth() {
super(Material.ground);
setCreativeTab(TabMagicBees.tabMagicBees);
setBlockName("enchantedEarth");
setBlockTextureName(CommonProxy.DOMAIN + ":enchantedEarth");
setTickRandomly(true);
setStepSound(soundTypeGravel);
}
@Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
return true;
}
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
for (int height = y + 1; height <= 256; ++height) {
Block b = world.getBlock(x, height, z);
if (b == this) {
continue;
} else {
if (b.getTickRandomly()) {
world.scheduleBlockUpdate(x, height, z, b, 0);
}
break;
}
}
if (y < 256 && random.nextInt(2) == 0) {
int newX = x + (random.nextInt(3) - 1);
int newZ = z + (random.nextInt(3) - 1);
int newY = y + 1;
Block b = world.getBlock(newX, newY, newZ);
if (b.getTickRandomly()) {
world.scheduleBlockUpdate(newX, newY, newZ, b, random.nextInt(5) + 1);
}
}
}
@Override
public IIcon getIcon(int side, int meta) {
if (side == 1) {
return top;
}
return super.getIcon(side, meta);
}
@Override
public boolean canSustainPlant(
IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
return true;
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
top = iconRegister.registerIcon(textureName + "_top");
super.registerBlockIcons(iconRegister);
}
@Override
public IIcon getIcon(int side, int meta) {
if (side == 1) {
return top;
}
return super.getIcon(side, meta);
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
top = iconRegister.registerIcon(textureName + "_top");
super.registerBlockIcons(iconRegister);
}
}
+69 -86
View File
@@ -1,10 +1,10 @@
package magicbees.block;
import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
import java.util.ArrayList;
import java.util.List;
import magicbees.block.types.HiveType;
import magicbees.main.Config;
import net.minecraft.block.Block;
@@ -17,97 +17,80 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import forestry.api.core.Tabs;
public class BlockHive extends Block
{
public BlockHive()
{
super(new MaterialHive());
this.setLightLevel(0.8f);
setHardness(1f);
setCreativeTab(Tabs.tabApiculture);
setBlockName("hive");
}
public class BlockHive extends Block {
public BlockHive() {
super(new MaterialHive());
this.setLightLevel(0.8f);
setHardness(1f);
setCreativeTab(Tabs.tabApiculture);
setBlockName("hive");
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity)
{
return false;
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return false;
}
@Override
public int damageDropped(int meta)
{
return meta;
}
@Override
public int damageDropped(int meta) {
return meta;
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta < 0 || meta > HiveType.values().length)
{
meta = 0;
}
return HiveType.getHiveFromMeta(meta).getLightValue();
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (meta < 0 || meta > HiveType.values().length) {
meta = 0;
}
return HiveType.getHiveFromMeta(meta).getLightValue();
}
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList)
{
// Java bitches about raw types & types not being checked. Sorry, but the API sucks.
for (HiveType type : HiveType.values())
{
if (type.show || Config.forestryDebugEnabled)
{
itemsList.add(new ItemStack(this, 1, type.ordinal()));
}
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList) {
// Java bitches about raw types & types not being checked. Sorry, but the API sucks.
for (HiveType type : HiveType.values()) {
if (type.show || Config.forestryDebugEnabled) {
itemsList.add(new ItemStack(this, 1, type.ordinal()));
}
}
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
{
return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register)
{
HiveType.registerIcons(register);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
if (meta < 0 || meta > HiveType.values().length)
{
meta = 0;
}
return HiveType.getHiveFromMeta(meta).getIconForSide(side);
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune);
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
Block block = world.getBlock(x, y, z);
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
HiveType.registerIcons(register);
}
if (block.isAir(world, x, y, z))
{
return null;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if (meta < 0 || meta > HiveType.values().length) {
meta = 0;
}
return HiveType.getHiveFromMeta(meta).getIconForSide(side);
}
Item item = Item.getItemFromBlock(block);
if (item == null)
{
return null;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
}
if (block.isAir(world, x, y, z)) {
return null;
}
Item item = Item.getItemFromBlock(block);
if (item == null) {
return null;
}
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
}
}
@@ -1,5 +1,7 @@
package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.client.gui.UIScreens;
import magicbees.main.CommonProxy;
import magicbees.main.MagicBees;
@@ -16,16 +18,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockMagicApiary extends BlockContainer
{
public class BlockMagicApiary extends BlockContainer {
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public BlockMagicApiary()
{
public BlockMagicApiary() {
super(Material.wood);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("magicApiary");
@@ -35,12 +33,11 @@ public class BlockMagicApiary extends BlockContainer
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9 )
{
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
boolean activate = false;
if (!player.isSneaking())
{
if (!player.isSneaking()) {
player.openGui(MagicBees.object, UIScreens.THAUMIC_APIARY.ordinal(), world, x, y, z);
activate = true;
}
@@ -50,23 +47,22 @@ public class BlockMagicApiary extends BlockContainer
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta){
public IIcon getIcon(int side, int meta) {
if (side == 0){
if (side == 0) {
return icons[0];
}else if (side == 1){
} else if (side == 1) {
return icons[1];
}else if (side == 2 || side == 3){
} else if (side == 2 || side == 3) {
return icons[2];
}else{
} else {
return icons[3];
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register)
{
public void registerBlockIcons(IIconRegister register) {
icons = new IIcon[4];
icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":thaumicapiary.0");
@@ -81,15 +77,15 @@ public class BlockMagicApiary extends BlockContainer
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta){
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof IInventory){
IInventory inventory = (IInventory)te;
if (te != null && te instanceof IInventory) {
IInventory inventory = (IInventory) te;
for (int i = 0; i < inventory.getSizeInventory(); i++){
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlotOnClosing(i);
if (itemStack != null){
if (itemStack != null) {
float spawnX = x + world.rand.nextFloat();
float spawnY = y + world.rand.nextFloat();
float spawnZ = z + world.rand.nextFloat();
@@ -1,5 +1,7 @@
package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees;
import magicbees.tileentity.TileEntityManaAuraProvider;
@@ -10,39 +12,35 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockManaAuraProvider extends Block implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
private IIcon topIcon;
public BlockManaAuraProvider() {
super(Material.rock);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("manaAuraProvider");
this.setHardness(2f);
this.setResistance(3f);
this.setHarvestLevel("pickaxe", 0);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityManaAuraProvider();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
private IIcon topIcon;
public BlockManaAuraProvider() {
super(Material.rock);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("manaAuraProvider");
this.setHardness(2f);
this.setResistance(3f);
this.setHarvestLevel("pickaxe", 0);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityManaAuraProvider();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
}
}
@@ -1,5 +1,7 @@
package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees;
import magicbees.tileentity.TileEntityVisAuraProvider;
@@ -9,41 +11,36 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockVisAuraProvider extends BlockContainer {
public BlockVisAuraProvider() {
super(Material.glass);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("visAuraProvider");
this.setHardness(0.5f);
this.setResistance(1.5f);
this.setLightLevel(8);
}
public BlockVisAuraProvider() {
super(Material.glass);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("visAuraProvider");
this.setHardness(0.5f);
this.setResistance(1.5f);
this.setLightLevel(8);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityVisAuraProvider();
}
@Override
public int getRenderType()
{
return CommonProxy.RenderIdVisAuraProvider;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = Blocks.planks.getIcon(0, 5);
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityVisAuraProvider();
}
@Override
public int getRenderType() {
return CommonProxy.RenderIdVisAuraProvider;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = Blocks.planks.getIcon(0, 5);
}
}
@@ -3,14 +3,11 @@ package magicbees.block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
public class MaterialHive extends Material
{
public MaterialHive()
{
super(MapColor.stoneColor);
this.setImmovableMobility();
this.setRequiresTool();
}
public class MaterialHive extends Material {
public MaterialHive() {
super(MapColor.stoneColor);
this.setImmovableMobility();
this.setRequiresTool();
}
}
+139 -160
View File
@@ -1,8 +1,10 @@
package magicbees.block.types;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IHiveDrop;
import java.util.ArrayList;
import java.util.Collections;
import magicbees.bees.BeeGenomeManager;
import magicbees.bees.BeeSpecies;
import magicbees.bees.HiveDrop;
@@ -15,177 +17,154 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IHiveDrop;
public enum HiveType
{
CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true),
UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true),
RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true),
DEEP("deep", BeeSpecies.ATTUNED, 4, false),
INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false),
OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false),
;
private static String[] nameList;
private String name;
private BeeSpecies occupant;
public boolean show;
private int lightLevel;
private ArrayList<IHiveDrop> drops;
public enum HiveType {
CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true),
UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true),
RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true),
DEEP("deep", BeeSpecies.ATTUNED, 4, false),
INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false),
OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false),
;
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public static HiveType getHiveFromMeta(int meta)
{
HiveType type = CURIOUS;
if (meta > 0 && meta < HiveType.values().length)
{
type = HiveType.values()[meta];
}
return type;
}
public static void initHiveData()
{
ItemStack[] combs = new ItemStack[] { Config.combs.getStackForType(CombType.MUNDANE) };
HiveDrop valiantDrop = new HiveDrop(BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")), combs, 5);
private static String[] nameList;
CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15));
CURIOUS.drops.add(valiantDrop);
private String name;
private BeeSpecies occupant;
public boolean show;
private int lightLevel;
private ArrayList<IHiveDrop> drops;
UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15));
UNUSUAL.drops.add(valiantDrop);
@SideOnly(Side.CLIENT)
private IIcon[] icons;
RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20));
RESONANT.drops.add(valiantDrop);
public static HiveType getHiveFromMeta(int meta) {
HiveType type = CURIOUS;
DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f));
DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20));
DEEP.drops.add(valiantDrop);
if (meta > 0 && meta < HiveType.values().length) {
type = HiveType.values()[meta];
}
combs = new ItemStack[] { Config.combs.getStackForType(CombType.MOLTEN), new ItemStack(Items.glowstone_dust, 6) };
return type;
}
INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f));
INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3));
public static void initHiveData() {
ItemStack[] combs = new ItemStack[] {Config.combs.getStackForType(CombType.MUNDANE)};
HiveDrop valiantDrop = new HiveDrop(
BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")), combs, 5);
combs = new ItemStack[] { Config.combs.getStackForType(CombType.FORGOTTEN), new ItemStack(Items.ender_pearl, 1) };
CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15));
CURIOUS.drops.add(valiantDrop);
OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80));
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
}
private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible)
{
this.name = hiveName;
this.occupant = occupant;
this.lightLevel = light;
this.show = visible;
this.drops = new ArrayList<IHiveDrop>();
}
@SideOnly(Side.CLIENT)
public static void registerIcons(IIconRegister register)
{
for (HiveType type : HiveType.values())
{
type.icons = new IIcon[2];
UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15));
UNUSUAL.drops.add(valiantDrop);
type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top");
type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side");
}
}
RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20));
RESONANT.drops.add(valiantDrop);
@SideOnly(Side.CLIENT)
public IIcon getIconForSide(int side)
{
IIcon i = this.icons[0];
if (side != 0 && side != 1)
{
i = this.icons[1];
}
return i;
}
public int getLightValue()
{
return this.lightLevel;
}
DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f));
DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20));
DEEP.drops.add(valiantDrop);
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>();
int dart;
Collections.shuffle(this.drops);
combs = new ItemStack[] {Config.combs.getStackForType(CombType.MOLTEN), new ItemStack(Items.glowstone_dust, 6)};
// Get a princess.
int throttle = 0;
while (hiveDrops.size() <= 0 && throttle < 10)
{
++throttle;
for (IHiveDrop drop : drops)
{
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z))
{
hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
break;
}
}
}
// Get a drone, maybe.
for (IHiveDrop drop : drops)
{
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z))
{
hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune));
break;
}
}
// Get additional drops.
for (IHiveDrop drop : drops)
{
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z))
{
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune));
}
}
return hiveDrops;
}
public static String[] getAllNames()
{
return (nameList == null) ? nameList = generateNames() : nameList;
}
public BeeSpecies getOccupant() {
return this.occupant;
}
private static String[] generateNames()
{
String[] names = new String[values().length];
for (int i = 0; i < names.length; ++i)
{
names[i] = values()[i].name;
}
return names;
}
INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f));
INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3));
combs = new ItemStack[] {Config.combs.getStackForType(CombType.FORGOTTEN), new ItemStack(Items.ender_pearl, 1)};
OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80));
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
}
private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible) {
this.name = hiveName;
this.occupant = occupant;
this.lightLevel = light;
this.show = visible;
this.drops = new ArrayList<IHiveDrop>();
}
@SideOnly(Side.CLIENT)
public static void registerIcons(IIconRegister register) {
for (HiveType type : HiveType.values()) {
type.icons = new IIcon[2];
type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top");
type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side");
}
}
@SideOnly(Side.CLIENT)
public IIcon getIconForSide(int side) {
IIcon i = this.icons[0];
if (side != 0 && side != 1) {
i = this.icons[1];
}
return i;
}
public int getLightValue() {
return this.lightLevel;
}
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune) {
ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>();
int dart;
Collections.shuffle(this.drops);
// Get a princess.
int throttle = 0;
while (hiveDrops.size() <= 0 && throttle < 10) {
++throttle;
for (IHiveDrop drop : drops) {
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z)) {
hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
break;
}
}
}
// Get a drone, maybe.
for (IHiveDrop drop : drops) {
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z)) {
hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune));
break;
}
}
// Get additional drops.
for (IHiveDrop drop : drops) {
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z)) {
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune));
}
}
return hiveDrops;
}
public static String[] getAllNames() {
return (nameList == null) ? nameList = generateNames() : nameList;
}
public BeeSpecies getOccupant() {
return this.occupant;
}
private static String[] generateNames() {
String[] names = new String[values().length];
for (int i = 0; i < names.length; ++i) {
names[i] = values()[i].name;
}
return names;
}
}
@@ -1,45 +1,38 @@
package magicbees.block.types;
public enum PlankType
{
GREATWOOD("greatwood", 48),
SILVERWOOD("silverwood", 49),
;
public String name;
public int textureIdx;
private static String[] nameList;
private PlankType(String n, int idx)
{
this.name = n;
this.textureIdx = idx;
}
public static PlankType getType(int meta)
{
PlankType type = null;
if (meta >= 0 && meta <= values().length)
{
type = values()[meta];
}
return type;
}
public static String[] getAllNames()
{
return (nameList == null) ? nameList = generateNames() : nameList;
}
private static String[] generateNames()
{
String[] names = new String[values().length];
for (int i = 0; i < names.length; ++i)
{
names[i] = values()[i].name;
}
return names;
}
public enum PlankType {
GREATWOOD("greatwood", 48),
SILVERWOOD("silverwood", 49),
;
public String name;
public int textureIdx;
private static String[] nameList;
private PlankType(String n, int idx) {
this.name = n;
this.textureIdx = idx;
}
public static PlankType getType(int meta) {
PlankType type = null;
if (meta >= 0 && meta <= values().length) {
type = values()[meta];
}
return type;
}
public static String[] getAllNames() {
return (nameList == null) ? nameList = generateNames() : nameList;
}
private static String[] generateNames() {
String[] names = new String[values().length];
for (int i = 0; i < names.length; ++i) {
names[i] = values()[i].name;
}
return names;
}
}