Skip to content

Commit d7e36ca

Browse files
committed
Merge remote-tracking branch 'upstream/master' into mbnbt
2 parents 694eca3 + e8ea849 commit d7e36ca

File tree

128 files changed

+1384
-1410
lines changed

Some content is hidden

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

128 files changed

+1384
-1410
lines changed

.github/workflows/build-on-pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v3
15-
- name: Set up JDK 17
15+
- name: Set up JDK 21
1616
uses: actions/setup-java@v3
1717
with:
1818
distribution: 'temurin'
19-
java-version: 17
19+
java-version: 21
2020
cache: 'gradle'
2121
- name: Grant execute permission to gradlew
2222
run: chmod +x gradlew

.github/workflows/devbuild.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v3
15-
- name: Set up JDK 17
15+
- name: Set up JDK 21
1616
uses: actions/setup-java@v3
1717
with:
1818
distribution: 'temurin'
19-
java-version: 17
19+
java-version: 21
2020
cache: 'gradle'
2121
- name: Grant execute permission to gradlew
2222
run: chmod +x gradlew

.github/workflows/publish-release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ jobs:
8181
uses: actions/checkout@v3
8282
with:
8383
ref: ${{ steps.getbranchinfo.outputs.branchname }}
84-
- name: Set up JDK 17
84+
- name: Set up JDK 21
8585
uses: actions/setup-java@v3
8686
with:
8787
distribution: 'temurin'
88-
java-version: 17
88+
java-version: 21
8989
cache: 'gradle'
9090
- name: Grant execute permission to gradlew
9191
run: chmod +x gradlew
@@ -167,11 +167,11 @@ jobs:
167167
steps:
168168
- name: Checkout Carpet sources
169169
uses: actions/checkout@v3
170-
- name: Set up JDK 17
170+
- name: Set up JDK 21
171171
uses: actions/setup-java@v3
172172
with:
173173
distribution: 'temurin'
174-
java-version: 17
174+
java-version: 21
175175
cache: 'gradle'
176176
- name: Checkout wiki
177177
uses: actions/checkout@v3

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ For core carpet functionality, this is the right place. Check available download
3030

