-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle invalid game portals in non-lossy way
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/xyz/nucleoid/plasmid/impl/portal/game/InvalidGamePortalBackend.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package xyz.nucleoid.plasmid.impl.portal.game; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Identifier; | ||
import xyz.nucleoid.plasmid.api.game.config.CustomValuesConfig; | ||
import xyz.nucleoid.plasmid.impl.portal.GamePortalBackend; | ||
import xyz.nucleoid.plasmid.impl.portal.GamePortalConfig; | ||
|
||
public record InvalidGamePortalBackend(Identifier identifier) implements GamePortalBackend { | ||
public static final GamePortalConfig CONFIG = new GamePortalConfig() { | ||
@Override | ||
public GamePortalBackend createBackend(MinecraftServer server, Identifier id) { | ||
return new InvalidGamePortalBackend(id); | ||
} | ||
|
||
@Override | ||
public CustomValuesConfig custom() { | ||
return CustomValuesConfig.empty(); | ||
} | ||
|
||
@Override | ||
public MapCodec<? extends GamePortalConfig> codec() { | ||
return MapCodec.unit(this); | ||
} | ||
}; | ||
|
||
@Override | ||
public Text getName() { | ||
return Text.literal("Invalid portal'" + this.identifier + "'"); | ||
} | ||
|
||
@Override | ||
public void applyTo(ServerPlayerEntity player, boolean alt) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters