From 15a8f802106dfd763a450604efcc69234c2f2982 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Thu, 23 May 2024 00:45:52 +0200 Subject: [PATCH] fix: falling block entities calling can replace crashing logic side --- gradle.properties | 2 +- .../fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java | 1 + .../java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java | 1 + .../java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java | 1 + .../fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java | 1 + .../java/fr/adrien1106/reframed/block/ReFramedStairBlock.java | 1 + .../java/fr/adrien1106/reframed/block/ReFramedStepBlock.java | 1 + 7 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 93cdd49..fbab9f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loader_version=0.15.11 # Mod Properties modrinth_id = jCpoCBpn -mod_version = 1.5.9 +mod_version = 1.5.10 maven_group = fr.adrien1106 archives_base_name = ReFramed mod_id = reframed diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java index 9d2efb7..473a975 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedHalfStairBlock.java @@ -43,6 +43,7 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; Direction dir = state.get(CORNER).getDirection(state.get(CORNER_FACE)); return !( context.getPlayer().isSneaking() diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java index a0ab9e9..2b0efe7 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedLayerBlock.java @@ -39,6 +39,7 @@ public class ReFramedLayerBlock extends ReFramedSlabBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; return !( context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java index 3818508..39a813e 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSlabBlock.java @@ -42,6 +42,7 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; return !( context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java index a4efbeb..36d208d 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedSmallCubeBlock.java @@ -43,6 +43,7 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; Corner corner = state.get(CORNER); return !( context.getPlayer().isSneaking() diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java index c5b1a67..522edfd 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStairBlock.java @@ -46,6 +46,7 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; return !( context.getPlayer().isSneaking() || !(context.getStack().getItem() instanceof BlockItem block_item) diff --git a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java index 607f8d3..121cace 100644 --- a/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java +++ b/src/main/java/fr/adrien1106/reframed/block/ReFramedStepBlock.java @@ -43,6 +43,7 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock { @Override public boolean canReplace(BlockState state, ItemPlacementContext context) { + if (context.getPlayer() == null) return false; Edge edge = state.get(EDGE); return !( context.getPlayer().isSneaking()