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

+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);
}
}