Skip to content

Commit

Permalink
1.21.2 (#56)
Browse files Browse the repository at this point in the history
* Update to 24w33a

* Update to 24w34a

* Update to 24w39a

---------

Co-authored-by: Drex <[email protected]>
  • Loading branch information
Patbox and DrexHD authored Oct 19, 2024
1 parent 31d653d commit 2dc5ae5
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6.+'
id 'fabric-loom' version '1.7.+'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.21-rc1
yarn_mappings=1.21-rc1+build.1
loader_version=0.15.11
minecraft_version=24w39a
yarn_mappings=24w39a+build.8
loader_version=0.16.5

#Fabric api
fabric_version=0.100.1+1.21
fabric_version=0.105.1+1.21.2

# Mod Properties
mod_version = 2.6.0+1.21
mod_version = 2.6.0+1.21.2
maven_group = eu.pb4
archives_base_name = styled-chat

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 0 additions & 4 deletions src/main/java/eu/pb4/styledchat/StyledChatMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public class StyledChatMod implements ModInitializer {

public static RegistryKey<MessageType> MESSAGE_TYPE_ID = RegistryKey.of(RegistryKeys.MESSAGE_TYPE, Identifier.of("styled_chat", "generic_hack"));

public static MessageType getMessageType() {
return server.getRegistryManager().get(RegistryKeys.MESSAGE_TYPE).getOrThrow(MESSAGE_TYPE_ID);
}

@Override
public void onInitialize() {
this.crabboardDetection();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/pb4/styledchat/StyledChatStyles.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ public static Text getCustom(Identifier identifier, Text displayName, Text messa
return out;
}

var type = source.getRegistryManager().get(RegistryKeys.MESSAGE_TYPE).get(identifier);
var type = source.getRegistryManager().getOrThrow(RegistryKeys.MESSAGE_TYPE).get(identifier);

if (type == null) {
return Text.empty();
}

var optional = source.getRegistryManager().get(RegistryKeys.MESSAGE_TYPE).getKey(type);
var optional = source.getRegistryManager().getOrThrow(RegistryKeys.MESSAGE_TYPE).getKey(type);

if (optional.isEmpty()) {
return Text.empty();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/styledchat/command/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static int clearProperty(CommandContext<ServerCommandSource> context, Ch
{
var x = argument("id", IdentifierArgumentType.identifier())
.suggests((context, builder) -> {
for (var id : context.getSource().getServer().getRegistryManager().get(RegistryKeys.MESSAGE_TYPE).getIds()) {
for (var id : context.getSource().getServer().getRegistryManager().getOrThrow(RegistryKeys.MESSAGE_TYPE).getIds()) {
if (!id.getNamespace().equals("minecraft") && !id.equals(StyledChatMod.MESSAGE_TYPE_ID.getValue())) {
builder.suggest(id.toString());
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/eu/pb4/styledchat/mixin/RegistryLoaderMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

@Mixin(RegistryLoader.class)
public class RegistryLoaderMixin {
@Inject(method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", ordinal = 0, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private static void styledChat$injectMessageTypes(@Coerce Object registryLoadable, DynamicRegistryManager baseRegistryManager, List<RegistryLoader.Entry<?>> entries, CallbackInfoReturnable<DynamicRegistryManager.Immutable> cir, Map map,
List<RegistryLoader.Loader<?>> list, RegistryOps.RegistryInfoGetter registryInfoGetter) {

for (var entry : list) {
@Inject(method = "load", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", ordinal = 0, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private static void styledChat$injectMessageTypes(@Coerce Object registryLoadable, List<RegistryWrapper.Impl<?>> list, List<RegistryLoader.Entry<?>> entries, CallbackInfoReturnable<DynamicRegistryManager.Immutable> cir, Map map,
List<RegistryLoader.Loader<?>> list2, RegistryOps.RegistryInfoGetter registryInfoGetter
) {
for (var entry : list2) {
var reg = entry.registry();
if (reg.getKey().equals(RegistryKeys.MESSAGE_TYPE)) {
Registry.register((Registry<MessageType>) reg, StyledChatMod.MESSAGE_TYPE_ID, new MessageType(Decoration.ofChat("%s"), Decoration.ofChat("%s")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Mixin(TameableEntity.class)
public class TameableEntityMixin {
@ModifyArg(method = "onDeath", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;sendMessage(Lnet/minecraft/text/Text;)V"))
@ModifyArg(method = "onDeath", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;sendMessage(Lnet/minecraft/text/Text;)V"))
private Text styledChat_replaceDeathMessage(Text text) {
return StyledChatStyles.getPetDeath((TameableEntity) (Object) this, text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void send(ServerPlayerEntity receiver, boolean filterMaskEnabled, Message
colorless.setValue(StyledChatUtils.removeColor(parameters));
}
if (!signedMessage.isFullyFiltered()) {
var id = receiver.server.getRegistryManager().get(RegistryKeys.MESSAGE_TYPE).getId(params.type().value());
var id = receiver.server.getRegistryManager().getOrThrow(RegistryKeys.MESSAGE_TYPE).getId(params.type().value());

if (sourceType == null || Objects.equals(id, this.sourceType.getValue())) {
receiver.networkHandler.sendChatMessage(signedMessage, color ? this.parameters : colorless.getValue());
Expand Down Expand Up @@ -80,7 +80,7 @@ public Text content() {

@Override
public void send(ServerPlayerEntity receiver, boolean filterMaskEnabled, MessageType.Parameters params) {
var id = receiver.server.getRegistryManager().get(RegistryKeys.MESSAGE_TYPE).getId(params.type().value());
var id = receiver.server.getRegistryManager().getOrThrow(RegistryKeys.MESSAGE_TYPE).getId(params.type().value());
var color = ((ExtPlayNetworkHandler) receiver.networkHandler).styledChat$chatColors();
if (!color && colorless.getValue() == null) {
colorless.setValue(StyledChatUtils.removeColor(parameters));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],

"depends": {
"minecraft": ">=1.20.5-",
"minecraft": ">=1.21.2-alpha.24.33.a",
"fabricloader": ">=0.15.10"
},
"custom": {
Expand Down

0 comments on commit 2dc5ae5

Please sign in to comment.