Closed yandhi closed 5 years ago
give the code. you are loading entity class in coremod/tweaker code, which is not mixin's fault
My MixinEntity class appears as so:
@Mixin(Entity.class)
public abstract class MixinEntity {
@Shadow
public double posX;
@Shadow
public double posY;
@Shadow
public double posZ;
@Shadow
public double motionX;
@Shadow
public double motionZ;
@Shadow
public float rotationYaw;
@Shadow
public float rotationPitch;
@Shadow
public boolean onGround;
@Shadow
public World world;
private Angle rotations;
@Shadow
public abstract boolean isSprinting();
@Shadow
public abstract boolean isRiding();
@Shadow
public abstract boolean isSneaking();
@Shadow
public void move(MoverType type, double x, double y, double z) {}
public Angle getRotations() {
if (rotations == null)
rotations = new Angle(0, 0);
return rotations.setYaw(rotationYaw).setPitch(rotationPitch);
}
}
My Tweaker looks like so:
public class UziTweaker implements ITweaker {
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) { }
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
MixinBootstrap.init();
Mixins.addConfiguration("mixins.uzi.json");
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
}
@Override
public String getLaunchTarget() {
return "net.minecraft.client.main.Main";
}
@Override
public String[] getLaunchArguments() {
return new String[0];
}
}
What......what is the point of the tweaker? If you're using Forge for your project (which it looks like you are), all you would need is to create an FML Loading Plugin for initializing your mixins and let Mixins and Forge handle the rest. Realistically, without seeing more code, we can't help too much unless we know the circumstances of what you're trying to do.
If you're just making a Forge mod, then get rid of the tweaker. There's no need for that, and an FML plugin works perfectly fine, maybe a MixinConfigPlugin if needed. For a better idea, take a look at the way VanillaFix handles Mixins and a MixinConfigPlugin.
Hmm, if you can link to the project, I may help more, as I spotted nowhere where you might have classloaded Entity too early yet.
On a side note, your public Angle getRotations()
method declared in your mixin cannot be called unless you call it via reflection. You should make the mixin class implement an interface that exposes Angle getRotations()
method.
Since you are not willing to provide the actual code then we can't really help you further. You are violating the coremod contract by classloading a game class during PREINIT but without your codebase we can't tell you where. This is not a bug in mixin so closing as invalid. If you are willing to post your codebase then you can continue to discuss the problem here but I'm closing this issue since this is a bug tracker not a support forum.
I should also point out that the documentation explicitly and exhaustively explains bootstrapping mixin and at no point does it say to create a tweaker. In fact it expressly mentions using Mixin's own tweaker because this is used as a marker to allow discovery of other mixin containers, using a different tweaker will immediately break this functionality.
Okay, Thanks for the help guys. Even though my issue was invalid, reading up on the documentation that Mumfrey posted helped a lot. I managed to get it working in a production environment. As for a testing environment, I should be able to fix it for their as well. Thanks guys!
Hi, I know this issue has been reported twice already. However, tested on both me and a co-developers workstations, this problem persists. Basically the client believes there are two instances of Entity. For past reference, at one point this very project source and code worked perfectly fine. I also made a test project for 1.12.2 with a simple initialization call and it also produces the same problem.
As I do not know if this is possible to fix, just please keep me up to date.
Thanks in advance, Kix.
The Console output for this problem is below: