Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Jab125 committed Jun 2, 2024
1 parent 1bab1b8 commit 1f4b274
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 56 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import dev.architectury.hooks.client.screen.ScreenAccess;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
Expand Down Expand Up @@ -81,7 +82,7 @@ interface RenderHud {
* @param graphics The graphics context.
* @param tickDelta The tick delta.
*/
void renderHud(GuiGraphics graphics, float tickDelta);
void renderHud(GuiGraphics graphics, DeltaTracker deltaTracker);
}

@Environment(EnvType.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static NetworkChannel create(ResourceLocation id) {
public <T> void register(Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
// TODO: this is pretty wasteful; add a way to specify custom or numeric ids
var s = UUID.nameUUIDFromBytes(type.getName().getBytes(StandardCharsets.UTF_8)).toString().replace("-", "");
var info = new MessageInfo<T>(new ResourceLocation(id + "/" + s), encoder, decoder, messageConsumer);
var info = new MessageInfo<T>(ResourceLocation.parse(id + "/" + s), encoder, decoder, messageConsumer);
encoders.put(type, info);
NetworkManager.NetworkReceiver<RegistryFriendlyByteBuf> receiver = (buf, context) -> {
info.messageConsumer.accept(info.decoder.apply(buf), () -> context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @see net.minecraft.network.protocol.game.ClientboundAddEntityPacket
*/
public class SpawnEntityPacket {
private static final ResourceLocation PACKET_ID = new ResourceLocation("architectury", "spawn_entity_packet");
private static final ResourceLocation PACKET_ID = ResourceLocation.fromNamespaceAndPath("architectury", "spawn_entity_packet");
private static final CustomPacketPayload.Type<PacketPayload> PACKET_TYPE = new CustomPacketPayload.Type<>(PACKET_ID);
private static final StreamCodec<RegistryFriendlyByteBuf, PacketPayload> PACKET_CODEC = CustomPacketPayload.codec(PacketPayload::write, PacketPayload::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public MessageType registerS2C(String id, MessageDecoder<BaseS2CMessage> decoder
*/
@ApiStatus.Experimental
public MessageType registerS2C(String id, MessageDecoder<BaseS2CMessage> decoder, List<PacketTransformer> transformers) {
MessageType messageType = new MessageType(this, new ResourceLocation(namespace, id), NetworkManager.s2c());
MessageType messageType = new MessageType(this, ResourceLocation.fromNamespaceAndPath(namespace, id), NetworkManager.s2c());

if (Platform.getEnvironment() == Env.CLIENT) {
NetworkManager.NetworkReceiver<RegistryFriendlyByteBuf> receiver = decoder.createReceiver();
Expand Down Expand Up @@ -107,7 +107,7 @@ public MessageType registerC2S(String id, MessageDecoder<BaseC2SMessage> decoder
*/
@ApiStatus.Experimental
public MessageType registerC2S(String id, MessageDecoder<BaseC2SMessage> decoder, List<PacketTransformer> transformers) {
MessageType messageType = new MessageType(this, new ResourceLocation(namespace, id), NetworkManager.c2s());
MessageType messageType = new MessageType(this, ResourceLocation.fromNamespaceAndPath(namespace, id), NetworkManager.c2s());
NetworkManager.NetworkReceiver<RegistryFriendlyByteBuf> receiver = decoder.createReceiver();
NetworkManager.registerReceiver(NetworkManager.c2s(), messageType.getId(), transformers, receiver);
return messageType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public <R extends T> RegistrySupplier<R> register(String id, Supplier<? extends
throw new NullPointerException("You must create the deferred register with a mod id to register entries without the namespace!");
}

return register(new ResourceLocation(modId, id), supplier);
return register(ResourceLocation.fromNamespaceAndPath(modId, id), supplier);
}

public <R extends T> RegistrySupplier<R> register(ResourceLocation id, Supplier<? extends R> supplier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

public class DyeColorHooksImpl {
public static int getColorValue(DyeColor color) {
var colors = color.getTextureDiffuseColors();
return ((int) (colors[0] * 255.0F + 0.5D) & 255) << 16 | ((int) (colors[1] * 255.0F + 0.5D) & 255) << 8 | (int) (colors[2] * 255.0F + 0.5D);
return color.getTextureDiffuseColor();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ReloadListenerRegistryImpl {
public static void register(PackType type, PreparableReloadListener listener, @Nullable ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
var bytes = new byte[8];
RANDOM.nextBytes(bytes);
var id = listenerId != null ? listenerId : new ResourceLocation("architectury:reload_" + StringUtils.leftPad(Math.abs(Longs.fromByteArray(bytes)) + "", 19, '0'));
var id = listenerId != null ? listenerId : ResourceLocation.parse("architectury:reload_" + StringUtils.leftPad(Math.abs(Longs.fromByteArray(bytes)) + "", 19, '0'));
ResourceManagerHelper.get(type).registerReloadListener(new IdentifiableResourceReloadListener() {
@Override
public ResourceLocation getFabricId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import static net.fabricmc.fabric.api.biome.v1.BiomeModificationContext.*;

public class BiomeModificationsImpl {
private static final ResourceLocation FABRIC_MODIFICATION = new ResourceLocation("architectury", "fabric_modification");
private static final ResourceLocation FABRIC_MODIFICATION = ResourceLocation.fromNamespaceAndPath("architectury", "fabric_modification");
private static final List<Pair<Predicate<BiomeContext>, BiConsumer<BiomeContext, BiomeProperties.Mutable>>> ADDITIONS = Lists.newArrayList();
private static final List<Pair<Predicate<BiomeContext>, BiConsumer<BiomeContext, BiomeProperties.Mutable>>> POST_PROCESSING = Lists.newArrayList();
private static final List<Pair<Predicate<BiomeContext>, BiConsumer<BiomeContext, BiomeProperties.Mutable>>> REMOVALS = Lists.newArrayList();
Expand Down

0 comments on commit 1f4b274

Please sign in to comment.