Skip to content

Commit 4e24715

Browse files
committed
apparently this thing was waterlogged...
1 parent 4263af8 commit 4e24715

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/main/java/net/allthemods/allthemodium/common/blocks/TeleportPad.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import net.minecraft.server.level.ServerLevel;
1515
import net.minecraft.server.level.ServerPlayer;
1616
import net.minecraft.tags.BlockTags;
17+
import net.minecraft.tags.FluidTags;
1718
import net.minecraft.util.Util;
1819
import net.minecraft.world.InteractionResult;
1920
import net.minecraft.world.entity.ai.village.poi.PoiManager;
@@ -30,6 +31,7 @@
3031
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
3132
import net.minecraft.world.level.block.state.properties.BooleanProperty;
3233
import net.minecraft.world.level.levelgen.Heightmap;
34+
import net.minecraft.world.level.material.FluidState;
3335
import net.minecraft.world.level.material.Fluids;
3436
import net.minecraft.world.phys.BlockHitResult;
3537
import net.minecraft.world.phys.shapes.CollisionContext;
@@ -67,7 +69,7 @@ public class TeleportPad extends Block implements SimpleWaterloggedBlock {
6769

6870
public TeleportPad(Properties properties) {
6971
super(properties.strength(3.0F));
70-
this.registerDefaultState(this.defaultBlockState().setValue(TeleportPad.SPAWNED, false));
72+
this.registerDefaultState(this.defaultBlockState().setValue(TeleportPad.WATERLOGGED, false).setValue(TeleportPad.SPAWNED, false));
7173
}
7274

7375
private static int getDestinationMode() {
@@ -80,7 +82,13 @@ private static boolean isTweaksLoaded() {
8082

8183
@Override
8284
public BlockState getStateForPlacement(BlockPlaceContext context) {
83-
return this.defaultBlockState().setValue(TeleportPad.WATERLOGGED, context.getLevel().getFluidState(context.getClickedPos()).is(Fluids.WATER));
85+
FluidState state = context.getLevel().getFluidState(context.getClickedPos());
86+
return this.defaultBlockState().setValue(TeleportPad.WATERLOGGED, state.is(FluidTags.WATER) && state.isFull());
87+
}
88+
89+
@Override
90+
protected FluidState getFluidState(BlockState state) {
91+
return state.getValue(TeleportPad.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
8492
}
8593

8694
@Override

0 commit comments

Comments
 (0)