Skip to content

Commit 57fde27

Browse files
committed
1.2.2
1 parent 2950566 commit 57fde27

File tree

8 files changed

+29
-49
lines changed

8 files changed

+29
-49
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ neo_version_range=[21.1.180,)
88
loader_version_range=[1,)
99

1010
# Mod Properties
11-
version=1.2.0
11+
version=1.2.2
1212
group=zh.qiushui.mod
1313
archives_name=qca

latest-changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## What's new
2-
- **Add NeoForge 1.21.1 (rolling gate) support**
2+
- **Fixed hopper cannot be limited by item frame**
33
-----------------------------------------------------------------
44
## 新更改
5-
- **添加NeoForge 1.21.1(卷帘门)的支持**
5+
- **修复了漏斗无法被物品展示框限类的问题**

src/main/java/zh/qiushui/mod/qca/Qca.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,16 @@ public static ResourceLocation id(String path) {
2727
private static void onServerTick(ServerTickEvent.Post event) {
2828
BeaconUtil.tick();
2929
}
30+
31+
public static void debugLog(String message) {
32+
if (QcaServerRules.qcaDebugLog) {
33+
Qca.LOGGER.debug(message);
34+
}
35+
}
36+
37+
public static void debugLog(String message, Object... args) {
38+
if (QcaServerRules.qcaDebugLog) {
39+
Qca.LOGGER.debug(message, args);
40+
}
41+
}
3042
}

src/main/java/zh/qiushui/mod/qca/mixin/rule/beaconIncreaseInteractionRange/MixinBeaconBlockEntity.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public MixinBeaconBlockEntity(
4343
@Inject(method = "<init>", at = @At("TAIL"))
4444
private void registerIdentifier(BlockPos blockPos, BlockState blockState, CallbackInfo ci) {
4545
BeaconUtil.TASKS.register(blockPos);
46-
if (QcaServerRules.qcaDebugLog) {
47-
Qca.LOGGER.debug("Tried to register an identifier to the beacon task manager.");
48-
}
46+
Qca.debugLog("Tried to register an identifier to the beacon task manager.");
4947
}
5048

5149
@Inject(
@@ -72,9 +70,7 @@ private void registerIdentifier(BlockPos blockPos, BlockState blockState, Callba
7270
BeaconUtil.removeBeaconIncreaseModifiersForPlayer(this.getBlockPos(), player);
7371
}
7472
BeaconUtil.TASKS.remove(this.getBlockPos());
75-
if (QcaServerRules.qcaDebugLog) {
76-
Qca.LOGGER.debug("Tried to remove this identifier from the beacon task manager.");
77-
}
73+
Qca.debugLog("Tried to remove this identifier from the beacon task manager.");
7874
}
7975

8076
@Unique
@@ -89,18 +85,14 @@ private void registerIdentifier(BlockPos blockPos, BlockState blockState, Callba
8985
for (Player player : ((IncreaseInteractionRange) beacon).qca$getIncreasedPlayers()) {
9086
BeaconUtil.removeBeaconIncreaseModifiersForPlayer(beacon.getBlockPos(), player);
9187
}
92-
if (QcaServerRules.qcaDebugLog) {
93-
Qca.LOGGER.debug("(Tick) Tried to remove the modifier from the increased players.");
94-
}
88+
Qca.debugLog("(Tick) Tried to remove the modifier from the increased players.");
9589

9690
for (Player player : inRangePlayers) {
9791
BeaconUtil.addBeaconIncreaseModifiersForPlayer(beacon.getBlockPos(), player, levels);
9892

9993
((IncreaseInteractionRange) beacon).qca$getIncreasedPlayers().add(player);
10094
}
101-
if (QcaServerRules.qcaDebugLog) {
102-
Qca.LOGGER.debug("(Tick) Tried to add the modifier to the players in range.");
103-
}
95+
Qca.debugLog("(Tick) Tried to add the modifier to the players in range.");
10496
}
10597
}
10698
}

src/main/java/zh/qiushui/mod/qca/mixin/rule/crafterLimitation/MixinCrafterBlock.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,14 @@ public abstract class MixinCrafterBlock {
7575

7676
if (sections.isEmpty()) {
7777
this.qca$limitation = null;
78-
if (QcaServerRules.qcaDebugLog) {
79-
Qca.LOGGER.debug("A crafter located at {} reset its restrictor.", pos);
80-
}
78+
Qca.debugLog("A crafter located at {} reset its restrictor.", pos);
8179
return;
8280
}
8381
if (sections.size() > 1) {
8482
this.qca$limitation = new AllSection(sections);
8583
}
8684
this.qca$limitation = sections.getFirst();
87-
if (QcaServerRules.qcaDebugLog) {
88-
Qca.LOGGER.debug("A crafter located at {} updated its limit source {}.", pos, this.qca$limitation);
89-
}
85+
Qca.debugLog("A crafter located at {} updated its limit source {}.", pos, this.qca$limitation);
9086
}
9187

