-
Notifications
You must be signed in to change notification settings - Fork 755
/
FlexBurningLiquidBlock.java
35 lines (31 loc) · 1.46 KB
/
FlexBurningLiquidBlock.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
package slimeknights.tconstruct.plugin.jsonthings.block;
import dev.gigaherz.jsonthings.things.blocks.FlexLiquidBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.material.FlowingFluid;
import java.util.Map;
import java.util.function.Supplier;
/** Json Things version of {@link slimeknights.tconstruct.fluids.block.BurningLiquidBlock} */
public class FlexBurningLiquidBlock extends FlexLiquidBlock {
private final int burnTime;
private final float damage;
public FlexBurningLiquidBlock(Properties properties, Map<Property<?>,Comparable<?>> propertyDefaultValues, Supplier<FlowingFluid> fluidSupplier, int burnTime, float damage) {
super(properties, propertyDefaultValues, fluidSupplier);
this.burnTime = burnTime;
this.damage = damage;
}
@Override
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
if (!entity.fireImmune() && entity.getFluidTypeHeight(getFluid().getFluidType()) > 0) {
entity.setSecondsOnFire(burnTime);
if (entity.hurt(DamageSource.LAVA, damage)) {
entity.playSound(SoundEvents.GENERIC_BURN, 0.4F, 2.0F + level.random.nextFloat() * 0.4F);
}
}
}
}