Skip to content

Commit 63bb893

Browse files
committed
Switch project to Mojmap using Ravel
1 parent 20a404f commit 63bb893

175 files changed

Lines changed: 1442 additions & 1442 deletions

File tree

Some content is hidden

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

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/Component.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.nbt.NbtCompound;
26-
import net.minecraft.storage.ReadView;
27-
import net.minecraft.storage.WriteView;
25+
import net.minecraft.nbt.CompoundTag;
26+
import net.minecraft.world.level.storage.ValueInput;
27+
import net.minecraft.world.level.storage.ValueOutput;
2828
import org.jetbrains.annotations.Contract;
2929

3030
/**
@@ -35,21 +35,21 @@
3535
public interface Component {
3636

3737
/**
38-
* Reads this component's properties from a {@link NbtCompound}.
38+
* Reads this component's properties from a {@link CompoundTag}.
3939
*
4040
* @param readView a {@code NbtCompound} on which this component's serializable data has been written
4141
* @implNote implementations should not assert that the data written on the tag corresponds to any
4242
* specific scheme, as saved data is susceptible to external tempering, and may come from an earlier
4343
* version.
4444
*/
4545
@Contract(mutates = "this")
46-
void readData(ReadView readView);
46+
void readData(ValueInput readView);
4747

4848
/**
49-
* Writes this component's properties to a {@link NbtCompound}.
49+
* Writes this component's properties to a {@link CompoundTag}.
5050
*
5151
* @param writeView a {@code NbtCompound} on which to write this component's serializable data
5252
*/
5353
@Contract(mutates = "param1")
54-
void writeData(WriteView writeView);
54+
void writeData(ValueOutput writeView);
5555
}

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentContainer.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
package org.ladysnake.cca.api.v3.component;
2424

