2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.block;
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
2017-08-15 21:30:48 -07:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.block.material.Material;
|
2016-07-02 19:35:08 -04:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
|
|
|
import net.minecraftforge.fluids.Fluid;
|
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
2015-10-29 22:22:08 -07:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
import java.awt.Color;
|
|
|
|
|
|
|
|
public class BlockLifeEssence extends BlockFluidClassic {
|
2017-08-14 20:53:42 -07:00
|
|
|
private static final Fluid LIFE_ESSENCE = new FluidLifeEssence();
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public BlockLifeEssence() {
|
2017-08-14 20:53:42 -07:00
|
|
|
super(LIFE_ESSENCE, Material.WATER);
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
setUnlocalizedName(BloodMagic.MODID + ".fluid.lifeEssence");
|
2016-06-05 12:31:35 -07:00
|
|
|
getLifeEssence().setBlock(this);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public boolean canDisplace(IBlockAccess world, BlockPos blockPos) {
|
2016-03-18 13:16:38 -04:00
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isLiquid() && super.canDisplace(world, blockPos);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public boolean displaceIfPossible(World world, BlockPos blockPos) {
|
2016-03-18 13:16:38 -04:00
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isLiquid() && super.displaceIfPossible(world, blockPos);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
2016-07-02 19:35:08 -04:00
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public BlockRenderLayer getBlockLayer() {
|
2016-07-02 19:35:08 -04:00
|
|
|
return BlockRenderLayer.SOLID;
|
|
|
|
}
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public static Fluid getLifeEssence() {
|
|
|
|
return LIFE_ESSENCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class FluidLifeEssence extends Fluid {
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public FluidLifeEssence() {
|
2015-11-28 18:25:46 -08:00
|
|
|
super("lifeEssence", new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceFlowing"));
|
2015-10-29 20:22:14 -07:00
|
|
|
|
|
|
|
setDensity(2000);
|
|
|
|
setViscosity(2000);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public int getColor() {
|
2016-05-27 22:55:40 -07:00
|
|
|
return Color.RED.getRGB();
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public String getLocalizedName(FluidStack fluidStack) {
|
2017-01-02 01:18:29 -08:00
|
|
|
return TextHelper.localize("tile.bloodmagic.fluid.lifeEssence.name");
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|