Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert from ASM to Mixins #2192

Merged
merged 46 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
183010b
Change some ASM to Mixins
ALongStringOfNumbers Jul 22, 2023
c092ec8
In progress
ALongStringOfNumbers Jul 22, 2023
0dd66ac
More Conversions
ALongStringOfNumbers Jul 22, 2023
7e94841
Another conversion, needs testing
ALongStringOfNumbers Jul 22, 2023
c804947
continue work
ALongStringOfNumbers Jul 30, 2023
76c67b8
More work
ALongStringOfNumbers Oct 30, 2023
3f02f7f
In progress work
ALongStringOfNumbers Nov 15, 2023
6887973
possibly working RecipeRepairItemMixin
serenibyss Nov 24, 2023
4a2d5a1
Remove NC Mixin/ASM, as our compat is more broken than what is being …
ALongStringOfNumbers Nov 24, 2023
8be86ed
Some Fixes
ALongStringOfNumbers Nov 24, 2023
2f7ce68
Compile
ALongStringOfNumbers Nov 25, 2023
a7cd3c9
Fix Rebase issues and spotless
ALongStringOfNumbers Nov 30, 2023
67b0f1b
1 spotless isn't enough apparently
ALongStringOfNumbers Nov 30, 2023
7e99118
another one down
ALongStringOfNumbers Nov 30, 2023
385deaa
spotless
serenibyss Dec 4, 2023
ef43ef3
Rebase fixes
ALongStringOfNumbers Dec 4, 2023
8a66b63
Another one down
ALongStringOfNumbers Dec 7, 2023
c2426ff
CTM mixins
ALongStringOfNumbers Dec 13, 2023
fd06dfb
Fix RenderChunkMixin, needs verification
ALongStringOfNumbers Dec 14, 2023
7b78eb3
Some cleanup
ALongStringOfNumbers Dec 19, 2023
1c8ed6f
Fix JEI Mixin
ALongStringOfNumbers Dec 21, 2023
f15f673
Remove overwrite
ALongStringOfNumbers Jan 1, 2024
8903d8b
Fix CTM mixin
ALongStringOfNumbers Jan 9, 2024
88cda82
Specify ordinal
ALongStringOfNumbers Jan 9, 2024
510c2d3
Spotless
ALongStringOfNumbers Jan 14, 2024
4576844
Hopefully everything?
ALongStringOfNumbers Jan 15, 2024
0a3a632
Should Fix Special Armor mixin
ALongStringOfNumbers Jan 29, 2024
8d1b586
Switch to new Mod loaded checks
ALongStringOfNumbers Feb 6, 2024
e93367a
In progress fixes, doesn't all work yet
ALongStringOfNumbers Feb 23, 2024
d160a65
Fix up rebase
ALongStringOfNumbers Feb 25, 2024
37f7c08
Non-deprecated wrap
ALongStringOfNumbers Feb 25, 2024
82a2948
Some fixes, specify ordinals
ALongStringOfNumbers Feb 25, 2024
98b8f4e
fix RecipeRepairItemMixin
ghzdude Feb 25, 2024
efdb299
combine two mixins into one
ghzdude Feb 25, 2024
90e3e96
spotless
ghzdude Mar 9, 2024
458edf2
Spotless
ALongStringOfNumbers May 5, 2024
124369c
convert vintigium asm into mixin
ghzdude Jun 11, 2024
6523f5b
remove AT target for manager mixin
ghzdude Jun 11, 2024
50333f1
a
ghzdude Jun 11, 2024
fd0ca7e
Fix lang
ALongStringOfNumbers Jun 11, 2024
e06da75
Remove outdated TODOs
ALongStringOfNumbers Jun 11, 2024
57a2c66
back to compileOnly
ghzdude Jun 18, 2024
424aaf0
make fields mutable and modify in static init
ghzdude Jun 18, 2024
31d39c8
spotless weee
ghzdude Jun 18, 2024
4b02bc5
remove interface accessor
ghzdude Jun 19, 2024
174cb14
some clean up + javadoc
ghzdude Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions addon.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

minecraft {
injectedTags.put('DEP_VERSION_STRING', "required-after:gregtech@[${modVersion},);")
}

configurations {
compileOnly {
// exclude GNU trove, FastUtil is superior and still updated
exclude group: "net.sf.trove4j", module: "trove4j"
// exclude javax.annotation from findbugs, jetbrains annotations are superior
exclude group: "com.google.code.findbugs", module: "jsr305"
// exclude scala as we don't use it for anything and causes import confusion
exclude group: "org.scala-lang"
exclude group: "org.scala-lang.modules"
exclude group: "org.scala-lang.plugins"
}
}


21 changes: 4 additions & 17 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ dependencies {
dest: "libs")
compileOnly(files("libs/vintagium-mc1.12.2-0.1-dev.jar"))

compileOnly rfg.deobf("curse.maven:littletiles-257818:4750222") // LittleTiles 1.5.82-1.12.2
compileOnly rfg.deobf("curse.maven:creativecore-257814:4722163") // Creative Core 1.10.71


// Mods with Soft compat but which have no need to be in code, such as isModLoaded() checks and getModItem() recipes.
// Uncomment any of these to test them in-game.

Expand All @@ -79,20 +83,3 @@ dependencies {
// runtimeOnlyNonPublishable rfg.deobf("curse.maven:gendustry-70492:2516215") // Gendustry 1.6.5.8
// runtimeOnlyNonPublishable rfg.deobf("curse.maven:bdlib-70496:2518031") // BdLib 1.14.3.12
}

minecraft {
injectedTags.put('DEP_VERSION_STRING', "required-after:gregtech@[${modVersion},);")
}