9288
@ModifyExpressionValue(
@@ -95,12 +91,10 @@ public abstract class MixinCrafterBlock {
9591
private boolean qca$limitResult(boolean isEmpty, @Local(ordinal = 0) ItemStack stack) {
9692
if (!QcaServerRules.canLimit(QcaServerRules.crafterLimitation)) return isEmpty;
9793
boolean matched = this.qca$limitation.test(stack);
98-
if (QcaServerRules.qcaDebugLog) {
99-
Qca.LOGGER.debug(
100-
"A crafter just limited. Input: {}, Result: {}",
101-
stack, isEmpty ? "Failed. The instance is empty." : matched ? "Successfully limited." : "Failed."
102-
);
103-
}
94+
Qca.debugLog(
95+
"A crafter just limited. Input: {}, Result: {}",
96+
stack, isEmpty ? "Failed. The instance is empty." : matched ? "Successfully limited." : "Failed."
97+
);
10498
return isEmpty || !matched;
10599
}
106100
}

src/main/java/zh/qiushui/mod/qca/mixin/rule/easyHopperLimitation/HopperAccessor.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/main/java/zh/qiushui/mod/qca/mixin/rule/easyHopperLimitation/MixinHopperBlockEntity.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,14 @@ protected MixinHopperBlockEntity(BlockEntityType<?> blockEntityType, BlockPos bl
7474
if (!QcaServerRules.canLimit(QcaServerRules.easyHopperLimitation)) return;
7575
List<Section> sections = new ArrayList<>();
7676
if (QcaServerRules.canLimitByItemFrame(QcaServerRules.easyHopperLimitation)) {
77-
Direction facing = UnsafeUtil.<HopperAccessor>cast(hopper).qca$getFacing();
7877
List<ItemFrame> frames = EntityUtil.getEntitiesIf(
79-
level, pos.relative(facing),
80-
frame -> !frame.getDirection().equals(facing) || frame.getItem().isEmpty(),
78+
level, pos.above(),
79+
frame -> !frame.getDirection().equals(Direction.UP) || frame.getItem().isEmpty(),
8180
EntityType.ITEM_FRAME, EntityType.GLOW_ITEM_FRAME
8281
);
8382
if (!frames.isEmpty()) {
8483
sections.add(new AnySection(Lists.transform(frames, frame -> new ItemSection(frame.getItem()))));
85-
if (QcaServerRules.qcaDebugLog) {
86-
Qca.LOGGER.debug("(Tick) Tried to set the restrictor from the item frame.");
87-
}
84+
Qca.debugLog("(Tick) Tried to set the restrictor from the item frame.");
8885
}
8986
}
9087
if (QcaServerRules.canLimitByCustomName(QcaServerRules.easyHopperLimitation)) {
@@ -93,9 +90,7 @@ protected MixinHopperBlockEntity(BlockEntityType<?> blockEntityType, BlockPos bl
9390
if (!Objects.equals(UnsafeUtil.<HopperCache>cast(hopper).qca$getCache(), name)) {
9491
UnsafeUtil.<HopperCache>cast(hopper).qca$setCache(name);
9592
sections.add(ItemPredicateParser.parseItemPredicate(name.getString()).orElse(null));
96-
if (QcaServerRules.qcaDebugLog) {
97-
Qca.LOGGER.debug("(Tick) Tried to set the restrictor from the custom name.");
98-
}
93+
Qca.debugLog("(Tick) Tried to set the restrictor from the custom name.");
9994
}
10095
});
10196
}

src/main/resources/qca.mixins.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"rule.boneMealDoubleSmallFlowers.MixinFlowerBlock",
99
"rule.breakDripleafKeepStem.MixinBigDripleafStemBlock",
1010
"rule.crafterLimitation.MixinCrafterBlock",
11-
"rule.easyHopperLimitation.HopperAccessor",
1211
"rule.easyHopperLimitation.MixinHopperBlockEntity",
1312
"rule.itemsCanPassThroughChains.MixinChainBlock",
1413
"rule.pvpDoNotDamageEquipment.MixinLivingEntity",

0 commit comments

Comments
 (0)