Skip to content

Commit 38d3f9b

Browse files
committed
Ported project to 1.19.x
1 parent 800c232 commit 38d3f9b

23 files changed

+90
-83
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Sync (Fabric)
44
[![GitHub tag](https://img.shields.io/github/v/tag/Kir-Antipov/sync-fabric.svg?cacheSeconds=3600&sort=date)](https://github.com/Kir-Antipov/sync-fabric/releases/latest)
5-
[![GitHub build status](https://img.shields.io/github/workflow/status/Kir-Antipov/sync-fabric/build-artifacts/1.18.x/dev?cacheSeconds=3600)](https://github.com/Kir-Antipov/sync-fabric/actions/workflows/build-artifacts.yml)
5+
[![GitHub build status](https://img.shields.io/github/workflow/status/Kir-Antipov/sync-fabric/build-artifacts/1.19.x/dev?cacheSeconds=3600)](https://github.com/Kir-Antipov/sync-fabric/actions/workflows/build-artifacts.yml)
66
[![Modrinth](https://img.shields.io/badge/dynamic/json?color=5da545&label=Modrinth&query=title&url=https://api.modrinth.com/api/v1/mod/sync-fabric&style=flat&cacheSeconds=3600&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMSAxMSIgd2lkdGg9IjE0LjY2NyIgaGVpZ2h0PSIxNC42NjciICB4bWxuczp2PSJodHRwczovL3ZlY3RhLmlvL25hbm8iPjxkZWZzPjxjbGlwUGF0aCBpZD0iQSI+PHBhdGggZD0iTTAgMGgxMXYxMUgweiIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNBKSI+PHBhdGggZD0iTTEuMzA5IDcuODU3YTQuNjQgNC42NCAwIDAgMS0uNDYxLTEuMDYzSDBDLjU5MSA5LjIwNiAyLjc5NiAxMSA1LjQyMiAxMWMxLjk4MSAwIDMuNzIyLTEuMDIgNC43MTEtMi41NTZoMGwtLjc1LS4zNDVjLS44NTQgMS4yNjEtMi4zMSAyLjA5Mi0zLjk2MSAyLjA5MmE0Ljc4IDQuNzggMCAwIDEtMy4wMDUtMS4wNTVsMS44MDktMS40NzQuOTg0Ljg0NyAxLjkwNS0xLjAwM0w4LjE3NCA1LjgybC0uMzg0LS43ODYtMS4xMTYuNjM1LS41MTYuNjk0LS42MjYuMjM2LS44NzMtLjM4N2gwbC0uMjEzLS45MS4zNTUtLjU2Ljc4Ny0uMzcuODQ1LS45NTktLjcwMi0uNTEtMS44NzQuNzEzLTEuMzYyIDEuNjUxLjY0NSAxLjA5OC0xLjgzMSAxLjQ5MnptOS42MTQtMS40NEE1LjQ0IDUuNDQgMCAwIDAgMTEgNS41QzExIDIuNDY0IDguNTAxIDAgNS40MjIgMCAyLjc5NiAwIC41OTEgMS43OTQgMCA0LjIwNmguODQ4QzEuNDE5IDIuMjQ1IDMuMjUyLjgwOSA1LjQyMi44MDljMi42MjYgMCA0Ljc1OCAyLjEwMiA0Ljc1OCA0LjY5MSAwIC4xOS0uMDEyLjM3Ni0uMDM0LjU2bC43NzcuMzU3aDB6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiM1ZGE0MjYiLz48L2c+PC9zdmc+)](https://modrinth.com/mod/sync-fabric)
77
[![CurseForge](https://img.shields.io/badge/dynamic/json?color=%23f16436&label=CurseForge&query=title&url=https%3A%2F%2Fapi.cfwidget.com%2F515365&cacheSeconds=3600)](https://www.curseforge.com/minecraft/mc-mods/sync-fabric)
88
[![GitHub license](https://img.shields.io/github/license/Kir-Antipov/sync-fabric.svg?cacheSeconds=36000)](https://github.com/Kir-Antipov/sync-fabric#readme)
@@ -166,9 +166,9 @@ You can help translate the mod to additional languages here: [crowdin.com](https
166166
## Installation
167167

168168
Requirements:
169-
- Minecraft `1.18.x`
170-
- Fabric Loader `>=0.12.0`
171-
- Fabric API `>=0.43.1`
169+
- Minecraft `1.19.x`
170+
- Fabric Loader `>=0.14.0`
171+
- Fabric API `>=0.55.1`
172172

173173
You can download the mod from:
174174

@@ -208,7 +208,7 @@ There's [no documentation](https://www.commitstrip.com/en/2021/11/10/no-document
208208
## Building from sources
209209

210210
Requirements:
211-
- JDK `16`
211+
- JDK `17`
212212

213213
### Linux/MacOS
214214

build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ buildscript {
1111
}
1212

1313
plugins {
14-
id "fabric-loom" version "0.11-SNAPSHOT"
14+
id "fabric-loom" version "0.12-SNAPSHOT"
1515
id "org.ajoberstar.grgit" version "4.1.0"
1616
}
1717

@@ -102,8 +102,9 @@ dependencies {
102102
modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}"
103103
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
104104
modImplementation "dev.emi:trinkets:${project.trinkets_version}"
105-
modImplementation "io.github.ladysnake:requiem-api:${project.requiem_version}"
106-
modImplementation "com.github.apace100:origins-fabric:${project.origins_version}"
105+
modCompileOnly("io.github.ladysnake:requiem-api:${project.requiem_version}", { transitive false })
106+
modImplementation "maven.modrinth:origins:${project.origins_version}"
107+
modImplementation "com.github.apace100:apoli:${project.apoli_version}"
107108
modCompileOnly "maven.modrinth:haema:${project.haema_version}"
108109
}
109110

gradle.properties

+13-12
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/versions.html
6-
minecraft_version=1.18.2
7-
yarn_mappings=1.18.2+build.3
8-
loader_version=0.12.2
6+
minecraft_version=1.19
7+
yarn_mappings=1.19+build.1
8+
loader_version=0.14.7
99

1010
# Mod Properties
1111
mod_version=4.0
1212
maven_group=dev.kir
1313
archives_base_name=sync
1414

1515
# Dependencies
16-
fabric_version=0.47.8+1.18.2
16+
fabric_version=0.55.2+1.19
1717
tr_energy_version=2.2.0
18-
satin_version=1.7.2
19-
cloth_version=6.2.57
20-
modmenu_version=3.1.1
21-
trinkets_version=3.3.0
22-
requiem_version=2.0.0-beta.7
23-
origins_version=1.4.1
18+
satin_version=1.8.0
19+
cloth_version=7.0.65
20+
modmenu_version=4.0.0
21+
trinkets_version=3.4.0
22+
requiem_version=2.0.0-beta.8
23+
origins_version=1.6.1
24+
apoli_version=2.5.0
2425
haema_version=1.9.9+1.18.2
25-
smartrecipes_version=0.2.1+1.18.2
26-
crowdin_translate_version=1.4+1.18.2
26+
smartrecipes_version=0.2.1+1.19
27+
crowdin_translate_version=1.4+1.19-pre2

src/main/java/dev/kir/sync/api/event/PlayerSyncEvents.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import net.fabricmc.fabric.api.event.EventFactory;
77
import net.minecraft.entity.player.PlayerEntity;
88
import net.minecraft.text.Text;
9-
import net.minecraft.text.TranslatableText;
109
import net.minecraft.util.math.BlockPos;
1110
import org.jetbrains.annotations.Nullable;
1211

@@ -102,9 +101,9 @@ public final class PlayerSyncEvents {
102101
@FunctionalInterface
103102
public interface SyncFailureReason {
104103
SyncFailureReason OTHER_PROBLEM = () -> null;
105-
SyncFailureReason INVALID_SHELL = create(new TranslatableText("event.sync.request.fail.invalid.shell"));
106-
SyncFailureReason INVALID_CURRENT_LOCATION = create(new TranslatableText("event.sync.request.fail.invalid.location.current"));
107-
SyncFailureReason INVALID_TARGET_LOCATION = create(new TranslatableText("event.sync.request.fail.invalid.location.target"));
104+
SyncFailureReason INVALID_SHELL = create(Text.translatable("event.sync.request.fail.invalid.shell"));
105+
SyncFailureReason INVALID_CURRENT_LOCATION = create(Text.translatable("event.sync.request.fail.invalid.location.current"));
106+
SyncFailureReason INVALID_TARGET_LOCATION = create(Text.translatable("event.sync.request.fail.invalid.location.target"));
108107

109108
@Nullable
110109
Text toText();
@@ -117,8 +116,8 @@ static SyncFailureReason create(@Nullable Text description) {
117116
@FunctionalInterface
118117
public interface ShellConstructionFailureReason {
119118
ShellConstructionFailureReason OTHER_PROBLEM = () -> null;
120-
ShellConstructionFailureReason OCCUPIED = create(new TranslatableText("event.sync.construction.fail.occupied"));
121-
ShellConstructionFailureReason NOT_ENOUGH_HEALTH = create(new TranslatableText("event.sync.construction.fail.health"));
119+
ShellConstructionFailureReason OCCUPIED = create(Text.translatable("event.sync.construction.fail.occupied"));
120+
ShellConstructionFailureReason NOT_ENOUGH_HEALTH = create(Text.translatable("event.sync.construction.fail.health"));
122121

123122
@Nullable
124123
Text toText();

src/main/java/dev/kir/sync/api/shell/ShellState.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private static ShellState create(ServerPlayerEntity player, BlockPos pos, DyeCol
220220
shell.isArtificial = isArtificial;
221221

222222
shell.ownerUuid = player.getUuid();
223-
shell.ownerName = player.getName().asString();
223+
shell.ownerName = player.getName().getString();
224224
shell.gameMode = player.interactionManager.getGameMode().getId();
225225
shell.inventory = new SimpleInventory();
226226
shell.component = ShellStateComponent.empty();

src/main/java/dev/kir/sync/block/ShellStorageBlock.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
import net.minecraft.state.property.BooleanProperty;
1212
import net.minecraft.state.property.Properties;
1313
import net.minecraft.util.math.BlockPos;
14+
import net.minecraft.util.math.random.Random;
1415
import net.minecraft.world.World;
1516

16-
import java.util.Random;
17-
1817
@SuppressWarnings("deprecation")
1918
public class ShellStorageBlock extends AbstractShellContainerBlock {
2019
public static final BooleanProperty ENABLED = Properties.ENABLED;

src/main/java/dev/kir/sync/block/TreadmillBlock.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
import net.minecraft.util.StringIdentifiable;
2222
import net.minecraft.util.math.BlockPos;
2323
import net.minecraft.util.math.Direction;
24+
import net.minecraft.util.math.random.Random;
2425
import net.minecraft.util.shape.VoxelShape;
2526
import net.minecraft.util.shape.VoxelShapes;
2627
import net.minecraft.world.BlockView;
2728
import net.minecraft.world.World;
2829
import net.minecraft.world.WorldAccess;
2930
import org.jetbrains.annotations.Nullable;
3031

31-
import java.util.Random;
32-
3332
@SuppressWarnings("deprecation")
3433
public class TreadmillBlock extends HorizontalFacingBlock implements BlockEntityProvider {
3534
public static final EnumProperty<Part> PART = EnumProperty.of("treadmill_part", Part.class);

src/main/java/dev/kir/sync/block/entity/AbstractShellContainerBlockEntity.java

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public AbstractShellContainerBlockEntity(BlockEntityType<?> type, BlockPos pos,
6363
@Override
6464
public void setShellState(ShellState shell) {
6565
this.shell = shell;
66+
if (this.world != null && !this.world.isClient && this.pos != null && this.getCachedState() != null) {
67+
this.checkShellState(this.world, this.pos, this.getCachedState());
68+
}
6669
}
6770

6871
@Override
@@ -97,6 +100,10 @@ protected Optional<AbstractShellContainerBlockEntity> getBottomPart() {
97100

98101
@Override
99102
public void onServerTick(World world, BlockPos pos, BlockState state) {
103+
this.checkShellState(world, pos, state);
104+
}
105+
106+
private void checkShellState(World world, BlockPos pos, BlockState state) {
100107
if (this.shell != null && this.shell.getColor() != this.color) {
101108
this.shell.setColor(this.color);
102109
}

src/main/java/dev/kir/sync/client/gui/ShellSelectorGUI.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import net.minecraft.client.network.ClientPlayerEntity;
2121
import net.minecraft.client.util.math.MatrixStack;
2222
import net.minecraft.text.Text;
23-
import net.minecraft.text.TranslatableText;
2423
import net.minecraft.util.DyeColor;
2524
import net.minecraft.util.Identifier;
2625

@@ -34,8 +33,8 @@ public class ShellSelectorGUI extends Screen {
3433
private static final int MAX_SLOTS = 8;
3534
private static final double MENU_RADIUS = 0.3F;
3635
private static final int BACKGROUND_COLOR = ColorUtil.fromDyeColor(DyeColor.BLACK, 0.3F);
37-
private static final Text TITLE = new TranslatableText("gui.sync.default.cross_button.title");
38-
private static final Collection<Text> ARROW_TITLES = List.of(new TranslatableText("gui.sync.shell_selector.up.title"), new TranslatableText("gui.sync.shell_selector.right.title"), new TranslatableText("gui.sync.shell_selector.down.title"), new TranslatableText("gui.sync.shell_selector.left.title"));
36+
private static final Text TITLE = Text.translatable("gui.sync.default.cross_button.title");
37+
private static final Collection<Text> ARROW_TITLES = List.of(Text.translatable("gui.sync.shell_selector.up.title"), Text.translatable("gui.sync.shell_selector.right.title"), Text.translatable("gui.sync.shell_selector.down.title"), Text.translatable("gui.sync.shell_selector.left.title"));
3938

4039
private final Runnable onCloseCallback;
4140
private final Runnable onRemovedCallback;

src/main/java/dev/kir/sync/client/gui/widget/CrossButtonWidget.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
import net.fabricmc.api.Environment;
99
import net.minecraft.client.util.math.MatrixStack;
1010
import net.minecraft.text.Text;
11-
import net.minecraft.text.TranslatableText;
1211
import net.minecraft.util.DyeColor;
1312
import net.minecraft.util.math.MathHelper;
1413

1514
@Environment(EnvType.CLIENT)
1615
public class CrossButtonWidget extends AbstractButtonWidget {
17-
private static final Text DEFAULT_DESCRIPTION = new TranslatableText("gui.sync.default.cross_button.title");
16+
private static final Text DEFAULT_DESCRIPTION = Text.translatable("gui.sync.default.cross_button.title");
1817
private static final int DEFAULT_COLOR = ColorUtil.fromDyeColor(DyeColor.WHITE);
1918
private static final float DEFAULT_STEP = Radians.R_PI_32;
2019

src/main/java/dev/kir/sync/client/render/CustomGameRenderer.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.minecraft.client.render.BufferBuilderStorage;
1212
import net.minecraft.client.render.GameRenderer;
1313
import net.minecraft.client.render.VertexFormats;
14+
import net.minecraft.client.render.item.HeldItemRenderer;
1415
import net.minecraft.resource.ResourceManager;
1516
import net.minecraft.util.math.Matrix4f;
1617

@@ -22,8 +23,8 @@ public final class CustomGameRenderer extends GameRenderer {
2223

2324
private static final ManagedCoreShader RENDER_TYPE_VOXEL_SHADER;
2425

25-
private CustomGameRenderer(MinecraftClient client, ResourceManager resourceManager, BufferBuilderStorage buffers) {
26-
super(client, resourceManager, buffers);
26+
private CustomGameRenderer(MinecraftClient client, HeldItemRenderer heldItemRenderer, ResourceManager resourceManager, BufferBuilderStorage buffers) {
27+
super(client, heldItemRenderer, resourceManager, buffers);
2728
}
2829

2930
public static void initRenderTypeEntityTranslucentPartiallyTexturedShader(float cutoutY, Matrix4f modelMatrix) {

src/main/java/dev/kir/sync/command/GhostShellsCommand.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import net.minecraft.server.network.ServerPlayerEntity;
1919
import net.minecraft.server.world.ServerWorld;
2020
import net.minecraft.text.Text;
21-
import net.minecraft.text.TranslatableText;
2221
import net.minecraft.util.math.BlockPos;
2322
import net.minecraft.world.chunk.Chunk;
2423

@@ -28,7 +27,7 @@
2827
import java.util.function.Consumer;
2928

3029
public class GhostShellsCommand implements Command {
31-
private static final SimpleCommandExceptionType INVALID_ACTION_TYPE = new SimpleCommandExceptionType(new TranslatableText("command.sync.ghostshells.invalid_action"));
30+
private static final SimpleCommandExceptionType INVALID_ACTION_TYPE = new SimpleCommandExceptionType(Text.translatable("command.sync.ghostshells.invalid_action"));
3231

3332
@Override
3433
public String getName() {
@@ -93,7 +92,7 @@ private static int execute(CommandContext<ServerCommandSource> context) throws C
9392
for (ServerPlayerEntity player : players) {
9493
ShellState shellState = ((Shell)player).getAvailableShellStates().filter(x -> x.getPos().equals(finalPos)).findAny().orElse(null);
9594
if (shellState == null) {
96-
logger.accept(new TranslatableText("command.sync.ghostshells.not_found", player.getName().asString(), pos.toShortString()));
95+
logger.accept(Text.translatable("command.sync.ghostshells.not_found", player.getName().getString(), pos.toShortString()));
9796
} else {
9897
updateShell(player, shellState, repair, canSkip, logger);
9998
}
@@ -115,18 +114,18 @@ private static void updateShell(ServerPlayerEntity player, ShellState shellState
115114

116115
if (shouldRepair) {
117116
if (tryRepair(player.server, shellState)) {
118-
logger.accept(new TranslatableText("command.sync.ghostshells.repaired", player.getName().asString(), shellState.getPos().toShortString()));
117+
logger.accept(Text.translatable("command.sync.ghostshells.repaired", player.getName().getString(), shellState.getPos().toShortString()));
119118
return;
120119
}
121120

122121
if (!skipOnFailure) {
123-
logger.accept(new TranslatableText("command.sync.ghostshells.failed", player.getName().asString(), shellState.getPos().toShortString()));
122+
logger.accept(Text.translatable("command.sync.ghostshells.failed", player.getName().getString(), shellState.getPos().toShortString()));
124123
return;
125124
}
126125
}
127126

128127
((Shell)player).remove(shellState);
129-
logger.accept(new TranslatableText("command.sync.ghostshells.removed", player.getName().asString(), shellState.getPos().toShortString()));
128+
logger.accept(Text.translatable("command.sync.ghostshells.removed", player.getName().getString(), shellState.getPos().toShortString()));
130129
}
131130

132131
private static boolean shellExists(MinecraftServer server, ShellState shellState) {

src/main/java/dev/kir/sync/compat/origins/OriginsShellStateComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void clone(ShellStateComponent component) {
8383
originComponent.sync();
8484
} else {
8585
for (OriginLayer layer : OriginLayers.getLayers()) {
86-
if(layer.isEnabled()) {
86+
if (layer.isEnabled()) {
8787
originComponent.setOrigin(layer, Origin.EMPTY);
8888
}
8989
}

src/main/java/dev/kir/sync/compat/requiem/RequiemCompat.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import net.fabricmc.loader.api.FabricLoader;
88
import net.minecraft.entity.player.PlayerEntity;
99
import net.minecraft.text.Text;
10-
import net.minecraft.text.TranslatableText;
1110

1211
public class RequiemCompat implements ModInitializer {
1312
@Override
@@ -16,7 +15,7 @@ public void onInitialize() {
1615
return;
1716
}
1817

19-
final Text PLAYER_IS_UNDEAD = new TranslatableText("event.sync.any.fail.undead");
18+
final Text PLAYER_IS_UNDEAD = Text.translatable("event.sync.any.fail.undead");
2019
PlayerSyncEvents.ALLOW_SHELL_CONSTRUCTION.register((player, __) -> isUndead(player) ? () -> PLAYER_IS_UNDEAD : null);
2120
PlayerSyncEvents.ALLOW_SHELL_SELECTION.register((player, __) -> isUndead(player) ? () -> PLAYER_IS_UNDEAD : null);
2221
PlayerSyncEvents.ALLOW_SYNCING.register((player, __) -> isUndead(player) ? () -> PLAYER_IS_UNDEAD : null);

src/main/java/dev/kir/sync/compat/trinkets/TrinketsCompat.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import net.fabricmc.api.EnvType;
99
import net.fabricmc.loader.api.FabricLoader;
1010
import net.minecraft.entity.EntityType;
11+
import org.jetbrains.annotations.NotNull;
1112

1213
public class TrinketsCompat implements EntityComponentInitializer {
1314
@Override
14-
public void registerEntityComponentFactories(EntityComponentFactoryRegistry registry) {
15+
public void registerEntityComponentFactories(@NotNull EntityComponentFactoryRegistry registry) {
1516
if (!FabricLoader.getInstance().isModLoaded("trinkets")) {
1617
return;
1718
}

src/main/java/dev/kir/sync/entity/PersistentCameraEntityGoal.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
import net.fabricmc.api.EnvType;
44
import net.fabricmc.api.Environment;
5-
import net.minecraft.util.math.*;
6-
import net.minecraft.world.dimension.DimensionType;
5+
import net.minecraft.util.math.BlockPos;
6+
import net.minecraft.util.math.Direction;
7+
import net.minecraft.util.math.Vec3d;
78

89
import java.util.function.Consumer;
910

1011
@Environment(EnvType.CLIENT)
1112
public class PersistentCameraEntityGoal {
1213
public static final double MAX_DISTANCE = 25;
1314
public static final long PHASE_DELAY = 200;
14-
public static final double MAX_Y = DimensionType.OVERWORLD.getHeight() * 1.01;
15+
public static final double MAX_Y = 320;
1516
public static final long MIN_PHASE_DURATION = 400;
1617
public static final long MAX_PHASE_DURATION = 2500;
1718

0 commit comments

Comments
 (0)