3131
Check [carpet-extra](https://github.com/gnembon/carpet-extra/) add-on mod for more whacky and crazy features, including autocrafting, block-placing dispensers, and even chicken-shearing!
3232

33-
## auto crafting table
34-
35-
Due to compatibility issues with vanilla and other mods, download [auto crafting table](https://github.com/gnembon/carpet-autoCraftingTable/releases) by Skyrising as a separate add-on to carpet
36-
3733
## scarpet app store
3834

3935
If you want to browse or contribute to the scarpet app store check available apps, go [here](https://github.com/gnembon/scarpet), its free!

build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
plugins {
2-
id 'fabric-loom' version '1.0-SNAPSHOT'
2+
id 'fabric-loom' version '1.6-SNAPSHOT'
33
id 'io.github.juuxel.loom-quiltflower' version '1.7.3'
44
id 'maven-publish'
55
}
66

7-
sourceCompatibility = JavaVersion.VERSION_17
8-
targetCompatibility = JavaVersion.VERSION_17
7+
sourceCompatibility = JavaVersion.VERSION_21
8+
targetCompatibility = JavaVersion.VERSION_21
99

1010
archivesBaseName = project.archives_base_name
1111
version = project.minecraft_version+'-'+project.mod_version+'+v'+new Date().format('yyMMdd')
@@ -47,8 +47,8 @@ tasks.withType(JavaCompile).configureEach {
4747
// If Javadoc is generated, this must be specified in that task too.
4848
it.options.encoding = "UTF-8"
4949

50-
// Minecraft 1.18 upwards uses Java 17.
51-
it.options.release = 17
50+
// Minecraft 1.20.5 upwards uses Java 21.
51+
it.options.release = 21
5252
}
5353

5454
java {

docs/scarpet/Full.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -3650,7 +3650,7 @@ version indicates the version of the connected carpet client.
36503650
### `query(e, 'effect', name?)`
36513651
36523652
Without extra arguments, it returns list of effect active on a living entity. Each entry is a triple of short
3653-
effect name, amplifier, and remaining duration in ticks. With an argument, if the living entity has not that potion active,
3653+
effect name, amplifier, and remaining duration in ticks (-1 if it has infinity duration). With an argument, if the living entity has not that potion active,
36543654
returns `null`, otherwise return a tuple of amplifier and remaining duration.
36553655
36563656
<pre>
@@ -3990,7 +3990,7 @@ players, since they are controlled client side.
39903990
### `modify(e, 'effect', name?, duration?, amplifier?, show_particles?, show_icon?, ambient?)`
39913991

39923992
Applies status effect to the living entity. Takes several optional parameters, which default to `0`, `true`,
3993-
`true` and `false`. If no duration is specified, or if it's null or 0, the effect is removed. If name is not specified,
3993+
`true` and `false`. If no duration is specified, or if it's null or 0, the effect is removed. If duration is less than 0, it will represent infinity. If name is not specified,
39943994
it clears all effects.
39953995

39963996
### `modify(e, 'health', float)`
@@ -4257,7 +4257,8 @@ use the same scheme.
42574257
If the entity or a block doesn't have
42584258
an inventory, all API functions typically do nothing and return null.
42594259

4260-
Most items returned are in the form of a triple of item name, count, and nbt or the extra data associated with an item.
4260+
Most items returned are in the form of a triple of item name, count, and the full nbt of an item. When saving an item, if the
4261+
nbt is provided, it overrides the item type provided in the name.
42614262

42624263
### `item_list(tag?)`
42634264

@@ -4370,20 +4371,22 @@ negative numbers to indicate slots counted from 'the back'.
43704371

43714372
<pre>
43724373
inventory_get(player(), 0) => null // nothing in first hotbar slot
4373-
inventory_get(x,y,z, 5) => ['stone', 1, {}]
4374-
inventory_get(player(), -1) => ['diamond_pickaxe', 1, {Damage:4}] // slightly damaged diamond pick in the offhand
4374+
inventory_get(x,y,z, 5) => ['stone', 1, {id:"minecraft:stone"}]
4375+
inventory_get(player(), -1) => ['diamond_pickaxe', 1, {components:{"minecraft:damage":4},id:"minecraft:diamond_pickaxe"}] // slightly damaged diamond pick in the offhand
43754376
</pre>
43764377

43774378
### `inventory_set(inventory, slot, count, item?, nbt?)`
43784379

43794380
Modifies or sets a stack in inventory. specify count 0 to empty the slot. If item is not specified, keeps existing
4380-
item, just modifies the count. If item is provided - replaces current item. If nbt is provided - adds a tag to the
4381-
stack at slot. Returns previous stack in that slot.
4381+
item, just modifies the count. If item is provided - replaces current item. If nbt is provided - uses the tag to create the item fully
4382+
ignoring the item name. If nbt is provided and count is not null, the sets the custom count on the tag from the count parameter.
4383+
If count is `null` and item is `null`, an item is entirely defined by the `nbt` parameter. Returns previous stack in that slot.
43824384

43834385
<pre>
4384-
inventory_set(player(), 0, 0) => ['stone', 64, {}] // player had a stack of stone in first hotbar slot
4385-
inventory_set(player(), 0, 6) => ['diamond', 64, {}] // changed stack of diamonds in player slot to 6
4386-
inventory_set(player(), 0, 1, 'diamond_axe','{Damage:5}') => null //added slightly damaged diamond axe to first player slot
4386+
inventory_set(player(), 0, 0) => ['stone', 64, {id:"minecraft:stone"}] // player had a stack of stone in first hotbar slot
4387+
inventory_set(player(), 0, 6) => ['diamond', 64, {id:"minecraft:diamond"}] // changed stack of diamonds in player slot to 6
4388+
inventory_set(player(), 0, 1, 'diamond_axe','{components:{"minecraft:damage":5},id:"minecraft:diamond_axe"}') => null //added slightly damaged diamond axe to first player slot
4389+
inventory_set(player(), 0, null, null, '{components:{"minecraft:damage":5},id:"minecraft:diamond_axe"}') => null // same effect as above
43874390
</pre>
43884391

43894392
### `inventory_find(inventory, item, start_slot?, ), inventory_find(inventory, null, start_slot?)`
@@ -5334,9 +5337,8 @@ Valid mixer options are `master`, `music`, `record`, `weather`, `block`, `hostil
53345337
and `voice`. `pos` can be either a block, triple of coords, or a list of three numbers. Uses the same options as a
53355338
corresponding `playsound` command.
53365339
5337-
Used with no arguments, return the list of available sound names.
5338-
5339-
Throws `unknown_sound` if sound doesn't exist.
5340+
Used with no arguments, returns a list of available sound names. Note that this list may not include all sounds that
5341+
clients will actually be able to receive (they may have more available via resourcepacks for example).
53405342
53415343
## Particles
53425344

docs/scarpet/api/Auxiliary.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ Valid mixer options are `master`, `music`, `record`, `weather`, `block`, `hostil
1212
and `voice`. `pos` can be either a block, triple of coords, or a list of three numbers. Uses the same options as a
1313
corresponding `playsound` command.
1414

15-
Used with no arguments, return the list of available sound names.
16-
17-
Throws `unknown_sound` if sound doesn't exist.
15+
Used with no arguments, returns a list of available sound names. Note that this list may not include all sounds that
16+
clients will actually be able to receive (they may have more available via resourcepacks for example).
1817

1918
## Particles
2019

docs/scarpet/api/Entities.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ version indicates the version of the connected carpet client.
421421
### `query(e, 'effect', name?)`
422422

423423
Without extra arguments, it returns list of effect active on a living entity. Each entry is a triple of short
424-
effect name, amplifier, and remaining duration in ticks. With an argument, if the living entity has not that potion active,
424+
effect name, amplifier, and remaining duration in ticks (-1 if it has infinity duration). With an argument, if the living entity has not that potion active,
425425
returns `null`, otherwise return a tuple of amplifier and remaining duration.
426426

427427
<pre>
@@ -761,7 +761,7 @@ players, since they are controlled client side.
761761
### `modify(e, 'effect', name?, duration?, amplifier?, show_particles?, show_icon?, ambient?)`
762762

763763
Applies status effect to the living entity. Takes several optional parameters, which default to `0`, `true`,
764-
`true` and `false`. If no duration is specified, or if it's null or 0, the effect is removed. If name is not specified,
764+
`true` and `false`. If no duration is specified, or if it's null or 0, the effect is removed. If duration is less than 0, it will represent infinity. If name is not specified,
765765
it clears all effects.
766766

767767
### `modify(e, 'health', float)`

docs/scarpet/api/Inventories.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ use the same scheme.
2626
If the entity or a block doesn't have
2727
an inventory, all API functions typically do nothing and return null.
2828

29-
Most items returned are in the form of a triple of item name, count, and nbt or the extra data associated with an item.
29+
Most items returned are in the form of a triple of item name, count, and the full nbt of an item. When saving an item, if the
30+
nbt is provided, it overrides the item type provided in the name.
3031

3132
### `item_list(tag?)`
3233

@@ -139,20 +140,22 @@ negative numbers to indicate slots counted from 'the back'.
139140

140141
<pre>
141142
inventory_get(player(), 0) => null // nothing in first hotbar slot
142-
inventory_get(x,y,z, 5) => ['stone', 1, {}]
143-
inventory_get(player(), -1) => ['diamond_pickaxe', 1, {Damage:4}] // slightly damaged diamond pick in the offhand
143+
inventory_get(x,y,z, 5) => ['stone', 1, {id:"minecraft:stone"}]
144+
inventory_get(player(), -1) => ['diamond_pickaxe', 1, {components:{"minecraft:damage":4},id:"minecraft:diamond_pickaxe"}] // slightly damaged diamond pick in the offhand
144145
</pre>
145146

146147
### `inventory_set(inventory, slot, count, item?, nbt?)`
147148

148149
Modifies or sets a stack in inventory. specify count 0 to empty the slot. If item is not specified, keeps existing
149-
item, just modifies the count. If item is provided - replaces current item. If nbt is provided - adds a tag to the
150-
stack at slot. Returns previous stack in that slot.
150+
item, just modifies the count. If item is provided - replaces current item. If nbt is provided - uses the tag to create the item fully
151+
ignoring the item name. If nbt is provided and count is not null, the sets the custom count on the tag from the count parameter.
152+
If count is `null` and item is `null`, an item is entirely defined by the `nbt` parameter. Returns previous stack in that slot.
151153

152154
<pre>
153-
inventory_set(player(), 0, 0) => ['stone', 64, {}] // player had a stack of stone in first hotbar slot
154-
inventory_set(player(), 0, 6) => ['diamond', 64, {}] // changed stack of diamonds in player slot to 6
155-
inventory_set(player(), 0, 1, 'diamond_axe','{Damage:5}') => null //added slightly damaged diamond axe to first player slot
155+
inventory_set(player(), 0, 0) => ['stone', 64, {id:"minecraft:stone"}] // player had a stack of stone in first hotbar slot
156+
inventory_set(player(), 0, 6) => ['diamond', 64, {id:"minecraft:diamond"}] // changed stack of diamonds in player slot to 6
157+
inventory_set(player(), 0, 1, 'diamond_axe','{components:{"minecraft:damage":5},id:"minecraft:diamond_axe"}') => null //added slightly damaged diamond axe to first player slot
158+
inventory_set(player(), 0, null, null, '{components:{"minecraft:damage":5},id:"minecraft:diamond_axe"}') => null // same effect as above
156159
</pre>
157160

158161
### `inventory_find(inventory, item, start_slot?, ), inventory_find(inventory, null, start_slot?)`

gradle.properties

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check https://fabricmc.net/develop/
6-
minecraft_version=23w43a
7-
loader_version=0.14.22
6+
minecraft_version=1.21
7+
loader_version=0.15.11
88
jsr305_version=3.0.2
9-
fabric_version=0.89.3+1.20.2
9+
fabric_version=0.99.2+1.21
1010

1111
# Mod Properties
12-
mod_version = 1.4.123
12+
mod_version = 1.4.147
1313
maven_group = carpet
1414
archives_base_name = fabric-carpet
1515

1616
# Release Action properties for Curseforge and Snapshots
1717
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
1818
# This is needed because CF uses too vague names for prereleases and release candidates
1919
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
20-
release-curse-versions = Minecraft 1.20:1.20.3-Snapshot
20+
release-curse-versions = Minecraft 1.21:1.21
2121
# Whether or not to build another branch on release
2222
release-extra-branch = false
2323
# The name of the second branch to release
24-
release-extra-branch-name = 1.20.2
24+
release-extra-branch-name = 1.20.4
2525
# The "name" or id of the Curseforge version for the secondary branch
2626
# This is needed because CF uses too vague names for snapshots
2727
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
28-
release-extra-curse-version = Minecraft 1.20:1.20.2
28+
release-extra-curse-version = Minecraft 1.20:1.20.4-Snapshot
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

jitpack.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
before_install:
2-
- sdk install java 17.0.1-open
3-
- sdk use java 17.0.1-open
2+
- sdk install java 21.0.2-open
3+
- sdk use java 21.0.2-open

src/main/java/carpet/CarpetSettings.java

+6-34
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import carpet.utils.Translations;
1010
import carpet.utils.CommandHelper;
1111
import carpet.utils.Messenger;
12-
import carpet.utils.SpawnChunks;
1312
import net.fabricmc.loader.api.FabricLoader;
13+
import net.fabricmc.loader.api.SemanticVersion;
1414
import net.minecraft.commands.CommandSourceStack;
1515
import net.minecraft.core.registries.Registries;
1616
import net.minecraft.resources.ResourceLocation;
@@ -49,7 +49,10 @@
4949
public class CarpetSettings
5050
{
5151
public static final String carpetVersion = FabricLoader.getInstance().getModContainer("carpet").orElseThrow().getMetadata().getVersion().toString();
52-
public static final String releaseTarget = "1.20.3";
52+
public static final int [] releaseTarget = {
53+
((SemanticVersion)FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion()).getVersionComponent(1),
54+
((SemanticVersion)FabricLoader.getInstance().getModContainer("minecraft").orElseThrow().getMetadata().getVersion()).getVersionComponent(2)
55+
};
5356
public static final Logger LOG = LoggerFactory.getLogger("carpet");
5457
public static final ThreadLocal<Boolean> skipGenerationChecks = ThreadLocal.withInitial(() -> false);
5558
public static final ThreadLocal<Boolean> impendingFillSkipUpdates = ThreadLocal.withInitial(() -> false);
@@ -319,7 +322,7 @@ public Integer validate(CommandSourceStack source, CarpetRule<Integer> changingR
319322
int minRange = 0;
320323
int maxRange = 1;
321324

322-
if (source == null) {
325+
if (source == null || !source.getServer().isReady()) {
323326
maxRange = Integer.MAX_VALUE;
324327
} else {
325328
for (Level level : source.getServer().getAllLevels()) {
@@ -770,37 +773,6 @@ private static class SimulationDistanceValidator extends Validator<Integer>
770773
)
771774
public static int simulationDistance = 0;
772775

773-
public static class ChangeSpawnChunksValidator extends Validator<Integer> {
774-
@Override public Integer validate(CommandSourceStack source, CarpetRule<Integer> currentRule, Integer newValue, String string) {
775-
if (source == null) return newValue;
776-
if (newValue < 0 || newValue > 32)
777-
{
778-
Messenger.m(source, "r spawn chunk size has to be between 0 and 32");
779-
return null;
780-
}
781-
if (currentRule.value().intValue() == newValue.intValue())
782-
{
783-
//must been some startup thing
784-
return newValue;
785-
}
786-
ServerLevel currentOverworld = source.getServer().overworld();
787-
if (currentOverworld != null)
788-
{
789-
SpawnChunks.changeSpawnSize(currentOverworld, newValue);
790-
}
791-
return newValue;
792-
}
793-
}
794-
@Rule(
795-
desc = "Changes size of spawn chunks",
796-
extra = {"Defines new radius", "setting it to 0 - disables spawn chunks"},
797-
category = CREATIVE,
798-
strict = false,
799-
options = {"0", "11"},
800-
validate = ChangeSpawnChunksValidator.class
801-
)
802-
public static int spawnChunksSize = MinecraftServer.START_CHUNK_RADIUS;
803-
804776
public enum RenewableCoralMode {
805777
FALSE,
806778
EXPANDED,

src/main/java/carpet/commands/PlayerCommand.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
1717
import com.mojang.brigadier.context.CommandContext;
1818
import com.mojang.brigadier.exceptions.CommandSyntaxException;
19+
import net.minecraft.SharedConstants;
1920
import net.minecraft.commands.CommandBuildContext;
2021
import net.minecraft.commands.CommandSourceStack;
2122
import net.minecraft.commands.arguments.DimensionArgument;
@@ -293,16 +294,18 @@ private static int spawn(CommandContext<CommandSourceStack> context) throws Comm
293294
Messenger.m(source, "rb Player " + playerName + " cannot be placed outside of the world");
294295
return 0;
295296
}
296-
EntityPlayerMPFake.createFake(playerName, source.getServer(), pos, facing.y, facing.x, dimType, mode, flying, () -> {
297+
boolean success = EntityPlayerMPFake.createFake(playerName, source.getServer(), pos, facing.y, facing.x, dimType, mode, flying);
298+
if (!success) {
297299
Messenger.m(source, "rb Player " + playerName + " doesn't exist and cannot spawn in online mode. " +
298-
"Turn the server offline to spawn non-existing players");
299-
});
300+
"Turn the server offline or the allowSpawningOfflinePlayers on to spawn non-existing players");
301+
return 0;
302+
};
300303
return 1;
301304
}
302305

303306
private static int maxNameLength(MinecraftServer server)
304307
{
305-
return server.getPort() >= 0 ? Player.MAX_NAME_LENGTH : 40;
308+
return server.getPort() >= 0 ? SharedConstants.MAX_PLAYER_NAME_LENGTH : 40;
306309
}
307310

308311
private static int manipulate(CommandContext<CommandSourceStack> context, Consumer<EntityPlayerActionPack> action)
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package carpet.fakes;
22

3-
import com.mojang.datafixers.util.Either;
43
import java.util.concurrent.CompletableFuture;
5-
import net.minecraft.server.level.ChunkHolder;
4+
import net.minecraft.server.level.ChunkResult;
65
import net.minecraft.server.level.ServerLevel;
76
import net.minecraft.util.thread.BlockableEventLoop;
87
import net.minecraft.world.level.ChunkPos;
98
import net.minecraft.world.level.chunk.ChunkAccess;
109

1110
public interface ChunkHolderInterface
1211
{
13-
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> setDefaultProtoChunk(ChunkPos chpos, BlockableEventLoop<Runnable> executor, ServerLevel world);
12+
//CompletableFuture<ChunkResult<ChunkAccess>> setDefaultProtoChunk(ChunkPos chpos, BlockableEventLoop<Runnable> executor, ServerLevel world);
1413
}

0 commit comments

Comments
 (0)