So as kinda given by the title, I'm trying to create a custom machine. To be more specific, a machine like a furnace but instead of cooking items, it combines 2 items into one - includes 2 of the same item (actually would like this to be more prioritised over 2 different items). It will also has 1 fuel slot where redstone dust/blocks are used to power it. I have looked up tutorials on custom machines; but they all pretty much involve smelting like a furnace, which I'm not trying to do. I feel like before I finish, I must mention that this is a custom block model machine and not one like a furnace where it just has different textures on the sides. I would also ideally like the fire cooking animation to be different. I believe I have most of the code done for the block itself; but I really need help on the actual functionality of this block. Detailed instructions on what each method would be highly appreciated, as I don't want just code that I don't understand and have no idea how to customise to make different machines.
Here's my code:
(Block Machine class)
package com.distinctsoul.soulforgery.blocks.machines;
import java.util.Random;
import com.distinctsoul.soulforgery.Main;
import com.distinctsoul.soulforgery.blocks.BlockBase;
import com.distinctsoul.soulforgery.init.ModBlocks;
import com.distinctsoul.soulforgery.util.Reference;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
public class BlockShardFuser extends BlockBase implements ITileEntityProvider {
public static final PropertyDirection FACING = BlockHorizontal.FACING;
public BlockShardFuser(String name, Material material) {
super(name, material);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setSoundType(SoundType.STONE);
setHardness(3.0F);
setResistance(20.0F);
setHarvestLevel("pickaxe", 2);
// setLightLevel(0.1F);
// setLightOpacity(1);
// setBlockUnbreakable();
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Item.getItemFromBlock(ModBlocks.SHARD_FUSER);
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return new ItemStack(ModBlocks.SHARD_FUSER);
}
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
worldIn.setBlockState(pos, this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()), 2);
}
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
float hitZ, int meta, EntityLivingBase placer) {
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
}
public static final AxisAlignedBB SHARD_FUSER_AABB = new AxisAlignedBB(0, 0, 0, 1, 1, 1);
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState iBlockState) {
return EnumBlockRenderType.MODEL;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return SHARD_FUSER_AABB;
}
public IBlockState getStateFromMeta(int meta) {
EnumFacing facing = EnumFacing.getHorizontal(meta);
return this.getDefaultState().withProperty(FACING, facing);
}
public int getMetaFromState(IBlockState state) {
EnumFacing facing = (EnumFacing)state.getValue(FACING);
int facingbits = facing.getHorizontalIndex();
return facingbits;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] { FACING });
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return null;
}
}
(BlockState json)
{
"variants": {
"facing=north": { "model": "soulforgery:shard_fuser" },
"facing=south": { "model": "soulforgery:shard_fuser", "y": 180 },
"facing=east": { "model": "soulforgery:shard_fuser", "y": 90 },
"facing=west": { "model": "soulforgery:shard_fuser", "y": 270 }
}
}
Any help would be very appreciated.