mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Co-authored-by: Martin Robertz <[email protected]> Co-authored-by: boubou19 <[email protected]>
122 lines
3.2 KiB
Java
122 lines
3.2 KiB
Java
package thaumic.tinkerer.common.block;
|
|
|
|
import java.util.Random;
|
|
|
|
import net.minecraft.block.BlockFarmland;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.item.ItemBlock;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.IIcon;
|
|
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;
|
|
import thaumic.tinkerer.client.core.helper.IconHelper;
|
|
import thaumic.tinkerer.common.block.tile.TileInfusedFarmland;
|
|
import thaumic.tinkerer.common.lib.LibBlockNames;
|
|
import thaumic.tinkerer.common.registry.ITTinkererBlock;
|
|
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
|
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
|
|
|
/**
|
|
* Created by pixlepix on 8/4/14.
|
|
*/
|
|
public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlock {
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconWet;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconDry;
|
|
|
|
public BlockInfusedFarmland() {
|
|
super();
|
|
setHardness(0.6F);
|
|
setStepSound(soundTypeGravel);
|
|
|
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
|
}
|
|
|
|
@Override
|
|
public boolean getUseNeighborBrightness() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public TileEntity createTileEntity(World world, int metadata) {
|
|
return new TileInfusedFarmland();
|
|
}
|
|
|
|
@Override
|
|
public String getBlockName() {
|
|
return LibBlockNames.BLOCK_INFUSED_FARMLAND;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldRegister() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldDisplayInTab() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public Class<? extends ItemBlock> getItemBlock() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public Class<? extends TileEntity> getTileEntity() {
|
|
return TileInfusedFarmland.class;
|
|
}
|
|
|
|
@Override
|
|
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction,
|
|
IPlantable plantable) {
|
|
return plantable instanceof BlockInfusedGrain;
|
|
}
|
|
|
|
@Override
|
|
public boolean hasTileEntity(int metadata) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public IRegisterableResearch getResearchItem() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public ThaumicTinkererRecipe getRecipeItem() {
|
|
return null;
|
|
}
|
|
|
|
// Prevent farmland degrading
|
|
|
|
@Override
|
|
public void onFallenUpon(World p_149746_1_, int p_149746_2_, int p_149746_3_, int p_149746_4_, Entity p_149746_5_,
|
|
float p_149746_6_) {}
|
|
|
|
@Override
|
|
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
|
return p_149691_1_ == 1 ? (iconWet) : Blocks.dirt.getBlockTextureFromSide(p_149691_1_);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister p_149651_1_) {
|
|
this.iconWet = IconHelper.forBlock(p_149651_1_, this);
|
|
}
|
|
}
|