2525
import net.fabricmc.api.EnvType;
26-
import net.minecraft.nbt.NbtCompound;
27-
import net.minecraft.registry.RegistryWrapper;
28-
import net.minecraft.storage.ReadView;
29-
import net.minecraft.storage.WriteView;
26+
import net.minecraft.nbt.CompoundTag;
27+
import net.minecraft.core.HolderLookup;
28+
import net.minecraft.world.level.storage.ValueInput;
29+
import net.minecraft.world.level.storage.ValueOutput;
3030
import org.jetbrains.annotations.ApiStatus;
3131
import org.jetbrains.annotations.Contract;
3232
import org.jetbrains.annotations.Nullable;
@@ -63,7 +63,7 @@ public interface ComponentContainer extends NbtSerializable {
6363
boolean hasComponents();
6464

6565
@Contract(mutates = "this")
66-
void copyFrom(ComponentContainer other, RegistryWrapper.WrapperLookup registryLookup);
66+
void copyFrom(ComponentContainer other, HolderLookup.Provider registryLookup);
6767

6868
@AsmGeneratedCallback(ServerTickingComponent.class)
6969
void tickServerComponents();
@@ -111,7 +111,7 @@ default ComponentKey<?> getKey(Component component) {
111111
}
112112

113113
/**
114-
* Reads this object's properties from a {@link NbtCompound}.
114+
* Reads this object's properties from a {@link CompoundTag}.
115115
*
116116
* @param readView a {@code NbtCompound} on which this object's serializable data has been written
117117
* @implNote implementations must not assert that the data written on the tag corresponds to any
@@ -120,23 +120,23 @@ default ComponentKey<?> getKey(Component component) {
120120
* information may be stored in said tag.
121121
*/
122122
@Contract(mutates = "this")
123-
void readData(ReadView readView);
123+
void readData(ValueInput readView);
124124

125125
@Contract(mutates = "this")
126-
void readOrphanData(ReadView readView);
126+
void readOrphanData(ValueInput readView);
127127

128128
/**
129-
* Writes this object's properties to a {@link NbtCompound}.
129+
* Writes this object's properties to a {@link CompoundTag}.
130130
*
131131
* @param writeView a {@code NbtCompound} on which to write this component's serializable data
132132
*/
133133
@Contract(mutates = "param1")
134-
void writeData(WriteView writeView);
134+
void writeData(ValueOutput writeView);
135135

136136
@Contract(mutates = "param1")
137-
void writeOrphanData(WriteView writeView);
137+
void writeOrphanData(ValueOutput writeView);
138138

139-
@Nullable NbtCompound toOrphanTag(RegistryWrapper.WrapperLookup registryLookup);
139+
@Nullable CompoundTag toOrphanTag(HolderLookup.Provider registryLookup);
140140

141141
/**
142142
* A factory for {@link ComponentContainer}s.

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentKey.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
import io.netty.buffer.Unpooled;
2626
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
2727
import net.fabricmc.loader.api.FabricLoader;
28-
import net.minecraft.network.PacketCallbacks;
29-
import net.minecraft.network.RegistryByteBuf;
30-
import net.minecraft.network.packet.CustomPayload;
31-
import net.minecraft.server.network.ServerPlayerEntity;
32-
import net.minecraft.text.Text;
33-
import net.minecraft.util.Identifier;
28+
import net.minecraft.network.PacketSendListener;
29+
import net.minecraft.network.RegistryFriendlyByteBuf;
30+
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
31+
import net.minecraft.server.level.ServerPlayer;
32+
import net.minecraft.network.chat.Component;
33+
import net.minecraft.resources.Identifier;
3434
import org.jetbrains.annotations.ApiStatus;
3535
import org.jetbrains.annotations.Contract;
3636
import org.jetbrains.annotations.Nullable;
@@ -174,7 +174,7 @@ public void sync(Object provider, ComponentPacketWriter packetWriter) {
174174
* @see ComponentAccess#syncComponent(ComponentKey, ComponentPacketWriter, PlayerSyncPredicate)
175175
*/
176176
public void sync(Object provider, ComponentPacketWriter packetWriter, PlayerSyncPredicate predicate) {
177-
for (ServerPlayerEntity player : ((ComponentProvider) provider).getRecipientsForComponentSync()) {
177+
for (ServerPlayer player : ((ComponentProvider) provider).getRecipientsForComponentSync()) {
178178
this.syncWith(player, (ComponentProvider) provider, packetWriter, predicate);
179179
}
180180
}
@@ -191,28 +191,28 @@ public void sync(Object provider, ComponentPacketWriter packetWriter, PlayerSync
191191
* @throws ClassCastException if <code>provider</code> does not implement {@link ComponentProvider}
192192
*/
193193
@ApiStatus.Experimental
194-
public void syncWith(ServerPlayerEntity player, ComponentProvider provider) {
194+
public void syncWith(ServerPlayer player, ComponentProvider provider) {
195195
if (this.get(provider) instanceof AutoSyncedComponent synced) {
196196
this.syncWith(player, provider, synced, synced);
197197
}
198198
}
199199

200200
@ApiStatus.Experimental
201-
public void syncWith(ServerPlayerEntity player, ComponentProvider provider, ComponentPacketWriter writer, PlayerSyncPredicate predicate) {
201+
public void syncWith(ServerPlayer player, ComponentProvider provider, ComponentPacketWriter writer, PlayerSyncPredicate predicate) {
202202
if (predicate.shouldSyncWith(player)) {
203-
RegistryByteBuf buf = new RegistryByteBuf(Unpooled.buffer(), player.getEntityWorld().getRegistryManager());
203+
RegistryFriendlyByteBuf buf = new RegistryFriendlyByteBuf(Unpooled.buffer(), player.level().registryAccess());
204204
writer.writeSyncPacket(buf, player);
205-
CustomPayload payload = provider.toComponentPacket(this, predicate.isRequiredOnClient(), buf);
205+
CustomPacketPayload payload = provider.toComponentPacket(this, predicate.isRequiredOnClient(), buf);
206206

207207
if (payload != null) {
208-
if (ServerPlayNetworking.canSend(player, payload.getId())) {
209-
ServerPlayNetworking.getSender(player).sendPacket(payload, PacketCallbacks.always(buf::release));
208+
if (ServerPlayNetworking.canSend(player, payload.type())) {
209+
ServerPlayNetworking.getSender(player).sendPacket(payload, PacketSendListener.thenRun(buf::release));
210210
} else {
211211
if (predicate.isRequiredOnClient()) {
212212
String specificMod = FabricLoader.getInstance().getModContainer(this.id.getNamespace()).map(c -> c.getMetadata().getName() + " and ").orElse("");
213-
player.networkHandler.disconnect(Text.literal(
213+
player.connection.disconnect(Component.literal(
214214
"This server requires " + specificMod + "Cardinal Components API " +
215-
"(unhandled packet: " + payload.getId().id() + ")" +
215+
"(unhandled packet: " + payload.type().id() + ")" +
216216
ComponentsInternals.getClientOptionalModAdvice()));
217217
}
218218
buf.release();

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentProvider.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
package org.ladysnake.cca.api.v3.component;
2424

2525
import io.netty.buffer.ByteBuf;
26-
import net.minecraft.network.RegistryByteBuf;
27-
import net.minecraft.network.packet.CustomPayload;
28-
import net.minecraft.server.network.ServerPlayerEntity;
26+
import net.minecraft.network.RegistryFriendlyByteBuf;
27+
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
28+
import net.minecraft.server.level.ServerPlayer;
2929
import org.jetbrains.annotations.Nullable;
3030
import org.ladysnake.cca.api.v3.component.sync.AutoSyncedComponent;
3131
import org.ladysnake.cca.api.v3.component.sync.PlayerSyncPredicate;
@@ -48,14 +48,14 @@ public interface ComponentProvider extends ComponentAccess {
4848
* Retrieves an iterator describing the list of players who may receive
4949
* component sync packets from this provider.
5050
*
51-
* <p>Individual components can {@linkplain PlayerSyncPredicate#shouldSyncWith(ServerPlayerEntity) filter
51+
* <p>Individual components can {@linkplain PlayerSyncPredicate#shouldSyncWith(ServerPlayer) filter
5252
* which players among the returned list should receive their packets};
5353
* this method does <em>not</em> take current components into account, so callers should perform
5454
* additional checks as needed.
5555
*
5656
* @return a list of player candidates for receiving component sync packets
5757
*/
58-
default Iterable<ServerPlayerEntity> getRecipientsForComponentSync() {
58+
default Iterable<ServerPlayer> getRecipientsForComponentSync() {
5959
return List.of();
6060
}
6161

@@ -71,7 +71,7 @@ default Iterable<ServerPlayerEntity> getRecipientsForComponentSync() {
7171
* @since 6.0.0
7272
*/
7373
@Nullable
74-
default <C extends AutoSyncedComponent> CustomPayload toComponentPacket(ComponentKey<? super C> key, boolean required, RegistryByteBuf data) {
74+
default <C extends AutoSyncedComponent> CustomPacketPayload toComponentPacket(ComponentKey<? super C> key, boolean required, RegistryFriendlyByteBuf data) {
7575
return null;
7676
}
7777
}

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.util.Identifier;
25+
import net.minecraft.resources.Identifier;
2626
import org.jetbrains.annotations.ApiStatus;
2727
import org.jetbrains.annotations.Contract;
2828
import org.ladysnake.cca.internal.base.ComponentRegistryImpl;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentRegistryV3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.util.Identifier;
25+
import net.minecraft.resources.Identifier;
2626
import org.jetbrains.annotations.ApiStatus;
2727
import org.jetbrains.annotations.Contract;
2828
import org.ladysnake.cca.internal.base.ComponentRegistryImpl;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentV3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.item.ItemStack;
25+
import net.minecraft.world.item.ItemStack;
2626

2727
/**
2828
* The base interface for components.

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/CopyableComponent.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.nbt.NbtCompound;
26-
import net.minecraft.registry.RegistryWrapper;
25+
import net.minecraft.nbt.CompoundTag;
26+
import net.minecraft.core.HolderLookup;
2727

2828
/**
2929
* A component that can copy its data from another component of the same type.
@@ -35,12 +35,12 @@ public interface CopyableComponent<C extends Component> extends Component {
3535
/**
3636
* Copies the data from {@code other} into {@code this}.
3737
*
38-
* @implSpec The default implementation {@linkplain Component#writeData(net.minecraft.storage.WriteView) serializes}
39-
* the component data to a {@link NbtCompound} and calls {@link Component#readData(net.minecraft.storage.ReadView)}.
38+
* @implSpec The default implementation {@linkplain Component#writeData(net.minecraft.world.level.storage.ValueOutput) serializes}
39+
* the component data to a {@link CompoundTag} and calls {@link Component#readData(net.minecraft.world.level.storage.ValueInput)}.
4040
* @implNote The default implementation should generally be overridden.
4141
* The serialization done by the default implementation assumes NBT consistency
4242
* between implementations, and is generally slower than a direct copy.
4343
* Implementing classes can nearly always provide a better implementation.
4444
*/
45-
void copyFrom(C other, RegistryWrapper.WrapperLookup registryLookup);
45+
void copyFrom(C other, HolderLookup.Provider registryLookup);
4646
}

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/StaticComponentInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.util.Identifier;
25+
import net.minecraft.resources.Identifier;
2626

2727
import java.util.Collection;
2828
import java.util.Collections;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/TransientComponent.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.component;
2424

25-
import net.minecraft.storage.ReadView;
26-
import net.minecraft.storage.WriteView;
25+
import net.minecraft.world.level.storage.ValueInput;
26+
import net.minecraft.world.level.storage.ValueOutput;
2727
import org.jetbrains.annotations.Nullable;
2828

2929
/**
3030
* Utility interface for components that do not hold any data
3131
*/
3232
public interface TransientComponent extends Component {
3333
@Override
34-
default void readData(ReadView readView) {
34+
default void readData(ValueInput readView) {
3535
// Nothing to read
3636
}
3737

3838
@Override
39-
default void writeData(WriteView writeView) {
39+
default void writeData(ValueOutput writeView) {
4040
// Nothing to write
4141
}
4242

0 commit comments

Comments
 (0)