mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-27 23:45:36 +00:00
enabling hold-click mechanic for drawers (not working due to incorrect mixin target qualification)
This commit is contained in:
1 parent
7d878e15b8
commit
8fe25059b2
5 files changed
+145
-4
No files matched your search
+4
-4
@@ -83,7 +83,7 @@ apiPackage = api
|
||||
accessTransformersFile =
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
usesMixins = true
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
@@ -91,7 +91,7 @@ usesMixins = false
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
usesMixinDebug = true
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
@@ -99,12 +99,12 @@ mixinPlugin =
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
mixinsPackage = mixins
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
coreModClass = mixins.EarlyMixinsLoader
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.mixins;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.mixins.Mixins;
|
||||
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
|
||||
import com.gtnewhorizon.gtnhmixins.builders.IMixins;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
public class EarlyMixinsLoader implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModContainerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSetupClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectData(Map<String, Object> data) {}
|
||||
|
||||
@Override
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixinConfig() {
|
||||
// rename the associated .json file by replacing the "mymodid" with your own mod ID
|
||||
// in the .json file edit the "package" and "refmap" properties to match your mod
|
||||
// also edit the "refmap" property in the "mixins.mymodid.json" file
|
||||
return "mixins.storagedrawers.early.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins(Set<String> loadedCoreMods) {
|
||||
return IMixins.getEarlyMixins(Mixins.class, loadedCoreMods);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.mixins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.gtnewhorizon.gtnhmixins.builders.IMixins;
|
||||
import com.gtnewhorizon.gtnhmixins.builders.MixinBuilder;
|
||||
|
||||
public enum Mixins implements IMixins {
|
||||
|
||||
// Read the java doc of IMixins and MixinBuilder for further information
|
||||
|
||||
// You should declare all of your mixins early and late in this same enum
|
||||
|
||||
EXAMPLE(new MixinBuilder().setPhase(Phase.EARLY).addClientMixins("MixinPlayerControllerMP"));
|
||||
|
||||
private final MixinBuilder builder;
|
||||
|
||||
Mixins(MixinBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MixinBuilder getBuilder() {
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.mixins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.gtnewhorizon.gtnhmixins.builders.ITargetMod;
|
||||
import com.gtnewhorizon.gtnhmixins.builders.TargetModBuilder;
|
||||
|
||||
public enum TargetMods implements ITargetMod {
|
||||
|
||||
// Read the java doc of ITargetMod and TargetModBuilder for further information
|
||||
|
||||
// Add to this enum information about the mods you need to identify during runtime
|
||||
|
||||
COFHCORE("cofh.asm.LoadingPlugin", "CoFHCore"),
|
||||
OPTIFINE("optifine.OptiFineForgeTweaker", "Optifine");
|
||||
|
||||
private final TargetModBuilder builder;
|
||||
|
||||
TargetMods(String coreModClass, String modId) {
|
||||
this.builder = new TargetModBuilder().setCoreModClass(coreModClass).setModId(modId);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TargetModBuilder getBuilder() {
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.mixins.early;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
|
||||
@Mixin(PlayerControllerMP.class)
|
||||
public abstract class MixinPlayerControllerMP {
|
||||
|
||||
@Shadow
|
||||
private float curBlockDamageMP;
|
||||
|
||||
@ModifyExpressionValue(
|
||||
method = "clickBlock",
|
||||
at = @At(value = "INVOKE", target = "Ltarget/Class;curBlockDamageMPZ"))
|
||||
|
||||
private boolean withClickOnDrawer(boolean original, @Local Minecraft mc, @Local int x, @Local int y, @Local int z,
|
||||
@Local int side) {
|
||||
if (mc.theWorld.getTileEntity(x, y, z) instanceof TileEntityDrawers) {
|
||||
TileEntityDrawers ted = (TileEntityDrawers) mc.theWorld.getTileEntity(x, y, z);
|
||||
if (ted.getDirection() == side) {
|
||||
curBlockDamageMP = 0.0F;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return original;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user