Skip to content

Commit

Permalink
Beta 1.8.2511.0
Browse files Browse the repository at this point in the history
-Added `Skip Intro` option to Game Options section
-Added `Skip Initial Save Warning` option to Game Options section
-Added `Title Screen Fade` option to User Interface section
-Added `Legacy Evoker Fangs` option to Graphics section
-Added `Legacy Sign Screen` and `Legacy Pause Screen` mixin client options
-Now, a target map decoration will appear if a player is in The End, like in LE
-Now, confirmation screens will appear when loading a save and trying to reset dimensions, like in LE
-Now, the credits background will be different between 1.20.x and 1.21.x
-Now, the change dimension trigger will be called when respawning in a different dimension
-Fixed stats with unknown registries, as blocks, kicking players
-Fixed How To Play Interface resetting the scrolling when resizing the screen
-Fixed stuck player decorations in the map when changing dimensions
-Fixed gold chat formatting being applied to the map number in Forge <=1.20.4
-Fixed random crash when using fast leaves models with Sodium in versions +1.21.1
-Fixed mixin error in 1.21.3 version
  • Loading branch information
Wilyicaro committed Mar 10, 2025
1 parent 530fff3 commit 53a2676
Show file tree
Hide file tree
Showing 50 changed files with 683 additions and 115 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ WE ARE NOT RESPONSIBLE FOR PUNISHMENTS RECEIVED IN ANY SERVER
<img src="https://github.com/Kyubion-Studios/Legacy4J-Branding/blob/main/media/modpage_special_thanks.png?raw=true" width="600" >

- AgentMindStorm for providing the built-in resource packs: Console Aspects & Programmer Console Aspects (NeoForge and Forge)
- Moustard for providing the How To Play text from TU69
- RedRain0o0 for doing almost the How To Play UI Definitions
- Moutardx for providing the How To Play text from TU69
- RedRain0o0 for doing almost all the How To Play UI Definitions
- cloud54 for providing Steam Control Icons and sounds for the keyboard screen
- Permdog99 and ItzJustAPlayer for helping with the PlayStation® 5 Control Icons
- NicSonic-_- for providing the Stadia Control Icons
- Cjnator38 for providing the LE default font converted to JE, and the 1.21.x credits background

<img src="https://github.com/Kyubion-Studios/Legacy4J-Branding/blob/main/media/modpage_related_projects.png?raw=true" width="600" >

