-
Notifications
You must be signed in to change notification settings - Fork 755
/
SlimeFluid.java
60 lines (51 loc) · 1.8 KB
/
SlimeFluid.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package tconstruct.blocks.slime;
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
import tconstruct.entity.BlueSlime;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlimeFluid extends BlockFluidClassic
{
IIcon stillIcon;
IIcon flowIcon;
public SlimeFluid(int id, Fluid fluid, Material material)
{
super(id, fluid, material);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IIconRegister iconRegister)
{
stillIcon = iconRegister.registerIcon("tinker:slime_blue");
flowIcon = iconRegister.registerIcon("tinker:slime_blue_flow");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (side == 0 || side == 1)
return stillIcon;
return flowIcon;
}
public void updateTick (World world, int x, int y, int z, Random rand)
{
super.updateTick(world, x, y, z, rand);
if (rand.nextInt(100) == 0 && world.getBlockMetadata(x, y, z) == 0 && world.checkNoEntityCollision(AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 2, y + 2, z + 2)))
{
BlueSlime entityslime = new BlueSlime(world);
entityslime.setPosition((double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D);
world.spawnEntityInWorld(entityslime);
}
}
public void getSubBlocks (int par1, CreativeTabs par2CreativeTabs, List par3List)
{
}
}