mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 05:43:42 +01:00
Open Ended Pipes now correctly handle Builder's Tea
This commit is contained in:
parent
4ebcf82012
commit
596c9839d2
1 changed files with 22 additions and 0 deletions
|
@ -25,6 +25,7 @@ import net.minecraft.tags.BlockTags;
|
|||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -39,6 +40,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.ForgeConfig;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -54,6 +56,7 @@ public class OpenEndedPipe extends FlowSource {
|
|||
registerEffectHandler(new MilkEffectHandler());
|
||||
registerEffectHandler(new WaterEffectHandler());
|
||||
registerEffectHandler(new LavaEffectHandler());
|
||||
registerEffectHandler(new TeaEffectHandler());
|
||||
}
|
||||
|
||||
private Level world;
|
||||
|
@ -443,4 +446,23 @@ public class OpenEndedPipe extends FlowSource {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TeaEffectHandler implements IEffectHandler {
|
||||
@Override
|
||||
public boolean canApplyEffects(OpenEndedPipe pipe, FluidStack fluid) {
|
||||
return fluid.getFluid().isSame(AllFluids.TEA.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEffects(OpenEndedPipe pipe, FluidStack fluid) {
|
||||
Level world = pipe.getWorld();
|
||||
if (world.getGameTime() % 5 != 0)
|
||||
return;
|
||||
List<LivingEntity> entities = world
|
||||
.getEntitiesOfClass(LivingEntity.class, pipe.getAOE(), LivingEntity::isAffectedByPotions);
|
||||
for (LivingEntity entity : entities) {
|
||||
entity.addEffect(new MobEffectInstance(MobEffects.DIG_SPEED, 21, 0, false, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue