-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to newer OfflinePlayerCache & UI Updates (along with mixin cha…
…nges) (#19) * Implement new OPC * Rewrote `AbstractArrowMixin` & `ExperienceOrbMixin` * Adjust math in `AbstractArrowMixin` * Nitpick mixins, remove `ServerLevelMixin` * Nitpick `ServerPlayerMixin` * Add CL, tweak `AbstractArrowMixin` * Redo menu logic * Step version -> alpha.8 * Add ordering to UI to have certain elements display first * Added in proper type for screen * Forgot a `ResourceLocation` * Make API funcs @JvmStatic * Step up OPC, JvmFields/JvmStatics * Change workflow
- Loading branch information
1 parent
5914ffe
commit 5f5617e
Showing
32 changed files
with
204 additions
and
176 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
## Fixes & Changes ⚒️ | ||
- Fixed issues with `alpha.5` having an outdated variant of the previous. | ||
- Migrated to mojmappings. | ||
## Changes ⚒️ | ||
- Updated to a newer build of `OfflinePlayerCache`. | ||
- Changed some more internals. | ||
- Reimplemented original calculation of projectile critical chance. |
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
52 changes: 48 additions & 4 deletions
52
src/client/java/com/bibireden/playerex/registry/PlayerEXMenuRegistry.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 |
---|---|---|
@@ -1,23 +1,67 @@ | ||
package com.bibireden.playerex.registry; | ||
|
||
import com.bibireden.playerex.ui.components.MenuComponent; | ||
import com.bibireden.playerex.ui.PlayerEXScreen; | ||
import kotlin.Pair; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Used to register {@link MenuComponent}'s to the {@link PlayerEXScreen}. | ||
* This allows you to build a UI layer with PlayerEX | ||
* and access component data for the {@link LocalPlayer}. | ||
*/ | ||
public final class PlayerEXMenuRegistry { | ||
@NotNull | ||
private static final List<Class<? extends MenuComponent>> ENTRIES = new ArrayList<>(); | ||
private static final List<Pair<ResourceLocation, Class<? extends MenuComponent>>> ENTRIES = new ArrayList<>(); | ||
|
||
@NotNull | ||
private static final HashMap<String, Integer> PRIORITY_ORDER = new HashMap<>(); | ||
|
||
/** | ||
* Registers a {@link MenuComponent} to the registry, | ||
* which will be applied to the {@link com.bibireden.playerex.ui.PlayerEXScreen} as a page. | ||
* which will be applied to the {@link PlayerEXScreen} as a page. | ||
*/ | ||
public static void register(@NotNull Class<? extends MenuComponent> menu) { ENTRIES.add(menu); } | ||
public static void register(ResourceLocation id, @NotNull Class<? extends MenuComponent> menu) { | ||
Integer position = PRIORITY_ORDER.get(id.getNamespace()); | ||
if (position != null) { | ||
for (int i = 0; i < ENTRIES.size(); i++) { | ||
ResourceLocation entryId = ENTRIES.get(i).getFirst(); | ||
if (PRIORITY_ORDER.get(entryId.getNamespace()) >= position) { | ||
position = i + 1; | ||
} | ||
} | ||
ENTRIES.add(position, new Pair<>(id, menu)); | ||
} | ||
else { | ||
ENTRIES.add(new Pair<>(id, menu)); | ||
} | ||
} | ||
|
||
@NotNull | ||
public static List<Class<? extends MenuComponent>> get() { | ||
public static List<Pair<ResourceLocation, Class<? extends MenuComponent>>> get() { | ||
return ENTRIES; | ||
} | ||
|
||
@NotNull | ||
public static List<ResourceLocation> getIds() { | ||
return ENTRIES.stream().map(Pair::component1).toList(); | ||
} | ||
|
||
@NotNull | ||
public static List<Class<? extends MenuComponent>> getDefs() { | ||
return ENTRIES.stream().map(Pair::component2).collect(Collectors.toUnmodifiableList()); | ||
} | ||
|
||
static { | ||
PRIORITY_ORDER.put("playerex", 0); | ||
PRIORITY_ORDER.put("relicex", 1); | ||
PRIORITY_ORDER.put("wizardex", 2); | ||
} | ||
} |
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
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
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
14 changes: 0 additions & 14 deletions
14
src/client/kotlin/com/bibireden/playerex/ui/menus/ConceptMenu.kt
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.