From a868012a277d83591bb8ef363d4de95d73326a4b Mon Sep 17 00:00:00 2001 From: deirn Date: Wed, 12 Apr 2023 08:02:05 +0700 Subject: [PATCH] target 1.19.3 --- buildSrc/src/main/kotlin/Dependencies.kt | 67 ++++++++++--------- .../main/kotlin/FetchLatestVersionsTask.kt | 22 +++--- .../runtime/component/InventoryComponent.java | 5 +- .../runtime/component/ProgressComponent.java | 6 +- .../component/StatusEffectComponent.java | 2 +- .../config/screen/BlacklistConfigScreen.java | 15 +++-- .../config/screen/MapConfigScreen.java | 19 +++--- .../config/screen/MeganeConfigScreen.java | 3 +- .../megane/runtime/data/block/BlockData.java | 5 +- .../data/block/BlockInventoryData.java | 4 +- .../megane/runtime/data/block/FluidData.java | 4 +- .../runtime/data/block/ProgressData.java | 4 +- .../runtime/data/entity/EntityData.java | 5 +- .../data/entity/EntityInventoryData.java | 5 +- .../mixin/MixinPluginConfigScreen.java | 6 +- .../block/BlockComponentProvider.java | 4 +- .../block/EnergyComponentProvider.java | 6 +- .../block/FluidComponentProvider.java | 4 +- .../entity/EntityComponentProvider.java | 4 +- .../bai/megane/runtime/util/MeganeUtils.java | 6 +- .../test/provider/TestItemProvider.java | 6 +- .../test/provider/TestProgressProvider.java | 6 +- .../mixin/MixinPowerStorageDataProvider.java | 35 ---------- settings.gradle.kts | 18 ++--- 24 files changed, 111 insertions(+), 150 deletions(-) delete mode 100644 module-compat/applied-energistics-2/src/main/java/lol/bai/megane/module/ae2/mixin/MixinPowerStorageDataProvider.java diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 836aa5b..0683d3b 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -3,53 +3,54 @@ import org.gradle.kotlin.dsl.DependencyHandlerScope import org.gradle.kotlin.dsl.exclude object versions { - val minecraft = "1.19.2" + val minecraft = "1.19.3" } object deps { val minecraft = "com.mojang:minecraft:${versions.minecraft}" - val yarn = "net.fabricmc:yarn:1.19.2+build.8:v2" - val fabricLoader = "net.fabricmc:fabric-loader:0.14.15" + val yarn = "net.fabricmc:yarn:1.19.3+build.5:v2" + val fabricLoader = "net.fabricmc:fabric-loader:0.14.18" - val wthit = "mcp.mobius.waila:wthit:fabric-5.13.5" + val wthit = "mcp.mobius.waila:wthit:fabric-6.3.1" - val ae2 = "appeng:appliedenergistics2-fabric:12.9.2" - val alloyForge = "maven.modrinth:jhl28YkY:2.0.19+1.19" - val architectury = "dev.architectury:architectury-fabric:6.5.69" - val create = "com.simibubi.create:create-fabric-1.19.2:0.5.0.i-961+1.19.2" - val clothConfig = "me.shedaniel.cloth:cloth-config-fabric:8.2.88" - val extraGen = "maven.modrinth:VXtwLg17:1.2.1-BETA+1.19" - val fabricApi = "net.fabricmc.fabric-api:fabric-api:0.73.2+1.19.2" - val flk = "net.fabricmc:fabric-language-kotlin:1.9.1+kotlin.1.8.10" - val kibe = "maven.modrinth:OvlwmUdC:1.9.11-BETA+1.19" - val modernDynamics = "maven.modrinth:fMpvLrnF:0.4.0-alpha" - val modmenu = "com.terraformersmc:modmenu:4.2.0-beta.2" - val noIndium = "me.luligabi:NoIndium:1.1.0+1.19" - val owo = "io.wispforest:owo-lib:0.9.3+1.19" - val patchouli = "vazkii.patchouli:Patchouli:1.19.2-77-FABRIC" - val powah = "maven.modrinth:KZO4S4DO:4.0.6-fabric" + val ae2 = "appeng:appliedenergistics2-fabric:13.0.6-beta" + val alloyForge = "maven.modrinth:jhl28YkY:2.0.19+1.19.3" + val architectury = "dev.architectury:architectury-fabric:7.1.78" + val clothConfig = "me.shedaniel.cloth:cloth-config-fabric:9.0.94" + val fabricApi = "net.fabricmc.fabric-api:fabric-api:0.76.1+1.19.3" + val flk = "net.fabricmc:fabric-language-kotlin:1.9.3+kotlin.1.8.20" + val modmenu = "com.terraformersmc:modmenu:5.1.0-beta.4" + val noIndium = "me.luligabi:NoIndium:1.1.0+1.19.3" + val owo = "io.wispforest:owo-lib:0.10.3+1.19.3" + val patchouli = "vazkii.patchouli:Patchouli:1.19.3-78-FABRIC" - val indrev = "curse.maven:cursemod-391708:4020957" - val luggage = "curse.maven:cursemod-594709:4284469" - val pal = "io.github.ladysnake:PlayerAbilityLib:1.6.0" - val rebornCore = "RebornCore:RebornCore-1.19:5.4.0" - val techReborn = "TechReborn:TechReborn-1.19:5.4.0" - val wirelessNet = "curse.maven:cursemod-461316:3876132" + val pal = "io.github.ladysnake:PlayerAbilityLib:1.7.0" + val rebornCore = "RebornCore:RebornCore-1.19:5.5.0" + val techReborn = "TechReborn:TechReborn-1.19:5.5.0" object lba { - val core = "alexiil.mc.lib:libblockattributes-core:0.11.1" - val fluids = "alexiil.mc.lib:libblockattributes-fluids:0.11.1" - val items = "alexiil.mc.lib:libblockattributes-items:0.11.1" + val core = "alexiil.mc.lib:libblockattributes-core:0.12.0" + val fluids = "alexiil.mc.lib:libblockattributes-fluids:0.12.0" + val items = "alexiil.mc.lib:libblockattributes-items:0.12.0" } - val trEnergy = "teamreborn:energy:2.2.0" - val libgui = "io.github.cottonmc:LibGui:6.0.1+1.19" + val trEnergy = "teamreborn:energy:3.0.0" + val libgui = "io.github.cottonmc:LibGui:6.5.3+1.19.3" val magna = "com.github.GabrielOlvH:magna:0.5.2" - val stepAttr = "com.github.emilyploszaj:step-height-entity-attribute:v1.0.1" + val stepAttr = "com.github.emilyploszaj:step-height-entity-attribute:v1.1.0" val fakePlayer = "dev.cafeteria:fake-player-api:0.5.0" - val mixinExtras = "com.github.LlamaLad7:MixinExtras:0.1.1-rc.4" - val portingLib = "io.github.fabricators_of_create.Porting-Lib:porting-lib:2.1.811+1.19.2" + val mixinExtras = "com.github.LlamaLad7:MixinExtras:0.2.0-beta.6" + val portingLib = "io.github.fabricators_of_create.Porting-Lib:porting-lib:2.1.852+1.19.3" val registrate = "com.tterrag.registrate_fabric:Registrate:1.1.50-MC1.19.2" + +// val create = "com.simibubi.create:create-fabric-1.19.2:0.5.0.i-961+1.19.2" +// val extraGen = "maven.modrinth:VXtwLg17:1.2.1-BETA+1.19" +// val kibe = "maven.modrinth:OvlwmUdC:1.9.11-BETA+1.19" +// val modernDynamics = "maven.modrinth:fMpvLrnF:0.4.0-alpha" +// val powah = "maven.modrinth:KZO4S4DO:4.0.6-fabric" +// val indrev = "curse.maven:cursemod-391708:4020957" +// val luggage = "curse.maven:cursemod-594709:4284469" +// val wirelessNet = "curse.maven:cursemod-461316:3876132" } fun DependencyHandlerScope.modImpl(dep: String, dependencyConfiguration: ExternalModuleDependency.() -> Unit = {}) { diff --git a/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt b/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt index 99dff1b..5597c64 100644 --- a/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt +++ b/buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt @@ -7,7 +7,7 @@ import version.VersionFetcher import java.awt.Toolkit import java.awt.datatransfer.StringSelection import java.net.http.HttpClient -import java.util.* +import java.util.Locale import kotlin.reflect.KProperty import kotlin.reflect.full.memberProperties @@ -46,29 +46,29 @@ abstract class FetchLatestVersionsTask : DefaultTask() { fetch(deps::ae2, mrIds.ae2) { "appeng:appliedenergistics2-fabric:${it.version_number.removePrefix("fabric-")}" } fetch(deps::alloyForge, mrIds.alloyForge) { it.maven } fetch(deps::architectury, mrIds.architectury) { "dev.architectury:architectury-fabric:${it.version_number.removeSuffix("+fabric")}" } - fetch(deps::create, mrIds.create) { "com.simibubi.create:create-fabric-1.19.2:${it.version_number}" } +// fetch(deps::create, mrIds.create) { "com.simibubi.create:create-fabric-1.19.2:${it.version_number}" } fetch(deps::clothConfig, mrIds.clothConfig) { "me.shedaniel.cloth:cloth-config-fabric:${it.version_number.removeSuffix("+fabric")}" } - fetch(deps::extraGen, mrIds.extraGen, "1.19") { it.maven } +// fetch(deps::extraGen, mrIds.extraGen, "1.19") { it.maven } fetch(deps::fabricApi, mrIds.fabricApi) { "net.fabricmc.fabric-api:fabric-api:${it.version_number}" } fetch(deps::flk, mrIds.flk) { "net.fabricmc:fabric-language-kotlin:${it.version_number}" } - fetch(deps::kibe, mrIds.kibe) { it.maven } - fetch(deps::modernDynamics, mrIds.modernDynamics) { it.maven } +// fetch(deps::kibe, mrIds.kibe) { it.maven } +// fetch(deps::modernDynamics, mrIds.modernDynamics) { it.maven } fetch(deps::modmenu, mrIds.modmenu) { "com.terraformersmc:modmenu:${it.version_number}" } - fetch(deps::noIndium, mrIds.noIndium, "1.19") { "me.luligabi:NoIndium:${it.version_number}" } - fetch(deps::owo, mrIds.owo, "1.19") { "io.wispforest:owo-lib:${it.version_number}" } + fetch(deps::noIndium, mrIds.noIndium) { "me.luligabi:NoIndium:${it.version_number}" } + fetch(deps::owo, mrIds.owo) { "io.wispforest:owo-lib:${it.version_number}" } fetch(deps::patchouli, mrIds.patchouli) { "vazkii.patchouli:Patchouli:${it.version_number.toUpperCase(Locale.ROOT)}" } - fetch(deps::powah, mrIds.powah) { it.maven } +// fetch(deps::powah, mrIds.powah) { it.maven } } out() fetcher(CurseForgeVersionFetcher) { - fetch(deps::indrev, cfIds.indrev) { it.maven } - fetch(deps::luggage, cfIds.luggage) { it.maven } +// fetch(deps::indrev, cfIds.indrev) { it.maven } +// fetch(deps::luggage, cfIds.luggage) { it.maven } fetch(deps::pal, cfIds.pal) { "io.github.ladysnake:PlayerAbilityLib:${it.download.fileName.removePrefix("pal-")}" } fetch(deps::rebornCore, cfIds.rebornCore) { "RebornCore:RebornCore-1.19:${it.download.fileName.removePrefix("RebornCore-")}" } fetch(deps::techReborn, cfIds.techReborn) { "TechReborn:TechReborn-1.19:${it.download.fileName.removePrefix("TechReborn-")}" } - fetch(deps::wirelessNet, cfIds.wirelessNet, "1.19") { it.maven } +// fetch(deps::wirelessNet, cfIds.wirelessNet, "1.19") { it.maven } out("\nobject lba {") deps.lba::class.memberProperties.forEach { module -> diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/InventoryComponent.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/InventoryComponent.java index 897df59..d520e07 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/InventoryComponent.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/InventoryComponent.java @@ -12,8 +12,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; - -import static net.minecraft.util.registry.Registry.ITEM; +import net.minecraft.registry.Registries; public class InventoryComponent implements ITooltipComponent { @@ -31,7 +30,7 @@ public InventoryComponent(NbtCompound data, int maxWidth, int maxHeight) { stacks.clear(); for (int i = 0; i < size; i++) { - Item item = ITEM.get(data.getInt(Keys.I_ID + i)); + Item item = Registries.ITEM.get(data.getInt(Keys.I_ID + i)); int count = showCount ? data.getInt(Keys.I_COUNT + i) : 1; NbtCompound nbt = (NbtCompound) data.get(Keys.I_NBT + i); if (count <= 0) diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/ProgressComponent.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/ProgressComponent.java index 8462226..2842aaf 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/ProgressComponent.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/ProgressComponent.java @@ -6,8 +6,8 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; public class ProgressComponent implements ITooltipComponent { @@ -36,7 +36,7 @@ public void render(MatrixStack matrices, int x, int y, float delta) { int progressPixel = (int) (data.getInt(Keys.P_PERCENT) / 100F * 22); for (int i = 0; i < inputCount; i++) { - ItemStack stack = new ItemStack(Registry.ITEM.get(data.getInt(Keys.P_I_ID + i)), data.getInt(Keys.P_I_COUNT + i)); + ItemStack stack = new ItemStack(Registries.ITEM.get(data.getInt(Keys.P_I_ID + i)), data.getInt(Keys.P_I_COUNT + i)); stack.setNbt(data.getCompound(Keys.P_I_NBT + i)); if (stack.isEmpty()) { inputCount--; @@ -50,7 +50,7 @@ public void render(MatrixStack matrices, int x, int y, float delta) { MeganeUtils.drawTexture(matrices, ARROW, x + 2 + (inputCount * 18), y + 1, progressPixel, 16, 0, 0, progressPixel / 22F, 0.5F, 0xFFFFFF); for (int i = 0; i < outputCount; i++) { - ItemStack stack = new ItemStack(Registry.ITEM.get(data.getInt(Keys.P_O_ID + i)), data.getInt(Keys.P_O_COUNT + i)); + ItemStack stack = new ItemStack(Registries.ITEM.get(data.getInt(Keys.P_O_ID + i)), data.getInt(Keys.P_O_COUNT + i)); stack.setNbt(data.getCompound(Keys.P_O_NBT + i)); MeganeUtils.drawStack(stack, x + (inputCount * 18) + 26 + (i * 18), y + 1); } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/StatusEffectComponent.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/StatusEffectComponent.java index 0d7b0a3..44eb6c8 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/StatusEffectComponent.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/component/StatusEffectComponent.java @@ -51,7 +51,7 @@ public void render(MatrixStack matrices, int x, int y, float delta) { StatusEffect statusEffect = StatusEffect.byRawId(data.getInt(Keys.S_ID + i)); if (statusEffect != null) { Sprite sprite = manager.getSprite(statusEffect); - RenderSystem.setShaderTexture(0, sprite.getAtlas().getId()); + RenderSystem.setShaderTexture(0, sprite.getAtlasId()); DrawableHelper.drawSprite(matrices, x + 20 * i, y, 0, 18, 18, sprite); MeganeUtils.textRenderer().drawWithShadow(matrices, lv, x + 20 + (20 * i) - MeganeUtils.textRenderer().getWidth(lv), y + 20 - MeganeUtils.textRenderer().fontHeight, 0xFFFFFF); } else { diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/BlacklistConfigScreen.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/BlacklistConfigScreen.java index ef1160d..3f03b4b 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/BlacklistConfigScreen.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/BlacklistConfigScreen.java @@ -6,6 +6,7 @@ import mcp.mobius.waila.gui.screen.ConfigScreen; import mcp.mobius.waila.gui.widget.ButtonEntry; import mcp.mobius.waila.gui.widget.ConfigListWidget; +import mcp.mobius.waila.util.DisplayUtil; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -27,9 +28,9 @@ public BlacklistConfigScreen(Screen parent, Text title, Set set) { public ConfigListWidget getOptions() { ConfigListWidget options = new ConfigListWidget(this, client, width, height, 32, height - 32, 26, MeganeUtils.CONFIG::save); this.set.forEach(value -> options.add(new SetEntry(this, options, value, this.set))); - options.add(new ButtonEntry("config.megane.add", new ButtonWidget(0, 0, 100, 20, ScreenTexts.EMPTY, w -> + options.add(new ButtonEntry("config.megane.add", 100, 20, w -> options.children().add(options.children().size() - 1, new SetEntry(this, options, null, set)) - ))); + )); return options; } @@ -53,7 +54,7 @@ static class SetEntry extends ConfigListWidget.Entry { set.add(this.value); }); - this.removeButton = new ButtonWidget(0, 0, 20, 20, Text.of("X"), w -> { + this.removeButton = DisplayUtil.createButton(0, 0, 20, 20, Text.of("X"), w -> { set.remove(this.value); screen.children().remove(this.textField); screen.children().remove(w); @@ -68,12 +69,12 @@ static class SetEntry extends ConfigListWidget.Entry { public void render(MatrixStack matrices, int index, int rowTop, int rowLeft, int width, int height, int mouseX, int mouseY, boolean hovered, float deltaTime) { super.render(matrices, index, rowTop, rowLeft, width, height, mouseX, mouseY, hovered, deltaTime); - this.textField.x = rowLeft; - this.textField.y = rowTop; + this.textField.setX(rowLeft); + this.textField.setY(rowTop); this.textField.render(matrices, mouseX, mouseY, deltaTime); - this.removeButton.x = rowLeft + textField.getWidth() + 2; - this.removeButton.y = rowTop + (height - removeButton.getHeight()) / 2; + this.removeButton.setX(rowLeft + textField.getWidth() + 2); + this.removeButton.setY(rowTop + (height - removeButton.getHeight()) / 2); this.removeButton.render(matrices, mouseX, mouseY, deltaTime); } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MapConfigScreen.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MapConfigScreen.java index aaa50b7..a383318 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MapConfigScreen.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MapConfigScreen.java @@ -9,6 +9,7 @@ import mcp.mobius.waila.gui.screen.ConfigScreen; import mcp.mobius.waila.gui.widget.ButtonEntry; import mcp.mobius.waila.gui.widget.ConfigListWidget; +import mcp.mobius.waila.util.DisplayUtil; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -39,9 +40,9 @@ public MapConfigScreen(Screen parent, Text title, Map map, Function options.add(new PairEntry(this, options, keyStr.apply(key), valStr.apply(val), mapApplier, keyPredicate, valPredicate))); - options.add(new ButtonEntry("config.megane.add", new ButtonWidget(0, 0, 100, 20, ScreenTexts.EMPTY, w -> + options.add(new ButtonEntry("config.megane.add", 100, 20, w -> options.children().add(options.children().size() - 1, new PairEntry(this, options, "", "", mapApplier, keyPredicate, valPredicate)) - ))); + )); return options; } @@ -83,7 +84,7 @@ static class PairEntry extends ConfigListWidget.Entry { }); screen.addListener(this.valTextField); - this.removeButton = new ButtonWidget(0, 0, 20, 20, Text.of("X"), w -> { + this.removeButton = DisplayUtil.createButton(0, 0, 20, 20, Text.of("X"), w -> { consumer.apply(this.key, null, null); screen.children().remove(this.keyTextField); screen.children().remove(this.valTextField); @@ -97,16 +98,16 @@ static class PairEntry extends ConfigListWidget.Entry { public void render(MatrixStack matrices, int index, int rowTop, int rowLeft, int width, int height, int mouseX, int mouseY, boolean hovered, float deltaTime) { super.render(matrices, index, rowTop, rowLeft, width, height, mouseX, mouseY, hovered, deltaTime); - this.keyTextField.x = rowLeft; - this.keyTextField.y = rowTop + (height - keyTextField.getHeight()) / 2; + this.keyTextField.setX(rowLeft); + this.keyTextField.setY(rowTop + (height - keyTextField.getHeight()) / 2); this.keyTextField.render(matrices, mouseX, mouseY, deltaTime); - this.valTextField.x = rowLeft + textWidth + 4; - this.valTextField.y = keyTextField.y; + this.valTextField.setX(rowLeft + textWidth + 4); + this.valTextField.setY(keyTextField.getY()); this.valTextField.render(matrices, mouseX, mouseY, deltaTime); - this.removeButton.x = rowLeft + (textWidth + 2) * 2; - this.removeButton.y = rowTop + (height - removeButton.getHeight()) / 2; + this.removeButton.setX(rowLeft + (textWidth + 2) * 2); + this.removeButton.setY(rowTop + (height - removeButton.getHeight()) / 2); this.removeButton.render(matrices, mouseX, mouseY, deltaTime); } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MeganeConfigScreen.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MeganeConfigScreen.java index 53b22f0..210fbf4 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MeganeConfigScreen.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/config/screen/MeganeConfigScreen.java @@ -16,7 +16,6 @@ import mcp.mobius.waila.gui.widget.value.InputValue; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.screen.ScreenTexts; import net.minecraft.text.Text; import static lol.bai.megane.runtime.config.widget.Side.AND; @@ -63,7 +62,7 @@ private static CategoryEntry category(String type) { } private static ButtonEntry button(String type, ButtonWidget.PressAction pressAction) { - return new ButtonEntry(tlKey(type), new ButtonWidget(0, 0, 100, 20, ScreenTexts.EMPTY, pressAction)); + return new ButtonEntry(tlKey(type), 100, 20, pressAction); } private static BooleanValue bool(String type, boolean value, boolean defaultValue, Consumer consumer) { diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockData.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockData.java index e4ddee4..b77a9aa 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockData.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockData.java @@ -11,14 +11,13 @@ import mcp.mobius.waila.api.IServerDataProvider; import net.minecraft.block.entity.BlockEntity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.text.ClickEvent; import net.minecraft.text.HoverEvent; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; -import static net.minecraft.util.registry.Registry.BLOCK; - public abstract class BlockData implements IServerDataProvider { private static final Text ERROR_TEXT = Text.literal("Something went wrong when retrieving data for this block").styled(style -> style @@ -44,7 +43,7 @@ public BlockData(Registry registry, Supplier baseConfig) { public void appendServerData(NbtCompound data, IServerAccessor accessor, IPluginConfig config) { BlockEntity blockEntity = accessor.getTarget(); - if (!baseConfig.get().isEnabled() || baseConfig.get().getBlacklist().contains(BLOCK.getId(blockEntity.getCachedState().getBlock()))) { + if (!baseConfig.get().isEnabled() || baseConfig.get().getBlacklist().contains(Registries.BLOCK.getId(blockEntity.getCachedState().getBlock()))) { return; } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockInventoryData.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockInventoryData.java index 2f5afd4..22f0bdd 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockInventoryData.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/BlockInventoryData.java @@ -9,6 +9,7 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import static lol.bai.megane.runtime.util.Keys.I_COUNT; import static lol.bai.megane.runtime.util.Keys.I_HAS; @@ -17,7 +18,6 @@ import static lol.bai.megane.runtime.util.Keys.I_SHOW; import static lol.bai.megane.runtime.util.Keys.I_SIZE; import static lol.bai.megane.runtime.util.MeganeUtils.EMPTY_TAG; -import static net.minecraft.util.registry.Registry.ITEM; public class BlockInventoryData extends BlockData { @@ -41,7 +41,7 @@ void append(NbtCompound data, IServerAccessor accessor) { if (stack.isEmpty()) { continue; } - data.putInt(I_ID + i, ITEM.getRawId(stack.getItem())); + data.putInt(I_ID + i, Registries.ITEM.getRawId(stack.getItem())); data.putInt(I_COUNT + i, stack.getCount()); NbtCompound nbt = stack.getNbt(); data.put(I_NBT + i, nbt == null || !MeganeUtils.config().inventory.isNbt() ? EMPTY_TAG : nbt); diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/FluidData.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/FluidData.java index 683f27d..2b375c3 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/FluidData.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/FluidData.java @@ -10,7 +10,7 @@ import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; import net.minecraft.nbt.NbtCompound; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import static lol.bai.megane.runtime.util.Keys.F_HAS; import static lol.bai.megane.runtime.util.Keys.F_ID; @@ -42,7 +42,7 @@ void append(NbtCompound data, IServerAccessor accessor) { if (fluid == null || fluid == Fluids.EMPTY) { continue; } - data.putInt(F_ID + i, Registry.FLUID.getRawId(fluid)); + data.putInt(F_ID + i, Registries.FLUID.getRawId(fluid)); data.putDouble(F_STORED + i, provider.getStored(j)); data.putDouble(F_MAX + i, provider.getMax(j)); diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/ProgressData.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/ProgressData.java index ef5f9ab..545d713 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/ProgressData.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/block/ProgressData.java @@ -9,7 +9,7 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import static lol.bai.megane.runtime.util.Keys.P_HAS; import static lol.bai.megane.runtime.util.Keys.P_I_COUNT; @@ -69,7 +69,7 @@ private int addStack(NbtCompound data, int i, ItemStack stack, String itemId, St return i; } NbtCompound tag = stack.getNbt(); - data.putInt(itemId + i, Registry.ITEM.getRawId(stack.getItem())); + data.putInt(itemId + i, Registries.ITEM.getRawId(stack.getItem())); data.putInt(countId + i, stack.getCount()); data.put(nbtId + i, tag == null ? EMPTY_TAG : tag); i++; diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityData.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityData.java index d7746b9..6a61134 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityData.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityData.java @@ -11,14 +11,13 @@ import mcp.mobius.waila.api.IServerDataProvider; import net.minecraft.entity.Entity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.text.ClickEvent; import net.minecraft.text.HoverEvent; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.math.Vec3d; -import static net.minecraft.util.registry.Registry.ENTITY_TYPE; - public abstract class EntityData implements IServerDataProvider { private static final Text ERROR_TEXT = Text.literal("Something went wrong when retrieving data for this entity").styled(style -> style @@ -43,7 +42,7 @@ public EntityData(Registry registry, Supplier baseConfig) @Override public void appendServerData(NbtCompound data, IServerAccessor accessor, IPluginConfig config) { Entity entity = accessor.getTarget(); - if (!baseConfig.get().isEnabled() || baseConfig.get().getBlacklist().contains(ENTITY_TYPE.getId(entity.getType()))) { + if (!baseConfig.get().isEnabled() || baseConfig.get().getBlacklist().contains(Registries.ENTITY_TYPE.getId(entity.getType()))) { return; } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityInventoryData.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityInventoryData.java index 4ef7b66..aad88b7 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityInventoryData.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/data/entity/EntityInventoryData.java @@ -10,8 +10,7 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; - -import static net.minecraft.util.registry.Registry.ITEM; +import net.minecraft.registry.Registries; public class EntityInventoryData extends EntityData { @@ -35,7 +34,7 @@ void append(NbtCompound data, IServerAccessor accessor) { if (stack.isEmpty()) { continue; } - data.putInt(Keys.I_ID + i, ITEM.getRawId(stack.getItem())); + data.putInt(Keys.I_ID + i, Registries.ITEM.getRawId(stack.getItem())); data.putInt(Keys.I_COUNT + i, stack.getCount()); NbtCompound nbt = stack.getNbt(); data.put(Keys.I_NBT + i, nbt == null || !MeganeUtils.config().entityInventory.isNbt() ? MeganeUtils.EMPTY_TAG : nbt); diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/mixin/MixinPluginConfigScreen.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/mixin/MixinPluginConfigScreen.java index e01733b..36bb1ae 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/mixin/MixinPluginConfigScreen.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/mixin/MixinPluginConfigScreen.java @@ -5,8 +5,6 @@ import mcp.mobius.waila.gui.widget.ButtonEntry; import mcp.mobius.waila.gui.widget.ConfigListWidget; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.screen.ScreenTexts; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -17,9 +15,9 @@ public class MixinPluginConfigScreen { @Inject(method = "getOptions", at = @At("TAIL"), remap = false) private void add(CallbackInfoReturnable cir) { - cir.getReturnValue().children().add(1, new ButtonEntry("config.waila.megane", new ButtonWidget(0, 0, 100, 20, ScreenTexts.EMPTY, w -> + cir.getReturnValue().children().add(1, new ButtonEntry("config.waila.megane", 100, 20, w -> MinecraftClient.getInstance().setScreen(new MeganeConfigScreen((PluginConfigScreen) (Object) this)) - ))); + )); } } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/BlockComponentProvider.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/BlockComponentProvider.java index 42efd45..7d6ffd3 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/BlockComponentProvider.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/BlockComponentProvider.java @@ -7,7 +7,7 @@ import mcp.mobius.waila.api.IBlockComponentProvider; import mcp.mobius.waila.api.IPluginConfig; import mcp.mobius.waila.api.ITooltip; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public abstract class BlockComponentProvider implements IBlockComponentProvider { @@ -20,7 +20,7 @@ protected BlockComponentProvider(Supplier baseConfig) { protected abstract void append(ITooltip tooltip, IBlockAccessor accessor); private void appendInternal(ITooltip tooltip, IBlockAccessor accessor) { - if (baseConfig.get().isEnabled() && !baseConfig.get().getBlacklist().contains(Registry.BLOCK.getId(accessor.getBlock()))) { + if (baseConfig.get().isEnabled() && !baseConfig.get().getBlacklist().contains(Registries.BLOCK.getId(accessor.getBlock()))) { append(tooltip, accessor); } } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/EnergyComponentProvider.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/EnergyComponentProvider.java index 1cb7bb1..6255fb6 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/EnergyComponentProvider.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/EnergyComponentProvider.java @@ -14,8 +14,8 @@ import mcp.mobius.waila.api.component.PairComponent; import mcp.mobius.waila.api.component.WrappedComponent; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.text.Text; -import net.minecraft.util.registry.Registry; import static lol.bai.megane.runtime.util.Keys.E_HAS; import static lol.bai.megane.runtime.util.Keys.E_MAX; @@ -47,10 +47,10 @@ protected void append(ITooltip tooltip, IBlockAccessor accessor) { String key; List providers = Registrar.ENERGY_INFO.get(accessor.getBlockEntity()); if (providers.isEmpty()) { - key = Registry.BLOCK.getId(accessor.getBlock()).getNamespace(); + key = Registries.BLOCK.getId(accessor.getBlock()).getNamespace(); providers = Registrar.ENERGY_INFO.get(key); } else { - key = Registry.BLOCK_ENTITY_TYPE.getId(accessor.getBlockEntity().getType()).toString(); + key = Registries.BLOCK_ENTITY_TYPE.getId(accessor.getBlockEntity().getType()).toString(); } boolean expand = accessor.getPlayer().isSneaking() && energy.isExpandWhenSneak(); diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/FluidComponentProvider.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/FluidComponentProvider.java index 6fbedcf..77af521 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/FluidComponentProvider.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/block/FluidComponentProvider.java @@ -12,9 +12,9 @@ import mcp.mobius.waila.api.component.WrappedComponent; import net.minecraft.fluid.Fluid; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -71,7 +71,7 @@ protected void append(ITooltip tooltip, IBlockAccessor accessor) { if (stored == 0) continue; double max = data.getDouble(F_MAX + i); - Fluid fluid = Registry.FLUID.get(data.getInt(F_ID + i)); + Fluid fluid = Registries.FLUID.get(data.getInt(F_ID + i)); NbtCompound nbt = data.contains(F_NBT) ? data.getCompound(F_NBT) : null; addFluid(tooltip, accessor, fluid, nbt, stored, max); } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/entity/EntityComponentProvider.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/entity/EntityComponentProvider.java index 3776d26..2c95323 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/entity/EntityComponentProvider.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/provider/entity/EntityComponentProvider.java @@ -7,7 +7,7 @@ import mcp.mobius.waila.api.IEntityComponentProvider; import mcp.mobius.waila.api.IPluginConfig; import mcp.mobius.waila.api.ITooltip; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public abstract class EntityComponentProvider implements IEntityComponentProvider { @@ -20,7 +20,7 @@ protected EntityComponentProvider(Supplier baseConfig) { abstract void append(ITooltip tooltip, IEntityAccessor accessor); private void appendInternal(ITooltip tooltip, IEntityAccessor accessor) { - if (baseConfig.get().isEnabled() && !baseConfig.get().getBlacklist().contains(Registry.ENTITY_TYPE.getId(accessor.getEntity().getType()))) { + if (baseConfig.get().isEnabled() && !baseConfig.get().getBlacklist().contains(Registries.ENTITY_TYPE.getId(accessor.getEntity().getType()))) { append(tooltip, accessor); } } diff --git a/module-base/runtime/src/main/java/lol/bai/megane/runtime/util/MeganeUtils.java b/module-base/runtime/src/main/java/lol/bai/megane/runtime/util/MeganeUtils.java index dcaaf2f..3faea8e 100644 --- a/module-base/runtime/src/main/java/lol/bai/megane/runtime/util/MeganeUtils.java +++ b/module-base/runtime/src/main/java/lol/bai/megane/runtime/util/MeganeUtils.java @@ -25,9 +25,9 @@ import net.minecraft.fluid.Fluid; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -104,7 +104,7 @@ public static void reloadConfig() { @Environment(EnvType.CLIENT) public static Text fluidName(Fluid fluid) { - Identifier id = Registry.FLUID.getId(fluid); + Identifier id = Registries.FLUID.getId(fluid); return Text.translatable("block." + id.getNamespace() + "." + id.getPath()); } @@ -117,7 +117,7 @@ public static void drawTexture( matrices.push(); RenderSystem.enableBlend(); - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); + RenderSystem.setShader(GameRenderer::getPositionColorTexProgram); RenderSystem.setShaderTexture(0, id); int a = 0xFF; diff --git a/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestItemProvider.java b/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestItemProvider.java index d516e18..eef36a4 100644 --- a/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestItemProvider.java +++ b/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestItemProvider.java @@ -4,8 +4,8 @@ import net.minecraft.block.entity.ChestBlockEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import org.jetbrains.annotations.NotNull; public class TestItemProvider extends ItemProvider { @@ -19,7 +19,7 @@ public int getSlotCount() { @Override public @NotNull ItemStack getStack(int slot) { - return slot == 0 ? NOT_RANDOM_STACK : new ItemStack(Registry.ITEM.getRandom(getWorld().random).map(RegistryEntry::value).orElse(Items.ACACIA_BOAT)); + return slot == 0 ? NOT_RANDOM_STACK : new ItemStack(Registries.ITEM.getRandom(getWorld().random).map(RegistryEntry.Reference::value).orElse(Items.ACACIA_BOAT)); } } diff --git a/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestProgressProvider.java b/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestProgressProvider.java index c20b26b..72285d0 100644 --- a/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestProgressProvider.java +++ b/module-base/test/src/main/java/lol/bai/megane/module/test/provider/TestProgressProvider.java @@ -4,8 +4,8 @@ import net.minecraft.block.entity.ChestBlockEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import org.jetbrains.annotations.NotNull; public class TestProgressProvider extends SlotArrayProgressProvider { @@ -25,7 +25,7 @@ protected int[] getOutputSlots() { @Override protected @NotNull ItemStack getStack(int slot) { - return new ItemStack(Registry.ITEM.getRandom(getWorld().random).map(RegistryEntry::value).orElse(Items.ACACIA_BOAT)); + return new ItemStack(Registries.ITEM.getRandom(getWorld().random).map(RegistryEntry.Reference::value).orElse(Items.ACACIA_BOAT)); } @Override diff --git a/module-compat/applied-energistics-2/src/main/java/lol/bai/megane/module/ae2/mixin/MixinPowerStorageDataProvider.java b/module-compat/applied-energistics-2/src/main/java/lol/bai/megane/module/ae2/mixin/MixinPowerStorageDataProvider.java deleted file mode 100644 index 58d71e0..0000000 --- a/module-compat/applied-energistics-2/src/main/java/lol/bai/megane/module/ae2/mixin/MixinPowerStorageDataProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -package lol.bai.megane.module.ae2.mixin; - -import appeng.api.integrations.igtooltip.TooltipBuilder; -import appeng.api.integrations.igtooltip.TooltipContext; -import appeng.integration.modules.igtooltip.blocks.PowerStorageDataProvider; -import net.minecraft.block.entity.BlockEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Unique; - -@SuppressWarnings("UnstableApiUsage") -@Mixin(PowerStorageDataProvider.class) -public class MixinPowerStorageDataProvider { - - @Unique - private static final Logger LOGGER = LoggerFactory.getLogger("MixinPowerStorageDataProvider"); - - @Unique - private static boolean firstCall = true; - - /** - * @author deirn - * @reason Remove AE2's own energy tooltip, since megane provides it - */ - @Overwrite - public void buildTooltip(BlockEntity object, TooltipContext context, TooltipBuilder tooltip) { - if (firstCall) { - firstCall = false; - LOGGER.info("[Megane] Replaced AE2's own energy tooltip with Megane's"); - } - } - -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 76cfb54..3fefb8d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,18 +16,18 @@ base("test") compat("alloy-forgery") compat("applied-energistics-2") -compat("create") -compat("deep-mob-learning-simulacrum") -compat("extra-generators") +//compat("create") +//compat("deep-mob-learning-simulacrum") +//compat("extra-generators") compat("fabric-transfer") -compat("industrial-revolution") -compat("kibe") +//compat("industrial-revolution") +//compat("kibe") //compat("lib-block-attributes") -compat("luggage") -compat("modern-dynamics") -compat("powah") +//compat("luggage") +//compat("modern-dynamics") +//compat("powah") compat("reborn-core") compat("reborn-energy") compat("tech-reborn") compat("vanilla") -compat("wireless-networks") +//compat("wireless-networks")