mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-05-06 02:47:05 +02:00
56 lines
1.6 KiB
Java
56 lines
1.6 KiB
Java
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.item.EnumRarity;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
|
import net.minecraftforge.fluids.Fluid;
|
|
|
|
public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity {
|
|
|
|
private final String name;
|
|
|
|
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName) {
|
|
super(fluid, material);
|
|
this.name = unlocalizedName;
|
|
this.displacements.put(this, false);
|
|
|
|
this.register();
|
|
}
|
|
|
|
private void register() {
|
|
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
|
}
|
|
|
|
protected String getBaseName() {
|
|
return this.name;
|
|
}
|
|
|
|
protected ItemBlockBase getItemBlock() {
|
|
return new ItemBlockBase(this);
|
|
}
|
|
|
|
public boolean shouldAddCreative() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean canDisplace(IBlockAccess world, BlockPos pos) {
|
|
return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
|
}
|
|
|
|
@Override
|
|
public boolean displaceIfPossible(World world, BlockPos pos) {
|
|
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
|
}
|
|
|
|
@Override
|
|
public EnumRarity getRarity(ItemStack stack) {
|
|
return EnumRarity.EPIC;
|
|
}
|
|
}
|