2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.block;
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2015-11-02 12:39:44 -08:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
|
|
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
2015-10-29 20:22:14 -07:00
|
|
|
import lombok.Getter;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.util.BlockPos;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-10-29 22:22:08 -07:00
|
|
|
import net.minecraft.util.StatCollector;
|
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
|
|
|
import java.awt.*;
|
|
|
|
|
2015-10-29 20:22:14 -07:00
|
|
|
public class BlockLifeEssence extends BlockFluidClassic {
|
|
|
|
|
2015-10-29 22:22:08 -07:00
|
|
|
@Getter
|
|
|
|
private static Fluid lifeEssence = new FluidLifeEssence();
|
2015-10-29 20:22:14 -07:00
|
|
|
|
|
|
|
public BlockLifeEssence() {
|
|
|
|
super(lifeEssence, Material.water);
|
|
|
|
|
2015-11-02 12:39:44 -08:00
|
|
|
setUnlocalizedName(BloodMagic.MODID + ".fluid.lifeEssence");
|
2015-10-29 22:22:08 -07:00
|
|
|
|
2015-10-29 20:22:14 -07:00
|
|
|
lifeEssence.setBlock(this);
|
2015-11-02 12:39:44 -08:00
|
|
|
BloodMagicAPI.setLifeEssence(lifeEssence);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canDisplace(IBlockAccess world, BlockPos blockPos) {
|
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.canDisplace(world, blockPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean displaceIfPossible(World world, BlockPos blockPos) {
|
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.displaceIfPossible(world, blockPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class FluidLifeEssence extends Fluid {
|
|
|
|
|
2015-10-29 22:22:08 -07:00
|
|
|
public FluidLifeEssence() {
|
2015-11-02 12:39:44 -08:00
|
|
|
super("lifeEssence", new ResourceLocation(BloodMagic.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(BloodMagic.DOMAIN + "blocks/lifeEssenceFlowing"));
|
2015-10-29 20:22:14 -07:00
|
|
|
|
|
|
|
setDensity(2000);
|
|
|
|
setViscosity(2000);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getColor() {
|
2015-10-29 22:22:08 -07:00
|
|
|
return Color.WHITE.getRGB();
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getLocalizedName(FluidStack fluidStack) {
|
2015-11-02 12:39:44 -08:00
|
|
|
return StatCollector.translateToLocal("tile.BloodMagic.fluid.lifeEssence.name");
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|