- 13
- 1
Я сделал мод на кресло, но на него нельзя садится(как на лошадь или свинью). Можете скинуть код, пожалуйста, и объяснить если сможете как он работает.
Вот код блока(могут быть лишние строки):
Вот код блока(могут быть лишние строки):
Код:
package com.fande.mymod.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.BlockHorizontal;
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.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class BlockSofa extends Block {
public static final PropertyDirection FACING = BlockHorizontal.FACING;
public BlockSofa(Material mater, String name) {
super(mater);
this.setSoundType(SoundType.WOOD);
this.setHardness(2.0F);
this.setHarvestLevel("axe", 0);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setResistance(2.0F);
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
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 IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
}
public int getMetaFromState(IBlockState state)
{
return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();
}
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {FACING});
}
}