Skip to content

Commit

Permalink
LF port so far
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Dec 28, 2024
1 parent 32226bf commit 7b0e1f8
Show file tree
Hide file tree
Showing 40 changed files with 136 additions and 198 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ preprocess {
//}

toolkitLoomHelper {
useOneConfig(mcData, "commands", "config", "config-impl", "events", "internal", "ui")
useOneConfig("1.1.0-alpha.34", "1.0.0-alpha.43", mcData, "commands", "config-impl", "events", "hud", "internal", "ui")
useDevAuth()

disableRunConfigs(GameSide.SERVER)
Expand Down Expand Up @@ -101,7 +101,7 @@ dependencies {

// If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier.
if (mcData.isLegacyForge) {
compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT")
compileOnly("org.polyfrost:polymixin:0.8.4+build.2")
//todo fix with V1
//modImplementation("org.polyfrost:legacy-crafty-crashes:1.0.0") {
// isTransitive = false
Expand Down
93 changes: 0 additions & 93 deletions main.py

This file was deleted.

6 changes: 5 additions & 1 deletion root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ plugins {
preprocess {
strictExtraMappings.set(true)
"1.12.2-forge"(11202, "srg") {
"1.8.9-forge"(10809, "srg", file("versions/1.12.2-1.8.9.txt"))
"1.12.2-fabric"(11202, "yarn") {
"1.8.9-fabric"(10809, "yarn", file("versions/1.12.2-1.8.9.txt")) {
"1.8.9-forge"(10809, "srg")
}
}
}
}
6 changes: 4 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pluginManagement {

plugins {
kotlin("jvm") version("2.0.0")
id("dev.deftu.gradle.multiversion-root") version("2.12.0")
id("dev.deftu.gradle.multiversion-root") version("2.13.0")
}
}

Expand All @@ -34,7 +34,9 @@ rootProject.buildFileName = "root.gradle.kts"
// Adds all of our build target versions to the classpath if we need to add version-specific code.
listOf(
"1.8.9-forge",
"1.12.2-forge"
"1.8.9-fabric",
"1.12.2-forge",
"1.12.2-fabric"
).forEach { version ->
include(":$version")
project(":$version").apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package club.sk1er.patcher.asm.external.forge.loader;

//#if FORGE
import club.sk1er.patcher.tweaker.transform.PatcherTransformer;
import net.minecraftforge.common.ForgeVersion;
import org.objectweb.asm.Opcodes;
Expand Down Expand Up @@ -44,3 +45,4 @@ public void transform(ClassNode classNode, String name) {
}
}
}
//#endif
7 changes: 5 additions & 2 deletions src/main/java/club/sk1er/patcher/config/PatcherConfig.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package club.sk1er.patcher.config;

//#if FORGE
import net.minecraftforge.common.ForgeVersion;
//#endif

import org.polyfrost.oneconfig.api.config.v1.Config;
import org.polyfrost.oneconfig.api.config.v1.Property;
import org.polyfrost.oneconfig.api.config.v1.annotations.Number;
import org.polyfrost.oneconfig.api.config.v1.annotations.*;
import club.sk1er.patcher.Patcher;
import club.sk1er.patcher.tweaker.ClassTransformer;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.ForgeVersion;
import java.util.Arrays;
import java.util.function.Supplier;

Expand Down Expand Up @@ -2010,7 +2013,7 @@ public PatcherConfig() {
// need to show them in the config menu

//noinspection ConstantConditions
Supplier<Boolean> minecraft112 = () -> ForgeVersion.mcVersion.equals("1.12.2");
//Supplier<Boolean> minecraft112 = () -> ForgeVersion.mcVersion.equals("1.12.2");
//Arrays.asList(
// "resourceExploitFix", "newKeybindHandling", "separateResourceLoading", "futureHitBoxes", "cactusHitboxExclusion", "farmSelectionBoxesInfo", "cactusHitboxExclusionInfo",
// "leftHandInFirstPerson", "extendedChatLength", "chatPosition",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class EntityRendererMixin_AdjustEyeHeightLighting {

@ModifyArg(method = "updateRenderer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;getLightBrightness(Lnet/minecraft/util/BlockPos;)F"))
private BlockPos patcher$accountForEyes(BlockPos par1) {
return new BlockPos(mc.getRenderViewEntity().getPositionEyes(1.0F));
return new BlockPos(this.mc.getRenderViewEntity().getPositionEyes(1.0F));
}
//#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public abstract class EntityRendererMixin_SpectatorShader {
)
)
public void patcher$fixSpectatorShader(EntityRenderer entityRenderer, ResourceLocation resourceLocationIn) {
if (mc.gameSettings.thirdPersonView == 0) loadShader(resourceLocationIn);
if (this.mc.gameSettings.thirdPersonView == 0) this.loadShader(resourceLocationIn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GameSettingsMixin_MipmapSlider implements GameSettingsExt {
@Override
public void patcher$onSettingsGuiClosed() {
if (patcher$needsResourceRefresh) {
mc.scheduleResourcesRefresh();
this.mc.scheduleResourcesRefresh();
patcher$needsResourceRefresh = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public abstract class GuiContainerMixin_SplitRemnants extends GuiScreen {
@Inject(method = "updateDragSplitting", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;"), cancellable = true)
private void patcher$fixRemnants(CallbackInfo ci) {
if (this.dragSplittingButton == 2) {
this.dragSplittingRemnant = mc.thePlayer.inventory.getItemStack().getMaxStackSize();
this.dragSplittingRemnant = this.mc.thePlayer.inventory.getItemStack().getMaxStackSize();
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public GuiIngameForgeMixin_FixProfilerSection(Minecraft mcIn) {
remap = false
)
private void patcher$fixProfilerSectionNotEnding(int width, int height, CallbackInfo ci) {
if (mc.mcProfiler.getNameOfLastSection().endsWith("chat")) {
mc.mcProfiler.endSection();
if (this.mc.mcProfiler.getNameOfLastSection().endsWith("chat")) {
this.mc.mcProfiler.endSection();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class GuiLanguageMixin_ResetUnicodeFont extends GuiScreen {

@Override
public void onGuiClosed() {
mc.ingameGUI.getChatGUI().refreshChat();
this.mc.ingameGUI.getChatGUI().refreshChat();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class GuiNewChatMixin_ChatComponentBoundary {

@Inject(method = "getChatComponent", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiNewChat;scrollPos:I"), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT)
private void patcher$stopEventsOutsideWindow(int mouseX, int mouseY, CallbackInfoReturnable<IChatComponent> cir, ScaledResolution scaledresolution, int i, float f, int j, int k, int l) {
int line = k / mc.fontRendererObj.FONT_HEIGHT;
int line = k / this.mc.fontRendererObj.FONT_HEIGHT;
if (line >= getLineCount()) cir.setReturnValue(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
public class GuiOptionsMixin_SaveSettings extends GuiScreen {
@Override
public void onGuiClosed() {
mc.gameSettings.saveOptions();
this.mc.gameSettings.saveOptions();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class GuiVideoSettingsMixin_MipmapSlider extends GuiScreen {
@Override
public void onGuiClosed() {
super.onGuiClosed();
((GameSettingsExt) mc.gameSettings).patcher$onSettingsGuiClosed();
((GameSettingsExt) this.mc.gameSettings).patcher$onSettingsGuiClosed();
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RenderManagerMixin_PerspectiveViewFix {
)

private void patcher$addCorrectView(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks, CallbackInfo ci) {
playerViewX = -playerViewX;
this.playerViewX = -this.playerViewX;
}
//#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class ServerListEntryNormalMixin_BufferFix {
private Runnable patcher$getPingTask() {
return new Thread(() -> {
try {
owner.getOldServerPinger().ping(server);
this.owner.getOldServerPinger().ping(this.server);
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
Expand All @@ -74,8 +74,8 @@ public class ServerListEntryNormalMixin_BufferFix {

@Unique
private void patcher$setServerFail(String error) {
server.pingToServer = -1L;
server.serverMOTD = error;
this.server.pingToServer = -1L;
this.server.serverMOTD = error;
}

@Redirect(method = "drawEntry", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/ThreadPoolExecutor;submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class SoundManagerMixin_DuplicatedSounds {
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/audio/SoundManager$SoundSystemStarterThread;pause(Ljava/lang/String;)V", remap = false)
)
private void patcher$onlyPauseSoundIfNecessary(@Coerce SoundSystem soundSystem, String sound) {
if (isSoundPlaying(playingSounds.get(sound))) {
if (this.isSoundPlaying(this.playingSounds.get(sound))) {
soundSystem.pause(sound);
patcher$pausedSounds.add(sound);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ private ResourceLocation func_178463_a(TileEntityBanner banner) {
if (texture.isEmpty()) {
return null;
} else {
TileEntityBannerRenderer.TimedBannerTexture timedTexture = DESIGNS.get(texture);
TileEntityBannerRenderer.TimedBannerTexture timedTexture = this.DESIGNS.get(texture);
if (timedTexture == null) {
if (DESIGNS.size() >= 256 && !this.patcher$freeCacheSlot()) {
return BANNERTEXTURES;
if (this.DESIGNS.size() >= 256 && !this.patcher$freeCacheSlot()) {
return this.BANNERTEXTURES;
}

List<TileEntityBanner.EnumBannerPattern> patternList = banner.getPatternList();
Expand All @@ -47,8 +47,8 @@ private ResourceLocation func_178463_a(TileEntityBanner banner) {

timedTexture = new TileEntityBannerRenderer.TimedBannerTexture();
timedTexture.bannerTexture = new ResourceLocation(texture);
Minecraft.getMinecraft().getTextureManager().loadTexture(timedTexture.bannerTexture, new LayeredColorMaskTexture(BANNERTEXTURES, patternPath, colorList));
DESIGNS.put(texture, timedTexture);
Minecraft.getMinecraft().getTextureManager().loadTexture(timedTexture.bannerTexture, new LayeredColorMaskTexture(this.BANNERTEXTURES, patternPath, colorList));
this.DESIGNS.put(texture, timedTexture);
}

timedTexture.systemTime = System.currentTimeMillis();
Expand All @@ -59,11 +59,11 @@ private ResourceLocation func_178463_a(TileEntityBanner banner) {
@Unique
private boolean patcher$freeCacheSlot() {
long start = System.currentTimeMillis();
Iterator<String> iterator = DESIGNS.keySet().iterator();
Iterator<String> iterator = this.DESIGNS.keySet().iterator();

while (iterator.hasNext()) {
String next = iterator.next();
TileEntityBannerRenderer.TimedBannerTexture timedTexture = DESIGNS.get(next);
TileEntityBannerRenderer.TimedBannerTexture timedTexture = this.DESIGNS.get(next);

if ((start - timedTexture.systemTime) > 5000L) {
Minecraft.getMinecraft().getTextureManager().deleteTexture(timedTexture.bannerTexture);
Expand All @@ -72,7 +72,7 @@ private ResourceLocation func_178463_a(TileEntityBanner banner) {
}
}

return DESIGNS.size() < 256;
return this.DESIGNS.size() < 256;
}
//#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class ServerListEntryNormalMixin_ResolveCrash {
prepareServerIcon();
} catch (Exception e) {
Patcher.getLogger().error("Failed to prepare server icon, setting to default.", e);
server.setBase64EncodedIconData(null);
this.server.setBase64EncodedIconData(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ public abstract class GuiContainerMixin_MouseBindFix extends GuiScreen {
@Inject(method = "mouseClicked", at = @At("HEAD"))
private void patcher$checkCloseClick(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) {
int keyCode = mouseButton - 100;
if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode()) {
mc.thePlayer.closeScreen();
if (keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
this.mc.thePlayer.closeScreen();
}
//#if MC==10809
if (theSlot != null && theSlot.getHasStack()) {
if (keyCode == mc.gameSettings.keyBindPickBlock.getKeyCode()) {
handleMouseClick(theSlot, theSlot.slotNumber, 0, 3);
} else if (keyCode == mc.gameSettings.keyBindDrop.getKeyCode()) {
handleMouseClick(theSlot, theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4);
if (this.theSlot != null && this.theSlot.getHasStack()) {
if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode()) {
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3);
} else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode()) {
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, this.isCtrlKeyDown() ? 1 : 0, 4);
}
}
//#else
//$$ if (hoveredSlot != null && hoveredSlot.getHasStack()) {
//$$ if (mc.gameSettings.keyBindPickBlock.isActiveAndMatches(keyCode)) {
//$$ handleMouseClick(hoveredSlot, hoveredSlot.slotNumber, 0, ClickType.CLONE);
//$$ } else if (mc.gameSettings.keyBindDrop.isActiveAndMatches(keyCode)) {
//$$ handleMouseClick(hoveredSlot, hoveredSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, ClickType.THROW);
//$$ if (this.hoveredSlot != null && this.hoveredSlot.getHasStack()) {
//$$ if (this.mc.gameSettings.keyBindPickBlock.isActiveAndMatches(keyCode)) {
//$$ this.handleMouseClick(hoveredSlot, this.hoveredSlot.slotNumber, 0, ClickType.CLONE);
//$$ } else if (this.mc.gameSettings.keyBindDrop.isActiveAndMatches(keyCode)) {
//$$ this.handleMouseClick(hoveredSlot, this.hoveredSlot.slotNumber, this.isCtrlKeyDown() ? 1 : 0, ClickType.THROW);
//$$ }
//$$ }
//#endif
Expand Down
Loading

0 comments on commit 7b0e1f8

Please sign in to comment.