- 37
- 1
- 3
Не силен ни в жабе, ни в майне. В своём коде использую методы
withRotation, withMirror, getStateFromMeta, getStateForPlacement, isOpaqueCube, isFullCube. Идея их зачеркивает и говорит, что они устаревшие, но они работают. Код компилируется, мод работет, но при компиляции в логе проскакивает красное предупреждение Note: Some input files use or override a deprecated API.. А мне нужен чистый код без ворнингов, есть способ пофиксить это? Может есть другие методы, раз эти устарели (кроме отключения этого предупреждения в настройках идеи).
Класс, в которм это происходит:
package ua.andrey08xtomyoll.mineadditions.inventory_furnace;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.*;
import ua.andrey08xtomyoll.mineadditions.Main;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockInventoryFurnace extends BlockContainer
{
public static final PropertyDirection FACING = BlockDirectional.FACING;
public BlockInventoryFurnace()
{
super(Material.ROCK);
this.setCreativeTab(CreativeTabs.DECORATIONS);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileInventoryFurnace();
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote) return true;
playerIn.openGui(Main.instance, InventoryFurnaceGuiReg.getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ());
return true;
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (tileEntity instanceof IInventory) {
InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileEntity);
}
super.breakBlock(worldIn, pos, state);
}
@Override
protected net.minecraft.block.state.BlockStateContainer createBlockState() {
return new net.minecraft.block.state.BlockStateContainer(this, new IProperty[]{FACING});
}
@Override
public IBlockState withRotation(IBlockState state, Rotation rot) {
return state.withProperty(FACING, rot.rotate((EnumFacing) state.getValue(FACING)));
}
@Override
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
return state.withRotation(mirrorIn.toRotation((EnumFacing) state.getValue(FACING)));
}
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta));
}
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(FACING)).getIndex();
}
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
EntityLivingBase placer) {
return this.getDefaultState().withProperty(FACING, EnumFacing.getDirectionFromEntityLiving(pos, placer));
}
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.SOLID;
}
@Override
public boolean isOpaqueCube(IBlockState iBlockState) {
return false;
}
@Override
public boolean isFullCube(IBlockState iBlockState) {
return false;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState iBlockState) {
return EnumBlockRenderType.MODEL;
}
}