Expand Down Expand Up @@ -64,4 +65,4 @@ WE ARE NOT RESPONSIBLE FOR PUNISHMENTS RECEIVED IN ANY SERVER
| Advanced Hints/Tutorial |||
| Improved Change Skin Interface |||
| [Legacy Edition Minigames](https://www.legacyminigames.net/) Compatibility |||
| Backports that would need a full remake (<=1.16.5) |||
| Backports that would need a full remake (<=1.16.5) |||
23 changes: 20 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ repositories {
name = "ModMaven"
url = "https://modmaven.dev"
}

maven {
url = "https://maven.pkg.github.com/ims212/ForgifiedFabricAPI"
credentials {
username = "IMS212"
// Read only token
password = "ghp_" + "DEuGv0Z56vnSOYKLCXdsS9svK4nb9K39C1Hn"
}
}
}
configurations.configureEach {
resolutionStrategy {
Expand Down Expand Up @@ -107,6 +116,8 @@ dependencies {
}

if (loader == "neoforge" && stonecutter.eval(stonecutter.current.version, ">=1.21")) {
modCompileOnly("org.sinytra.forgified-fabric-api:fabric-api-base:0.4.42+d1308ded19")
modCompileOnly("org.sinytra.forgified-fabric-api:fabric-renderer-api-v1:5.0.0+babc52e504")
modCompileOnly("org.sinytra.forgified-fabric-api:fabric-rendering-data-attachment-v1:0.3.48+73761d2e19")
modCompileOnly("org.sinytra.forgified-fabric-api:fabric-block-view-api-v2:1.0.10+9afaaf8c19")
modCompileOnly("maven.modrinth:nostalgic-tweaks:${nt_version}")
Expand Down Expand Up @@ -178,8 +189,13 @@ ext {
def changes = new StringBuilder()
changes << "## " + stage.capitalize() + " $version \nUpdated at **$time**. \n**Changelog** "
def proc = "git log --max-count=4 --pretty=format:%s".execute()
getRootProject().file("src/main/resources/assets/legacy/changelog/en_us.txt").readLines().forEach {s-> changes << "\n" + s}
changes << "\n\n[Click here for complete changelog]($mod_source/commits/$branch)"
proc.in.eachLine { line ->
def processedLine = line.toString()
def lines = processedLine.split(" -")
changes << "\n**${lines[0]}** "
lines.each {s-> if (s != lines[0]) changes << "\n- " + s + " "}
}
changes << "\n[Click here for complete changelog]($mod_source/commits/$branch)"
proc.waitFor()
return changes.toString()
}
Expand Down Expand Up @@ -321,10 +337,11 @@ publishMods {

def isFabric = loader == "fabric"
displayName = "$mod_name [$modPlatformName] $project.version"
type = STABLE
type = BETA
changelog = releaseChangelog()
modLoaders.add(loader)
if (isFabric) modLoaders.add "quilt"
else if (loader == "forge" && stonecutter.eval(stonecutter.current.version, "<=1.20.1")) modLoaders.add "neoforge"
file = renameJarForPublication.archiveFile
def versions = mc_version_range.split(",")

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3072M
enabled_platforms=fabric,forge,neoforge

archives_base_name=Legacy4J
mod_version=1.8
mod_version=1.8.2511.0
mod_id=legacy
mod_license=MIT
mod_name=Legacy4J
Expand All @@ -21,7 +21,7 @@ fabric_api_version=[VERSIONED]
forge_version=[VERSIONED]
neoforge_version=[VERSIONED]

factory_api_version=2.2.3-pre
factory_api_version=2.2.3

sodium_version=mc1.21-0.6.0-beta.2-fabric
iris_version=1.8.0-beta.4+1.21-fabric
Expand All @@ -37,4 +37,4 @@ sdl_dependency=dev.isxander:libsdl4j:3.preview-3.1.3-46

curseforge_id=955526
modrinth_id=gHvKJofA
stage=release
stage=beta
6 changes: 4 additions & 2 deletions src/main/java/wily/legacy/Legacy4J.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public Legacy4J(){

public static List<Integer> getParsedVersion(String version){
List<Integer> parsedVersion = new ArrayList<>();
String[] versions = version.split("\\.");
String[] versions = version.split("[.\\-]");
for (String s : versions) {
int value;
try {
Expand Down Expand Up @@ -178,6 +178,7 @@ public static void init(){
FactoryEvent.setup(Legacy4J::setup);
FactoryEvent.tagsLoaded(Legacy4J::tagsLoaded);
FactoryEvent.serverStarted(Legacy4J::onServerStart);
FactoryEvent.PlayerEvent.JOIN_EVENT.register(Legacy4J::onServerPlayerJoin);
FactoryEvent.PlayerEvent.RELOAD_RESOURCES_EVENT.register(Legacy4J::onResourcesReload);
}

Expand Down Expand Up @@ -536,8 +537,9 @@ public static void onServerPlayerJoin(ServerPlayer p){
}
}
((LegacyPlayerInfo)p).setIdentifierIndex(pos);
CommonNetwork.sendToPlayers(p.getServer().getPlayerList().getPlayers().stream().filter(sp-> sp != p).collect(Collectors.toSet()), new PlayerInfoSync.All(Map.of(p.getUUID(),(LegacyPlayerInfo)p), Collections.emptyMap(), p.server.getDefaultGameType(),PlayerInfoSync.All.ID_S2C));
CommonNetwork.forceEnabledPlayer(p, ()-> {
CommonNetwork.sendToPlayer(p, new PlayerInfoSync.All(Map.of(p.getUUID(),(LegacyPlayerInfo)p), Collections.emptyMap(),p.server.getDefaultGameType(),PlayerInfoSync.All.ID_S2C));
CommonNetwork.sendToPlayer(p, PlayerInfoSync.All.fromPlayerList(p.getServer()));
playerInitialPayloads.forEach(payload->CommonNetwork.sendToPlayer(p, payload));
});
if (!p.server.isDedicatedServer()) Legacy4JClient.serverPlayerJoin(p);
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/wily/legacy/Legacy4JClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.world.level.*;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.lwjgl.glfw.GLFW;
//? if >=1.21.2 {
/*import net.minecraft.client.renderer.entity.state.*;
import wily.factoryapi.base.Stocker;
Expand Down Expand Up @@ -75,6 +76,7 @@
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import wily.factoryapi.util.ColorUtil;
import wily.legacy.client.controller.ControllerBinding;
//? if fabric {
import wily.legacy.client.screen.compat.ModMenuCompat;
//?} else if forge {
Expand Down Expand Up @@ -126,6 +128,7 @@
import java.util.function.Predicate;

import static wily.legacy.Legacy4J.MOD_ID;
import static wily.legacy.client.LegacyResourceManager.INTROS;
import static wily.legacy.init.LegacyRegistries.SHRUB;


Expand Down Expand Up @@ -397,12 +400,6 @@ public static void serverPlayerJoin(ServerPlayer player){
}
}

//? if <1.21.2 {
public static RecipeManager getRecipeManager(){
return Minecraft.getInstance().level.getRecipeManager();
}
//?}

public static void init() {
knownBlocks = new KnownListing<>(BuiltInRegistries.BLOCK,Minecraft.getInstance().gameDirectory.toPath());
knownEntities = new KnownListing<>(BuiltInRegistries.ENTITY_TYPE,Minecraft.getInstance().gameDirectory.toPath());
Expand Down Expand Up @@ -673,7 +670,7 @@ public static void buildLegacySkyDisc(VertexConsumer consumer, float f) {
public static BakedModel getFastLeavesModelReplacement(BlockGetter blockGetter, BlockPos pos, BlockState blockState, BakedModel model){
boolean fastGraphics = Minecraft.getInstance().options.graphicsMode().get() == GraphicsStatus.FAST;
if (LegacyOptions.fastLeavesCustomModels.get() && blockState.getBlock() instanceof LeavesBlock && fastLeavesModels.containsKey(blockState.getBlock()) && (fastGraphics || LegacyOptions.fastLeavesWhenBlocked.get())){
if (!fastGraphics) {
if (!fastGraphics && blockGetter != null) {
for (Direction value : Direction.values()) {
BlockPos relative = pos.relative(value);
BlockState relativeBlockState = blockGetter.getBlockState(relative);
Expand All @@ -693,15 +690,17 @@ public static int getEffectiveRenderDistance(){

public static void onClientPlayerInfoChange(){
Minecraft minecraft = Minecraft.getInstance();
if (minecraft.level != null && minecraft.player != null)
CommonNetwork.sendToServer(PlayerInfoSync.askAll(minecraft.player));
if (minecraft.screen instanceof HostOptionsScreen s) s.reloadPlayerButtons();
else if (minecraft.screen instanceof LeaderboardsScreen s){
s.rebuildRenderableVList(minecraft);
s.repositionElements();
}
}

public static boolean canSkipIntro(float timer){
return timer % INTROS.size() >= INTROS.size() - 0.01f || LegacyOptions.skipIntro.get() || InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), InputConstants.KEY_RETURN) || GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(),GLFW.GLFW_MOUSE_BUTTON_1) == GLFW.GLFW_PRESS || ControllerBinding.DOWN_BUTTON.bindingState.pressed;
}

public static final KeyMapping keyCrafting = new KeyMapping("legacy.key.crafting", InputConstants.KEY_E, "key.categories.inventory");
public static final KeyMapping keyCycleHeldLeft = new KeyMapping("legacy.key.cycleHeldLeft", InputConstants.KEY_PAGEDOWN, "key.categories.inventory");
public static final KeyMapping keyCycleHeldRight = new KeyMapping("legacy.key.cycleHeldRight", InputConstants.KEY_PAGEUP, "key.categories.inventory");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/wily/legacy/client/GlobalPacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public GlobalPacks withApplyOnTop(boolean applyOnTop){

public static final Codec<GlobalPacks> CODEC = RecordCodecBuilder.create(i-> i.group(Codec.STRING.listOf().fieldOf("packs").forGetter(GlobalPacks::list), Codec.BOOL.fieldOf("applyOnTop").forGetter(GlobalPacks::applyOnTop)).apply(i, GlobalPacks::new));
public static final FactoryConfig.StorageHandler STORAGE = new FactoryConfig.StorageHandler().withFile("legacy/global_packs.json");
public static final FactoryConfig<GlobalPacks> globalResources = STORAGE.register(FactoryConfig.create("globalResources", null, EMPTY, new Stocker<>(EMPTY), ()-> CODEC, v-> {}, STORAGE));
public static final FactoryConfig<GlobalPacks> globalResources = STORAGE.register(FactoryConfig.create("globalResources", null, ()-> CODEC, EMPTY, v-> {}, STORAGE));


public static class Selector extends AbstractWidget implements ControlTooltip.ActionHolder {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/wily/legacy/client/LegacyMixinOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public class LegacyMixinOptions {
public static final FactoryMixinToggle legacyBeaconScreen = createAndRegisterMixin("legacy.mixin.base.client.beacon", "legacyBeaconScreen");
public static final FactoryMixinToggle legacyBrewingStandScreen = createAndRegisterMixin("legacy.mixin.base.client.brewing", "legacyBrewingStandScreen");
public static final FactoryMixinToggle legacyBookScreen = createAndRegisterMixin("legacy.mixin.base.client.book", "legacyBookScreen");
public static final FactoryMixinToggle legacySignScreen = createAndRegisterMixin("legacy.mixin.base.client.sign", "legacySignScreen");
public static final FactoryMixinToggle legacyCreateWorldScreen = createAndRegisterMixin("legacy.mixin.base.client.create_world", "legacyCreateWorldScreen");
public static final FactoryMixinToggle legacyTitleScreen = createAndRegisterMixin("legacy.mixin.base.client.title", "legacyTitleScreen");
public static final FactoryMixinToggle legacyPauseScreen = createAndRegisterMixin("legacy.mixin.base.client.pause", "legacyPauseScreen");
public static final FactoryMixinToggle legacyGui = createAndRegisterMixin("legacy.mixin.base.client.gui", "legacyGui");
public static final FactoryMixinToggle legacyChat = createAndRegisterMixin("legacy.mixin.base.client.chat", "legacyChat");
public static final FactoryMixinToggle legacyBossHealth = createAndRegisterMixin("legacy.mixin.base.client.bosshealth", "legacyBossHealth");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/wily/legacy/client/LegacyOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ public static <T> Function<T,Component> staticComponent(Component component){
public static final FactoryConfig<Boolean> invertedFrontCameraPitch = CLIENT_STORAGE.register(createBoolean("invertedFrontCameraPitch", true, b-> {}));
public static final FactoryConfig<Boolean> legacySkyShape = CLIENT_STORAGE.register(createBoolean("legacySkyShape", true, b-> Legacy4JClient.updateSkyShape()));
public static final FactoryConfig<Boolean> fastLeavesCustomModels = CLIENT_STORAGE.register(createBoolean("fastLeavesCustomModels", true, b-> Legacy4JClient.updateChunks()));
public static final FactoryConfig<Boolean> skipIntro = CLIENT_STORAGE.register(createBoolean("skipIntro", false));
public static final FactoryConfig<Boolean> skipInitialSaveWarning = CLIENT_STORAGE.register(createBoolean("skipInitialSaveWarning", false));
public static final FactoryConfig<Boolean> titleScreenFade = CLIENT_STORAGE.register(createBoolean("titleScreenFade", false));
public static final FactoryConfig<Boolean> legacyEvokerFangs = CLIENT_STORAGE.register(createBoolean("legacyEvokerFangs", true));

public static int getTerrainFogStart(){
return Math.min(terrainFogStart.get(), Minecraft.getInstance().options.renderDistance().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ static Component getActualUse(Minecraft minecraft){
if (minecraft.hitResult != null && minecraft.hitResult.getType() != HitResult.Type.MISS && !minecraft.level.getWorldBorder().isWithinBounds(minecraft.hitResult.getLocation().x(),minecraft.hitResult.getLocation().z())) return null;
BlockState blockState;
if (minecraft.player.isSleeping()) return LegacyComponents.WAKE_UP;
if ((minecraft.hitResult instanceof BlockHitResult r && ((blockState = minecraft.level.getBlockState(r.getBlockPos())).getBlock() instanceof ButtonBlock || blockState.getBlock() instanceof LeverBlock || blockState.getBlock() instanceof DoorBlock || blockState.getBlock() instanceof FenceGateBlock || (blockState.getMenuProvider(minecraft.level,r.getBlockPos()) != null || minecraft.level.getBlockEntity(r.getBlockPos()) instanceof MenuProvider)))) return (blockState.getBlock() instanceof AbstractChestBlock<?> || blockState.getBlock() instanceof ShulkerBoxBlock || blockState.getBlock() instanceof BarrelBlock || blockState.getBlock() instanceof HopperBlock || blockState.getBlock() instanceof DropperBlock) ? LegacyComponents.OPEN : LegacyComponents.USE;
if ((minecraft.hitResult instanceof BlockHitResult r && ((blockState = minecraft.level.getBlockState(r.getBlockPos())).getBlock() instanceof ButtonBlock || blockState.getBlock() instanceof LeverBlock || blockState.getBlock() instanceof DoorBlock || blockState.getBlock() instanceof TrapDoorBlock || blockState.getBlock() instanceof SignBlock || blockState.getBlock() instanceof FenceGateBlock || (blockState.getMenuProvider(minecraft.level,r.getBlockPos()) != null || minecraft.level.getBlockEntity(r.getBlockPos()) instanceof MenuProvider)))) return (blockState.getBlock() instanceof AbstractChestBlock<?> || blockState.getBlock() instanceof ShulkerBoxBlock || blockState.getBlock() instanceof BarrelBlock || blockState.getBlock() instanceof HopperBlock || blockState.getBlock() instanceof DropperBlock) ? LegacyComponents.OPEN : LegacyComponents.USE;
if (minecraft.hitResult instanceof EntityHitResult r && (r.getEntity() instanceof AbstractVillager m && (!(m instanceof Villager v) || v.getVillagerData().getProfession() != VillagerProfession.NONE) && !m.isTrading())) return LegacyComponents.TRADE;
for (InteractionHand hand : InteractionHand.values()) {
ItemStack actualItem = minecraft.player.getItemInHand(hand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ public void renderDefaultBackground(GuiGraphics guiGraphics, int i, int j, float
});
}

protected void addPlayerButtons(boolean includeClient, BiConsumer<GameProfile, AbstractButton> onPress){
protected void addPlayerButtons(boolean includeLocal, BiConsumer<GameProfile, AbstractButton> onPress){
for (GameProfile profile : getActualGameProfiles()) {
if (!includeClient && Objects.equals(profile.getName(), Minecraft.getInstance().player.getGameProfile().getName())) continue;
if (!includeLocal && Objects.equals(profile.getName(), Minecraft.getInstance().player.getGameProfile().getName())) continue;
renderableVList.addRenderable(new PlayerButton(0,0, 230, 30, profile) {
@Override
public void onPress() {
Expand All @@ -234,7 +234,7 @@ public static List<GameProfile> getActualGameProfiles(){
Minecraft minecraft = Minecraft.getInstance();
if (minecraft.hasSingleplayerServer()) return minecraft.getSingleplayerServer().getPlayerList().getPlayers().stream().map(Player::getGameProfile).toList();
if (minecraft.player != null && !minecraft.player.connection.getOnlinePlayers().isEmpty())
return minecraft.player.connection.getOnlinePlayers().stream().sorted(Comparator.comparingInt((p -> /*? if >1.20.1 {*/minecraft.isLocalPlayer/*?} else {*//*minecraft.player.getUUID().equals*//*?}*/(p.getProfile().getId()) ? 0 : ((LegacyPlayerInfo)p).getIdentifierIndex()))).map(PlayerInfo::getProfile).toList();
return minecraft.player.connection.getOnlinePlayers().stream().sorted(Comparator.comparingInt((p -> minecraft.hasSingleplayerServer() && minecraft.getSingleplayerServer().isSingleplayerOwner(p.getProfile()) ? 0 : ((LegacyPlayerInfo)p).getIdentifierIndex()))).map(PlayerInfo::getProfile).toList();
return Collections.emptyList();
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/wily/legacy/client/screen/HowToPlayScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public void addControlTooltips(ControlTooltip.Renderer renderer) {
renderer.replace(1, i->i, a-> hasNextPage() ? LegacyComponents.NEXT_PAGE : null).add(()-> ControlType.getActiveType().isKbm() ? ControlTooltip.getKeyIcon(InputConstants.KEY_X) : ControllerBinding.LEFT_BUTTON.bindingState.getIcon(), ()-> hasPreviousPage() ? LegacyComponents.PREVIOUS_PAGE : null );
}

@Override
protected void init() {
super.init();
accessor.putStaticElement("scrollable_renderer", scrollableRenderer);
}

protected boolean hasNextPage(){
return sectionIndex < Section.list.size() - 1;
}
Expand Down
Loading

0 comments on commit 53a2676

Please sign in to comment.