Skip to content

Commit d7d0a5e

Browse files
committed
Update to 1.20.5
1 parent 96f5efd commit d7d0a5e

34 files changed

+292
-664
lines changed

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id "maven-publish"
3-
id "fabric-loom" version "1.5-SNAPSHOT"
4-
id 'me.modmuss50.mod-publish-plugin' version '0.3.4'
3+
id "fabric-loom" version "1.6-SNAPSHOT"
4+
id 'me.modmuss50.mod-publish-plugin' version '0.5.1'
55
}
66

77
repositories {
@@ -18,7 +18,7 @@ repositories {
1818
}
1919
}
2020

21-
version = minecraft_version + "-" + mod_version
21+
version = "${mod_version}+mc${minecraft_version}"
2222
group = maven_group
2323

2424
dependencies {
@@ -27,8 +27,8 @@ dependencies {
2727
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
2828
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
2929

30-
modImplementation "com.github.gnembon:fabric-carpet:${carpet_version}"
31-
modImplementation("com.github.CaffeineMC:lithium-fabric:mc1.20.4-0.12.1") {
30+
modImplementation "com.github.senseiwells:fabric-carpet:${carpet_version}"
31+
modImplementation("com.github.CaffeineMC:lithium-fabric:${lithium_version}") {
3232
exclude group: 'com.github.2No2Name', module: 'McTester'
3333
}
3434
include modImplementation("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")
@@ -40,7 +40,7 @@ processResources {
4040
filesMatching("fabric.mod.json") {
4141
def map = [
4242
"version" : mod_version,
43-
"carpet_dependency" : ">=" + carpet_version,
43+
// "carpet_dependency" : ">=" + carpet_version,
4444
"minecraft_dependency": minecraft_dependency
4545
]
4646
expand map

gradle.properties

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Done to increase the memory available to gradle.
22
org.gradle.jvmargs=-Xmx6G
33
# Fabric Properties
4-
minecraft_version=1.20.4
5-
yarn_mappings=1.20.4+build.1
6-
loader_version=0.15.0
4+
minecraft_version=1.20.5
5+
yarn_mappings=1.20.5+build.1
6+
loader_version=0.15.10
77
# Mod Properties
8-
mod_version = 1.3.4
8+
mod_version = 1.4.0
99
maven_group = essentialaddons
1010
# Dependencies
11-
carpet_version=1.4.128
12-
fabric_version=0.91.1+1.20.4
13-
mixin_extras_version=0.2.0
11+
carpet_version=8639fa9d957bc41d205280017ffe325093c924ad
12+
lithium_version=98a10fbeeaf72a1b1162f5fe6ec8315df3e9caa5
13+
fabric_version=0.97.6+1.20.5
1414
minecraft_dependency=1.20.x
15+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/essentialaddons/EssentialAddons.java

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

33
import carpet.CarpetExtension;
44
import carpet.CarpetServer;
5-
import carpet.script.CarpetExpression;
65
import com.mojang.brigadier.CommandDispatcher;
76
import essentialaddons.commands.*;
87
import essentialaddons.feature.GameRuleNetworkHandler;
98
import essentialaddons.feature.ReloadFakePlayers;
10-
import essentialaddons.feature.script.PacketEvent;
11-
import essentialaddons.feature.script.ScriptPacketHandler;
129
import essentialaddons.logging.EssentialAddonsLoggerRegistry;
1310
import essentialaddons.utils.*;
14-
import essentialaddons.utils.network.NetworkHandler;
1511
import net.fabricmc.api.ModInitializer;
1612
import net.minecraft.command.CommandRegistryAccess;
1713
import net.minecraft.server.MinecraftServer;
@@ -26,7 +22,6 @@
2622
public class EssentialAddons implements CarpetExtension, ModInitializer {
2723
public static final Logger LOGGER;
2824
public static final Set<Config> CONFIG_SET;
29-
public static final Set<NetworkHandler> NETWORK_HANDLERS;
3025
public static MinecraftServer server;
3126

3227
static {
@@ -37,16 +32,14 @@ public class EssentialAddons implements CarpetExtension, ModInitializer {
3732
ConfigFakePlayerData.INSTANCE,
3833
ConfigTeamTeleportBlacklist.INSTANCE
3934
);
40-
NETWORK_HANDLERS = Set.of(
41-
GameRuleNetworkHandler.INSTANCE,
42-
ScriptPacketHandler.INSTANCE
43-
);
4435
}
4536

4637
@Override
4738
public void onInitialize() {
4839
CarpetServer.manageExtension(this);
4940
ConfigCamera.INSTANCE.readConfig();
41+
42+
GameRuleNetworkHandler.INSTANCE.registerGameRulePayloads();
5043
}
5144

5245
@Override
@@ -64,11 +57,6 @@ public void registerLoggers() {
6457
EssentialAddonsLoggerRegistry.registerLoggers();
6558
}
6659

67-
@Override
68-
public void scarpetApi(CarpetExpression expression) {
69-
ScriptPacketHandler.INSTANCE.addScarpetExpression(expression.getExpr());
70-
}
71-
7260
@Override
7361
public void onServerLoaded(MinecraftServer server) {
7462
EssentialAddons.server = server;
@@ -82,7 +70,6 @@ public void onServerLoadedWorlds(MinecraftServer server) {
8270
if (EssentialSettings.reloadFakePlayers) {
8371
ReloadFakePlayers.loadFakePlayers(server);
8472
}
85-
PacketEvent.noop();
8673
}
8774

8875
@Override
@@ -93,7 +80,7 @@ public void onServerClosed(MinecraftServer server) {
9380
}
9481

9582
@Override
96-
public void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess commandBuildContext) {
83+
public void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess access) {
9784
CommandFly.register(dispatcher);
9885
CommandHat.register(dispatcher);
9986
CommandRepair.register(dispatcher);
@@ -117,7 +104,7 @@ public void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher,
117104
CommandTop.register(dispatcher);
118105
CommandNear.register(dispatcher);
119106
CommandLagSpike.register(dispatcher);
120-
CommandRename.register(dispatcher);
107+
CommandRename.register(dispatcher, access);
121108
CommandMods.register(dispatcher);
122109
CommandGhostPlayer.register(dispatcher);
123110
CommandConfig.register(dispatcher);
@@ -126,7 +113,7 @@ public void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher,
126113

127114
@Override
128115
public void onPlayerLoggedIn(ServerPlayerEntity player) {
129-
NETWORK_HANDLERS.forEach(networkHandler -> networkHandler.sayHello(player));
116+
GameRuleNetworkHandler.INSTANCE.sayHello(player);
130117
}
131118

132119
@Override

src/main/java/essentialaddons/EssentialUtils.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package essentialaddons;
22

3-
import carpet.helpers.InventoryHelper;
43
import com.google.gson.Gson;
54
import com.google.gson.reflect.TypeToken;
65
import essentialaddons.utils.Subscription;
76
import me.lucko.fabric.api.permissions.v0.Permissions;
87
import net.fabricmc.api.EnvType;
98
import net.fabricmc.loader.api.FabricLoader;
10-
import net.minecraft.block.BlockState;
119
import net.minecraft.block.ShulkerBoxBlock;
12-
import net.minecraft.block.entity.BlockEntity;
1310
import net.minecraft.entity.Entity;
1411
import net.minecraft.entity.EntityType;
1512
import net.minecraft.entity.damage.DamageSource;
@@ -28,7 +25,6 @@
2825
import net.minecraft.text.Text;
2926
import net.minecraft.util.ItemScatterer;
3027
import net.minecraft.util.WorldSavePath;
31-
import net.minecraft.util.math.BlockPos;
3228
import net.minecraft.world.GameRules;
3329
import net.minecraft.world.World;
3430
import org.apache.commons.io.IOUtils;
@@ -44,8 +40,6 @@
4440

4541
import static carpet.utils.CommandHelper.canUseCommand;
4642
import static essentialaddons.EssentialAddons.server;
47-
import static net.minecraft.block.Block.dropStack;
48-
import static net.minecraft.block.Block.getDroppedStacks;
4943

5044
public class EssentialUtils {
5145
public static final Random RANDOM = new Random();
@@ -93,24 +87,9 @@ public static void breakVehicleStorage(
9387
}
9488
}
9589

96-
public static void placeItemInInventory(BlockState state, World world, BlockPos pos, BlockEntity blockEntity, ServerPlayerEntity player, ItemStack stack){
97-
if (world instanceof ServerWorld serverWorld) {
98-
getDroppedStacks(state, serverWorld, pos, blockEntity, player, stack).forEach((itemStack) -> {
99-
if (!placeItemInInventory(player, itemStack)) {
100-
dropStack(serverWorld, pos, itemStack);
101-
}
102-
});
103-
state.onStacksDropped(serverWorld, pos, stack, true);
104-
}
105-
}
106-
10790
public static boolean placeItemInInventory(ServerPlayerEntity player, ItemStack itemStack) {
10891
Item item = itemStack.getItem();
10992
int itemAmount = itemStack.getCount();
110-
if (EssentialSettings.stackableShulkersInPlayerInventories && !InventoryHelper.shulkerBoxHasItems(itemStack) && isItemShulkerBox(itemStack.getItem())) {
111-
itemStack.removeSubNbt("BlockEntityTag");
112-
item = itemStack.getItem();
113-
}
11493
if (player.getInventory().insertStack(itemStack)) {
11594
player.getWorld().playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2f, (RANDOM.nextFloat() - RANDOM.nextFloat()) * 1.4F + 2.0F);
11695
player.increaseStat(Stats.PICKED_UP.getOrCreateStat(item), itemAmount);

src/main/java/essentialaddons/commands/CommandCameraMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private static boolean isInDanger(ServerPlayerEntity player) {
7070
}
7171

7272
for (StatusEffectInstance effect : player.getStatusEffects()) {
73-
if (effect.getEffectType().getCategory() == StatusEffectCategory.HARMFUL) {
73+
if (effect.getEffectType().value().getCategory() == StatusEffectCategory.HARMFUL) {
7474
EssentialUtils.sendToActionBar(player, "§cYou cannot enter spectator because you have a negative status effect");
7575
return true;
7676
}

src/main/java/essentialaddons/commands/CommandRename.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package essentialaddons.commands;
22

3+
import com.mojang.brigadier.Command;
34
import com.mojang.brigadier.CommandDispatcher;
45
import com.mojang.brigadier.arguments.StringArgumentType;
56
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
67
import essentialaddons.EssentialSettings;
78
import net.fabricmc.loader.api.FabricLoader;
9+
import net.minecraft.command.CommandRegistryAccess;
810
import net.minecraft.command.argument.TextArgumentType;
11+
import net.minecraft.component.DataComponentTypes;
912
import net.minecraft.item.ItemStack;
1013
import net.minecraft.server.command.ServerCommandSource;
1114
import net.minecraft.text.Text;
@@ -17,24 +20,24 @@
1720
public class CommandRename {
1821
private static final SimpleCommandExceptionType ITEM_IS_AIR = new SimpleCommandExceptionType(Text.literal("Cannot rename air!"));
1922

20-
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
23+
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess access) {
2124
// We let them handle /rename command
2225
if (FabricLoader.getInstance().isModLoaded("itemrename")) {
2326
return;
2427
}
2528

2629
dispatcher.register(literal("rename").requires(enabled(() -> EssentialSettings.commandRename, "essentialaddons.command.rename"))
2730
.then(literal("json")
28-
.then(argument("name", TextArgumentType.text())
31+
.then(argument("name", TextArgumentType.text(access))
2932
.executes(context -> {
3033
ItemStack stack = context.getSource().getPlayerOrThrow().getMainHandStack();
3134
if (!stack.isEmpty()) {
3235
Text text = TextArgumentType.getTextArgument(context, "name");
3336
context.getSource().sendFeedback(() -> {
3437
return Text.literal("Item name set to: ").append(text);
3538
}, false);
36-
stack.setCustomName(text);
37-
return 0;
39+
stack.set(DataComponentTypes.CUSTOM_NAME, text);
40+
return Command.SINGLE_SUCCESS;
3841
}
3942
throw ITEM_IS_AIR.create();
4043
})
@@ -49,8 +52,8 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
4952
context.getSource().sendFeedback(() -> {
5053
return Text.literal("Item name set to: ").append(name);
5154
}, false);
52-
itemStack.setCustomName(Text.literal(name).styled(s -> s.withItalic(false)));
53-
return 0;
55+
itemStack.set(DataComponentTypes.CUSTOM_NAME, Text.literal(name).styled(s -> s.withItalic(false)));
56+
return Command.SINGLE_SUCCESS;
5457
}
5558
throw ITEM_IS_AIR.create();
5659
})

0 commit comments

Comments
 (0)