Skip to content

Commit

Permalink
Adjusted backported changes to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Mar 9, 2023
1 parent fb73ff9 commit b5e08e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
@AutoInstance
public class AdvancementProvider extends GameModifier {
public AdvancementProvider() {
super( Registries.Modifiers.DEFAULT );

new OnGameStageChange.Context( this::giveAdvancement )
.addCondition( data->!data.isLoadedFromDisk() )
.addCondition( data->data.previous.ordinal() < data.current.ordinal() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.mlib.data.SerializableStructure;
import com.mlib.gamemodifiers.GameModifier;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TranslatableComponent;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -21,6 +21,8 @@ public class ChatMessageSender extends GameModifier {
final Supplier< Messages > messages;

public ChatMessageSender() {
super( Registries.Modifiers.DEFAULT );

this.messages = JsonListener.add( "game_stages", Registries.getLocation( "messages" ), Messages.class, Messages::new );

new OnGameStageChange.Context( this::sendMessage )
Expand All @@ -33,7 +35,7 @@ private void sendMessage( OnGameStageChange.Data data ) {
this.messages.get().stream()
.filter( message->data.current == message.gameStage )
.forEach( message->{
MutableComponent component = Component.translatable( message.id )
MutableComponent component = new TranslatableComponent( message.id )
.withStyle( message.chatFormatting != null ? new ChatFormatting[]{ message.chatFormatting } : data.current.getChatFormatting() );

data.server.getPlayerList()
Expand Down

0 comments on commit b5e08e5

Please sign in to comment.