Files
TinkersConstruct/src/main/java/tconstruct/blocks/SpeedSlab.java
T

70 lines
1.7 KiB
Java
Raw Normal View History

package tconstruct.blocks;
import java.util.List;
import tconstruct.common.TContent;
2013-11-29 23:16:32 -05:00
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;
2013-12-31 11:26:08 -05:00
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
2013-12-31 11:26:08 -05:00
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
2013-12-31 11:26:08 -05:00
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SpeedSlab extends SlabBase
{
2013-12-31 11:26:08 -05:00
public SpeedSlab()
{
2013-12-31 11:26:08 -05:00
super(Material.rock);
2014-01-15 23:19:27 -05:00
this.func_149647_a(TConstructRegistry.blockTab);
func_149711_c(3F);
}
2013-08-31 05:13:31 -07:00
@Override
@SideOnly(Side.CLIENT)
2013-12-31 11:26:08 -05:00
public void registerIcons (IIconRegister iconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
2013-12-31 11:26:08 -05:00
public IIcon getIcon (int side, int meta)
{
meta = meta % 8;
2013-11-29 23:16:32 -05:00
return TRepo.speedBlock.getIcon(side, meta);
}
@Override
2013-12-31 11:26:08 -05:00
public void getSubBlocks (Block b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 7; iter++)
{
2013-12-31 11:26:08 -05:00
list.add(new ItemStack(b, 1, iter));
}
}
2013-08-31 05:13:31 -07:00
@Override
public void onEntityWalking (World world, int x, int y, int z, Entity entity)
{
double boost = 2.2D;
int metadata = world.getBlockMetadata(x, y, z) % 8;
if (metadata == 1 || metadata == 4)
boost = 2.7D;
double mX = Math.abs(entity.motionX);
double mZ = Math.abs(entity.motionZ);
if (mX < 0.5D)
{
entity.motionX *= boost;
}
if (mZ < 0.5D)
{
entity.motionZ *= boost;
}
}
}