configurations {
compileOnly {
// exclude GNU trove, FastUtil is superior and still updated
exclude group: "net.sf.trove4j", module: "trove4j"
// exclude javax.annotation from findbugs, jetbrains annotations are superior
exclude group: "com.google.code.findbugs", module: "jsr305"
// exclude scala as we don't use it for anything and causes import confusion
exclude group: "org.scala-lang"
exclude group: "org.scala-lang.modules"
exclude group: "org.scala-lang.plugins"
}
}
18 changes: 7 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,25 @@ useSrcApiPath=false
accessTransformersFile = gregtech_at.cfg

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
usesMixins = true
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
mixinsPackage = mixins
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
generateMixinConfig=false
generateMixinConfig = false
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = asm.GregTechLoadingPlugin
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false

containsMixinsAndOrCoreModOnly=false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = true

forceEnableMixins=false
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
# diff to see exactly what your ASM or Mixins are changing in the target file.
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
enableCoreModDebug = false

enableCoreModDebug=false
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
includeWellKnownRepositories = true

includeWellKnownRepositories=true
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
# be available at compiletime and runtime for your mod (in-game and in-code).
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
Expand Down

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import gregtech.api.GregTechAPI;
import gregtech.api.modules.ModuleContainerRegistryEvent;
import gregtech.api.persistence.PersistentData;
import gregtech.api.util.Mods;
import gregtech.client.utils.BloomEffectUtil;
import gregtech.client.utils.BloomEffectVintagiumUtil;
import gregtech.modules.GregTechModules;
import gregtech.modules.ModuleManager;

Expand Down Expand Up @@ -48,9 +46,6 @@ public GregTechMod() {
FluidRegistry.enableUniversalBucket();
if (FMLCommonHandler.instance().getSide().isClient()) {
BloomEffectUtil.init();
if (Mods.Vintagium.isModLoaded()) {
BloomEffectVintagiumUtil.init();
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ public class GTValues {
MODID_PROJRED_CORE = "projectred-core",
MODID_RC = "railcraft",
MODID_CHISEL = "chisel",
MODID_RS = "refinedstorage";
MODID_RS = "refinedstorage",
MODID_LITTLETILES = "littletiles";

private static Boolean isClient;

Expand Down
10 changes: 2 additions & 8 deletions src/main/java/gregtech/api/damagesources/DamageSources.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,17 @@ public static DamageSource getTurbineDamage() {
return TURBINE;
}

// accessed via ASM
@SuppressWarnings("unused")
public static DamageSource getPlayerDamage(@Nullable EntityPlayer source) {
ItemStack stack = source != null ? source.getHeldItemMainhand() : ItemStack.EMPTY;
if (!stack.isEmpty() && stack.getItem() instanceof IGTTool) {
IGTTool tool = (IGTTool) stack.getItem();
if (!stack.isEmpty() && stack.getItem() instanceof IGTTool tool) {
return new DamageSourceTool("player", source, String.format("death.attack.%s", tool.getToolId()));
}
return new EntityDamageSource("player", source);
}

// accessed via ASM
@SuppressWarnings("unused")
public static DamageSource getMobDamage(@Nullable EntityLivingBase source) {
ItemStack stack = source != null ? source.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND) : ItemStack.EMPTY;
if (!stack.isEmpty() && stack.getItem() instanceof IGTTool) {
IGTTool tool = (IGTTool) stack.getItem();
if (!stack.isEmpty() && stack.getItem() instanceof IGTTool tool) {
return new DamageSourceTool("mob", source, String.format("death.attack.%s", tool.getToolId()));
}
return new EntityDamageSource("mob", source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public SoundEvent getSound() {
return sound;
}

public String getName() {
return sound.getSoundName().getPath();
}

@Override
public ActionResult<ItemStack> onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gregtech/api/util/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public enum Mods {
InventoryTweaks(Names.INVENTORY_TWEAKS),
JourneyMap(Names.JOURNEY_MAP),
JustEnoughItems(Names.JUST_ENOUGH_ITEMS),
LittleTiles(Names.LITTLE_TILES),
MagicBees(Names.MAGIC_BEES),
Nothirium(Names.NOTHIRIUM),
NuclearCraft(Names.NUCLEAR_CRAFT, versionExcludes("2o")),
Expand Down Expand Up @@ -124,6 +125,7 @@ public static class Names {
public static final String INVENTORY_TWEAKS = "inventorytweaks";
public static final String JOURNEY_MAP = "journeymap";
public static final String JUST_ENOUGH_ITEMS = "jei";
public static final String LITTLE_TILES = "littletiles";
public static final String MAGIC_BEES = "magicbees";
public static final String NOTHIRIUM = "nothirium";
public static final String NUCLEAR_CRAFT = "nuclearcraft";
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/gregtech/asm/GregTechLoadingPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;

import org.jetbrains.annotations.Nullable;
import zone.rong.mixinbooter.IEarlyMixinLoader;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Name("GregTechLoadingPlugin")
@MCVersion(ForgeVersion.mcVersion)
@TransformerExclusions("gregtech.asm.")
@SortingIndex(1001)
public class GregTechLoadingPlugin implements IFMLLoadingPlugin {
// TODO, move to mixin package
public class GregTechLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader {

@Override
public String[] getASMTransformerClass() {
Expand All @@ -40,4 +44,19 @@ public void injectData(Map<String, Object> data) {}
public String getAccessTransformerClass() {
return null;
}

@Override
public List<String> getMixinConfigs() {
List<String> configs = new ArrayList<>();

configs.add("mixins.gregtech.forge.json");
configs.add("mixins.gregtech.minecraft.json");

return configs;
}

@Override
public boolean shouldMixinConfigQueue(String mixinConfig) {
return IEarlyMixinLoader.super.shouldMixinConfigQueue(mixinConfig);
}
}
Loading
Loading