From ac6369a2767b315b8e2c24532783cb3d7bccda57 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 21 Sep 2022 10:16:48 +0200 Subject: [PATCH] Flat fence - Added ai deterrents for crossing track blocks --- .../content/logistics/trains/track/FakeTrackBlock.java | 7 +++++++ .../create/content/logistics/trains/track/TrackBlock.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/track/FakeTrackBlock.java b/src/main/java/com/simibubi/create/content/logistics/trains/track/FakeTrackBlock.java index cb69aba49..bd669b403 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/track/FakeTrackBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/track/FakeTrackBlock.java @@ -10,6 +10,7 @@ import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; @@ -21,6 +22,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -43,6 +45,11 @@ public class FakeTrackBlock extends Block implements EntityBlock, ProperWaterlog public RenderShape getRenderShape(BlockState pState) { return RenderShape.ENTITYBLOCK_ANIMATED; } + + @Override + public BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos, Mob entity) { + return BlockPathTypes.DAMAGE_OTHER; + } @Override protected void createBlockStateDefinition(Builder pBuilder) { diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackBlock.java b/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackBlock.java index 55dd45c59..48664b073 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackBlock.java @@ -66,6 +66,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; @@ -89,6 +90,7 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.level.portal.PortalForcer; import net.minecraft.world.level.portal.PortalInfo; import net.minecraft.world.phys.AABB; @@ -119,6 +121,11 @@ public class TrackBlock extends Block protected void createBlockStateDefinition(Builder p_49915_) { super.createBlockStateDefinition(p_49915_.add(SHAPE, HAS_TE, WATERLOGGED)); } + + @Override + public BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos, Mob entity) { + return BlockPathTypes.RAIL; + } @Override public FluidState getFluidState(BlockState state) {