Skip to content

Commit b516fc4

Browse files
committed
update 1.2.2
1 parent 16326e9 commit b516fc4

File tree

49 files changed

+801
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+801
-932
lines changed

build.gradle

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
alias libs.plugins.fabric.loom
3+
alias libs.plugins.lombok
34
alias libs.plugins.modpublish
45
}
56

@@ -22,10 +23,7 @@ loom {
2223

2324
dependencies {
2425
minecraft libs.minecraft
25-
mappings libs.mappings.yarn
26-
27-
compileOnly libs.lombok
28-
annotationProcessor libs.lombok
26+
mappings loom.officialMojangMappings()
2927

3028
modImplementation libs.bundles.fabric
3129

@@ -57,37 +55,8 @@ jar {
5755
}
5856
}
5957

60-
publishMods {
61-
file = remapJar.archiveFile
62-
additionalFiles.from(remapSourcesJar.archiveFile)
63-
changelog = file("latest-changelog.md").text
64-
type = STABLE
65-
modLoaders.add("fabric")
58+
apply from: "$rootDir/gradle/scripts/publish.gradle"
6659

67-
curseforge {
68-
projectId = "1166675"
69-
projectSlug = "qualia-carpet-addition"
70-
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
71-
requires("fabric-api")
72-
requires("carpet")
73-
minecraftVersions.add("1.21")
74-
minecraftVersions.add("1.21.1")
75-
displayName = rootProject.version
76-
}
77-
modrinth {
78-
projectId = "JyI4tI00"
79-
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
80-
requires("fabric-api")
81-
requires("carpet")
82-
minecraftVersions.add("1.21")
83-
minecraftVersions.add("1.21.1")
84-
displayName = rootProject.version
85-
}
86-
github {
87-
repository = "QiuShui1012/Qualia-Carpet-Addition"
88-
accessToken = providers.environmentVariable("GITHUB_TOKEN")
89-
commitish = "fabric/1.21-1.21.1"
90-
displayName = project.version
91-
tagName = project.version
92-
}
60+
lombok {
61+
version = "1.18.34"
9362
}

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
org.gradle.jvmargs=-Xmx1G
33
org.gradle.parallel=true
44

5-
65
# Mod Properties
7-
version=1.2.1
6+
version=1.2.2
87
group=zh.qiushui.mod
98
archives_name=qca

gradle/libs.versions.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,23 @@
44
minecraft = "1.21.1"
55
fabric-loader = "0.16.14"
66

7-
mappings-yarn = "1.21.1+build.3"
8-
97
# Dependency Properties
108
fabric-api = "0.116.2+1.21.1"
119
fabric-carpet = "1.21-1.4.147+v240613"
1210

13-
lombok = "1.18.30"
14-
1511
# Gradle Plugin Properties
1612
fabric-loom = "1.10-SNAPSHOT"
13+
lombok = "8.7.1"
1714
modpublish = "0.8.4"
1815

1916
[libraries]
2017

2118
# Common
2219
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
23-
lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok"}
2420

2521
# Fabric
2622
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
2723
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
28-
mappings-yarn = { group = "net.fabricmc", name = "yarn", version.ref = "mappings-yarn" }
2924

3025
# Carpet
3126
fabric-carpet = { group = "carpet", name = "fabric-carpet", version.ref = "fabric-carpet" }
@@ -37,4 +32,5 @@ fabric = ["fabric-loader", "fabric-api"]
3732
[plugins]
3833

3934
fabric-loom = { id = "fabric-loom", version.ref = "fabric-loom" }
35+
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
4036
modpublish = { id = "me.modmuss50.mod-publish-plugin", version.ref = "modpublish"}

gradle/scripts/publish.gradle

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
publishMods {
2+
file = remapJar.archiveFile
3+
additionalFiles.from(remapSourcesJar.archiveFile)
4+
changelog = file("latest-changelog.md").text
5+
type = STABLE
6+
modLoaders.add("fabric")
7+
8+
curseforge {
9+
projectId = "1166675"
10+
projectSlug = "qualia-carpet-addition"
11+
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
12+
requires("fabric-api")
13+
requires("carpet")
14+
minecraftVersions.add("1.21")
15+
minecraftVersions.add("1.21.1")
16+
displayName = rootProject.version
17+
}
18+
modrinth {
19+
projectId = "JyI4tI00"
20+
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
21+
requires("fabric-api")
22+
requires("carpet")
23+
minecraftVersions.add("1.21")
24+
minecraftVersions.add("1.21.1")
25+
displayName = rootProject.version
26+
}
27+
github {
28+
repository = "QiuShui1012/Qualia-Carpet-Addition"
29+
accessToken = providers.environmentVariable("GITHUB_TOKEN")
30+
commitish = "fabric/1.21-1.21.1"
31+
displayName = project.version
32+
tagName = project.version
33+
}
34+
}

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-
- **Fixed the wrong Minecraft version range in `fabric.mod.json`**
2+
- **Fixed hopper cannot be limited by item frame**
33
-----------------------------------------------------------------
44
## 新更改
5-
- **修复了 `fabric.mod.json` 中的Minecraft版本范围错误的问题**
5+
- **修复了漏斗无法被物品展示框限类的问题**

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

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
import carpet.CarpetExtension;
44
import carpet.CarpetServer;
5-
import com.mojang.brigadier.CommandDispatcher;
65
import net.fabricmc.api.ModInitializer;
7-
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
8-
import net.minecraft.command.CommandRegistryAccess;
9-
import net.minecraft.server.command.ServerCommandSource;
10-
import net.minecraft.util.Identifier;
6+
import net.minecraft.resources.ResourceLocation;
7+
import net.minecraft.server.MinecraftServer;
118
import org.slf4j.Logger;
129
import org.slf4j.LoggerFactory;
1310
import zh.qiushui.mod.qca.rule.util.beaconIncreaseInteractionRange.BeaconUtil;
@@ -21,35 +18,44 @@ public class QcaExtension implements CarpetExtension, ModInitializer {
2118

2219
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);
2320

24-
public static Identifier id(String path) {
25-
return Identifier.of(MOD_ID, path);
21+
public static ResourceLocation id(String path) {
22+
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
2623
}
2724

2825
@Override
2926
public void onInitialize() {
3027
CarpetServer.manageExtension(this);
31-
32-
ServerTickEvents.END_WORLD_TICK.register(world -> BeaconUtil.tick());
3328
}
3429

3530
@Override
36-
public void onGameStarted() {
37-
CarpetServer.settingsManager.parseSettingsClass(QcaSettings.class);
31+
public String version() {
32+
return MOD_ID;
3833
}
3934

4035
@Override
41-
public void registerCommands(
42-
CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess commandBuildContext
43-
) {
36+
public void onTick(MinecraftServer server) {
37+
BeaconUtil.tick();
4438
}
4539

4640
@Override
47-
public String version() {
48-
return MOD_ID;
41+
public void onGameStarted() {
42+
CarpetServer.settingsManager.parseSettingsClass(QcaSettings.class);
4943
}
5044

5145
@Override
5246
public Map<String, String> canHasTranslations(String lang) {
5347
return TranslationsUtil.getTranslations(lang);
5448
}
49+
50+
public static void debugLog(String message) {
51+
if (QcaSettings.qcaDebugLog) {
52+
QcaExtension.LOGGER.debug(message);
53+
}
54+
}
55+
56+
public static void debugLog(String message, Object... args) {
57+
if (QcaSettings.qcaDebugLog) {
58+
QcaExtension.LOGGER.debug(message, args);
59+
}
60+
}
5561
}

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package zh.qiushui.mod.qca;
22

33
import carpet.api.settings.Rule;
4-
import net.minecraft.block.Block;
4+
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
5+
import net.minecraft.world.level.block.Block;
56
import zh.qiushui.mod.qca.rule.util.PlantTransformUtil;
67

78
import java.util.Arrays;
@@ -131,11 +132,19 @@ public static boolean beaconIncreaseIsEnabled() {
131132
return !beaconIncreaseInteractionRange.equals("false");
132133
}
133134

134-
public static boolean beaconIncreaseModeIsAdd() {
135+
public static AttributeModifier.Operation beaconIncreaseMode() {
136+
return QcaSettings.beaconIncreaseModeIsAdd()
137+
? AttributeModifier.Operation.ADD_VALUE
138+
: QcaSettings.beaconIncreaseModeIsBase()
139+
? AttributeModifier.Operation.ADD_MULTIPLIED_BASE
140+
: AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL;
141+
}
142+
143+
private static boolean beaconIncreaseModeIsAdd() {
135144
return beaconIncreaseInteractionRange.contains("add");
136145
}
137146

138-
public static boolean beaconIncreaseModeIsBase() {
147+
private static boolean beaconIncreaseModeIsBase() {
139148
return beaconIncreaseInteractionRange.contains("Base");
140149
}
141150

@@ -153,24 +162,17 @@ public static double getBeaconIncreaseInteractionRangeValue(int level) {
153162
boolean isAdd = beaconIncreaseModeIsAdd();
154163
return beaconIncreaseModeIsWithoutLevel()
155164
? beaconIncreaseInteractionRangeValue
156-
: (
157-
isAdd
158-
? (level + beaconIncreaseInteractionRangeValue)
159-
: (level * beaconIncreaseInteractionRangeValue)
160-
);
165+
: isAdd
166+
? (level + beaconIncreaseInteractionRangeValue)
167+
: (level * beaconIncreaseInteractionRangeValue);
161168
}
162169

163-
@Rule(
164-
categories = {QCA, PVP, SURVIVAL, FEATURE, EXPERIMENTAL}
165-
)
170+
@Rule(categories = {QCA, PVP, SURVIVAL, FEATURE, EXPERIMENTAL})
166171
public static boolean pvpDoNotDamageEquipment = false;
167-
@Rule(
168-
categories = {QCA, PVP, SURVIVAL, FEATURE, EXPERIMENTAL}
169-
)
172+
173+
@Rule(categories = {QCA, PVP, SURVIVAL, FEATURE, EXPERIMENTAL})
170174
public static boolean pvpDoNotDamageWeapon = false;
171175

172-
@Rule(
173-
categories = {QCA, SURVIVAL, FEATURE, EXPERIMENTAL}
174-
)
176+
@Rule(categories = {QCA, SURVIVAL, FEATURE, EXPERIMENTAL})
175177
public static boolean boneMealDoubleSmallFlowers = false;
176178
}

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import carpet.api.settings.CarpetRule;
44
import carpet.api.settings.Validator;
55
import com.google.common.collect.ImmutableSet;
6-
import net.minecraft.server.command.ServerCommandSource;
6+
import net.minecraft.commands.CommandSourceStack;
77
import org.jetbrains.annotations.Nullable;
88

99
import java.util.Arrays;
@@ -14,9 +14,7 @@ public static class PlantTransform extends Validator<String> {
1414
private static final Set<String> OPTIONS = Set.of("enable", "grasses", "dripleaf", "flowers", "disable");
1515

1616
@Override
17-
public String validate(
18-
@Nullable ServerCommandSource serverCommandSource, CarpetRule<String> carpetRule, String newValue, String userInput
19-
) {
17+
public String validate(@Nullable CommandSourceStack source, CarpetRule<String> carpetRule, String newValue, String userInput) {
2018
String[] options = newValue.trim().split(",");
2119
return !OPTIONS.containsAll(Arrays.stream(options).toList()) ? null : newValue;
2220
}
@@ -29,9 +27,7 @@ public String description() {
2927

3028
public static class TooExpensiveLevel extends Validator<Integer> {
3129
@Override
32-
public Integer validate(
33-
@Nullable ServerCommandSource serverCommandSource, CarpetRule<Integer> carpetRule, Integer newValue, String userInput
34-
) {
30+
public Integer validate(@Nullable CommandSourceStack source, CarpetRule<Integer> carpetRule, Integer newValue, String userInput) {
3531
return newValue < -1 ? 39 : newValue;
3632
}
3733

@@ -45,9 +41,7 @@ public static class LimitationSources extends Validator<String> {
4541
private static final Set<String> OPTIONS = Set.of("disabled", "itemFrame", "customName");
4642

4743
@Override
48-
public String validate(
49-
@Nullable ServerCommandSource serverCommandSource, CarpetRule<String> carpetRule, String newValue, String userInput
50-
) {
44+
public String validate(@Nullable CommandSourceStack source, CarpetRule<String> carpetRule, String newValue, String userInput) {
5145
String[] options = newValue.trim().split(",");
5246
return !OPTIONS.containsAll(Arrays.stream(options).toList()) ? null : newValue;
5347
}
@@ -66,9 +60,7 @@ public static class BeaconIncreaseInteractionRangeMode extends Validator<String>
6660
);
6761

6862
@Override
69-
public String validate(
70-
@Nullable ServerCommandSource serverCommandSource, CarpetRule<String> carpetRule, String newValue, String userInput
71-
) {
63+
public String validate(@Nullable CommandSourceStack source, CarpetRule<String> carpetRule, String newValue, String userInput) {
7264
return !MODES.contains(newValue) ? null : newValue;
7365
}
7466

@@ -80,10 +72,7 @@ public String description() {
8072

8173
public static class BeaconIncreaseInteractionRangeValue extends Validator<Double> {
8274
@Override
83-
public Double validate(
84-
@Nullable ServerCommandSource serverCommandSource, CarpetRule<Double> carpetRule,
85-
Double newValue, String userInput
86-
) {
75+
public Double validate(@Nullable CommandSourceStack source, CarpetRule<Double> carpetRule, Double newValue, String userInput) {
8776
return (QcaSettings.beaconIncreaseIsEnabled() && newValue < 0) ? 0 : newValue;
8877
}
8978

@@ -92,4 +81,4 @@ public String description() {
9281
return "This value represents the addend or multiplier will be used in calculate increase value. Rule beaconIncreaseInteractionRange must be enabled. Value must be positive.";
9382
}
9483
}
95-
}
84+
}

src/main/java/zh/qiushui/mod/qca/api/parse/ItemPredicateParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package zh.qiushui.mod.qca.api.parse;
22

3-
import net.minecraft.item.Item;
3+
import net.minecraft.world.item.Item;
44
import zh.qiushui.mod.qca.api.section.AllSection;
55
import zh.qiushui.mod.qca.api.section.AnySection;
66
import zh.qiushui.mod.qca.api.section.ItemSection;
@@ -160,7 +160,7 @@ private Optional<Section> primary() {
160160

161161
if (this.match(TokenType.ID)) {
162162
return ParseUtil.parseItem(this.tokens.get(this.current - 1).value())
163-
.map(Item::getDefaultStack)
163+
.map(Item::getDefaultInstance)
164164
.map(ItemSection::new);
165165
}
166166
if (this.match(TokenType.TAG)) {
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package zh.qiushui.mod.qca.api.parse;
22

33
enum TokenType {
4-
NOT,
5-
AND,
6-
OR,
7-
LEFT_PAREN,
8-
RIGHT_PAREN,
9-
ID,
10-
TAG,
4+
NOT, AND, OR,
5+
LEFT_PAREN, RIGHT_PAREN,
6+
ID, TAG,
117
EOF
128
}

0 commit comments

Comments
 (0)