Skip to content

Commit c304952

Browse files
committed
ehnanced ladders now check quark:ladders tag. Narrator module keybind fix
1 parent b341459 commit c304952

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

changelog.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
- Fixed a crash when middle clicking a block and having Variant Selector module off
2-
- Middle clicking a variant block while NOT having its parent variant in hand will now make you select the latter
1+
- Magnets can now push multiple blocks at once
2+
- Magnets can now pull blocks through semi transparent blocks, including other moveable ones like rails
3+
- Variant selector will properly delegate method calls to the selected block placement logic
4+
- Enhanced ladders features will now only be applied to blocks in the quark:ladders tag
5+
- Fixed an issue with NarratorReaduout module and its keybinds not being registered if module is turned off

src/main/java/org/violetmoon/quark/content/experimental/module/NarratorReadoutModule.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ public static class Client extends NarratorReadoutModule {
4343

4444
@LoadEvent
4545
public void registerKeybinds(ZKeyMapping event) {
46-
if(enabled) {
47-
keybind = event.init("quark.keybind.narrator_readout", null, QuarkClient.MISC_GROUP);
48-
keybindFull = event.init("quark.keybind.narrator_full_readout", null, QuarkClient.MISC_GROUP);
49-
}
46+
keybind = event.init("quark.keybind.narrator_readout", null, QuarkClient.MISC_GROUP);
47+
keybindFull = event.init("quark.keybind.narrator_full_readout", null, QuarkClient.MISC_GROUP);
5048
}
5149

5250
@PlayEvent

src/main/java/org/violetmoon/quark/content/tweaks/module/EnhancedLaddersModule.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.minecraft.resources.ResourceLocation;
1111
import net.minecraft.sounds.SoundEvents;
1212
import net.minecraft.sounds.SoundSource;
13+
import net.minecraft.tags.BlockTags;
1314
import net.minecraft.tags.ItemTags;
1415
import net.minecraft.tags.TagKey;
1516
import net.minecraft.world.InteractionHand;
@@ -65,10 +66,12 @@ public class EnhancedLaddersModule extends ZetaModule {
6566

6667
private static boolean staticEnabled;
6768
private static TagKey<Item> laddersTag;
69+
private static TagKey<Block> laddersBlockTag;
6870

6971
@LoadEvent
7072
public final void setup(ZCommonSetup event) {
7173
laddersTag = ItemTags.create(new ResourceLocation(Quark.MOD_ID, "ladders"));
74+
laddersBlockTag = BlockTags.create(new ResourceLocation(Quark.MOD_ID, "ladders"));
7275
}
7376

7477
@LoadEvent
@@ -116,31 +119,26 @@ private static boolean canAttachTo(BlockState state, Block ladder, LevelReader w
116119
return false;
117120
}
118121

122+
// replaces ladder survives logic
119123
public static boolean canLadderSurvive(BlockState state, LevelReader world, BlockPos pos) {
120124
if(!staticEnabled || !allowFreestanding)
121125
return false;
126+
if(!state.is(laddersBlockTag))return false;
122127

123128
Direction facing = state.getValue(LadderBlock.FACING);
124129
Direction opposite = facing.getOpposite();
125130
BlockPos oppositePos = pos.relative(opposite);
126131
BlockState oppositeState = world.getBlockState(oppositePos);
127132

128-
boolean solid = facing.getAxis() != Axis.Y && oppositeState.isFaceSturdy(world, oppositePos, facing) && !(oppositeState.getBlock() instanceof LadderBlock);
133+
boolean solid = oppositeState.isFaceSturdy(world, oppositePos, facing) && !(oppositeState.getBlock() instanceof LadderBlock);
129134
BlockState topState = world.getBlockState(pos.above());
130135
return solid || (topState.getBlock() instanceof LadderBlock && (facing.getAxis() == Axis.Y || topState.getValue(LadderBlock.FACING) == facing));
131136
}
132137

133-
public static boolean updateLadder(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos) {
134-
if(!staticEnabled || !allowFreestanding)
135-
return true;
136-
137-
return canLadderSurvive(state, world, currentPos);
138-
}
139138

140139
@PlayEvent
141140
public void onInteract(ZRightClickBlock event) {
142-
if(!allowDroppingDown)
143-
return;
141+
if(!allowDroppingDown) return;
144142

145143
Player player = event.getPlayer();
146144
InteractionHand hand = event.getHand();

src/main/java/org/violetmoon/quark/mixin/mixins/LadderBlockMixin.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@Mixin(LadderBlock.class)
1919
public class LadderBlockMixin {
2020

21+
2122
@Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true)
2223
private void canSurvive(BlockState state, LevelReader level, BlockPos pos, CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
2324
if(EnhancedLaddersModule.canLadderSurvive(state, level, pos)) {
@@ -26,12 +27,4 @@ private void canSurvive(BlockState state, LevelReader level, BlockPos pos, Callb
2627
}
2728
}
2829

29-
@Inject(method = "updateShape", at = @At("HEAD"), cancellable = true)
30-
private void updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos, CallbackInfoReturnable<BlockState> callbackInfoReturnable) {
31-
if(!EnhancedLaddersModule.updateLadder(state, facing, facingState, world, currentPos, facingPos)) {
32-
callbackInfoReturnable.setReturnValue(Blocks.AIR.defaultBlockState());
33-
callbackInfoReturnable.cancel();
34-
}
35-
}
36-
3730
}

0 commit comments

Comments
 (0)