Skip to content

Commit

Permalink
Fix known tracker issues from #135
Browse files Browse the repository at this point in the history
Enabled debug verbose again
  • Loading branch information
Eufranio committed Feb 18, 2018
1 parent a85dd83 commit 5ad2a85
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 4 deletions.
26 changes: 26 additions & 0 deletions src/main/java/net/heyzeer0/mgh/mixins/ae2/MixinTickHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.heyzeer0.mgh.mixins.ae2;

import appeng.hooks.TickHandler;
import appeng.util.IWorldCallable;
import net.heyzeer0.mgh.MagiHandlers;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

/**
* Created by Frani on 18/02/2018.
*/
@Mixin(value = TickHandler.class, remap = false)
public abstract class MixinTickHandler {

@Redirect(method = "processQueue", at = @At(value = "INVOKE", target = "Lappeng/util/IWorldCallable;call(Lnet/minecraft/world/World;)Ljava/lang/Object;"))
private Object redirectCall(IWorldCallable c, World world) throws Exception {
final boolean isIgnoring = MagiHandlers.getStack().ignorePhase;
MagiHandlers.getStack().ignorePhase = true;
Object r = c.call(world);
MagiHandlers.getStack().ignorePhase = isIgnoring;
return r;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.heyzeer0.mgh.mixins.forestry;

import forestry.api.farming.IFarmHousing;
import forestry.farming.tiles.TileFarmGearbox;
import net.heyzeer0.mgh.MagiHandlers;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

/**
* Created by Frani on 18/02/2018.
*/
@Mixin(value = TileFarmGearbox.class, remap = false)
public abstract class MixinTileFarmGearbox {

@Redirect(method = "updateServer", at = @At(value = "INVOKE", target = "Lforestry/api/farming/IFarmHousing;doWork()Z"))
private boolean redirectDoWork(IFarmHousing instance) {
MagiHandlers.getStack().push(instance);
boolean value = instance.doWork();
MagiHandlers.getStack().remove(instance);
return value;
}

}
4 changes: 2 additions & 2 deletions src/main/java/net/heyzeer0/mgh/mixins/forge/MixinWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ private void onSetBlockHead(int x, int y, int z, Block newBlock, int meta, int f
if (!MagiHandlers.getStack().isIgnoringPhase()) {
EntityPlayer owner = MagiHandlers.getStack().getCurrentEntityPlayer().orElse(null);
if (owner == null) {
//MagiHandlers.log("Something is trying to set a block without an owner, stack: ");
//Thread.dumpStack();
MagiHandlers.log("Something is trying to set a block without an owner, stack: ");
Thread.dumpStack();
return;
}
if (!MixinManager.canBuild(x, y, z, (World) (Object) this, owner)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.heyzeer0.mgh.mixins.ic2;

import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventBus;
import ic2.core.block.machine.tileentity.TileEntityElectricMachine;
import net.heyzeer0.mgh.MagiHandlers;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

/**
* Created by Frani on 18/02/2018.
*/
@Mixin(value = TileEntityElectricMachine.class, remap = false)
public abstract class MixinTileEntityElectricMachine {

@Redirect(method = "onLoaded", at = @At(value = "INVOKE", target = "Lcpw/mods/fml/common/eventhandler/EventBus;post(Lcpw/mods/fml/common/eventhandler/Event;)Z"))
private boolean onPost(EventBus bus, Event toPost) {
MagiHandlers.getStack().push(this);
boolean r = bus.post(toPost);
MagiHandlers.getStack().remove(this);
return r;
}

@Redirect(method = "onUnloaded", at = @At(value = "INVOKE", target = "Lcpw/mods/fml/common/eventhandler/EventBus;post(Lcpw/mods/fml/common/eventhandler/Event;)Z"))
private boolean onPostUnload(EventBus bus, Event toPost) {
MagiHandlers.getStack().push(this);
boolean r = bus.post(toPost);
MagiHandlers.getStack().remove(this);
return r;
}

}
5 changes: 5 additions & 0 deletions src/main/resources/mixin-patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,10 @@
"name": "Applied Energistics 2",
"file": "ae2.jar",
"mixin": "mixins/mixin-ae2.json"
},
{
"name": "Forestry",
"file": "forestry_1.7.10-4.2.16.64.jar",
"mixin": "mixins/mixin-forestry.json"
}
]
3 changes: 2 additions & 1 deletion src/main/resources/mixins/mixin-ae2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"package": "net.heyzeer0.mgh.mixins.ae2",
"mixins": [
"MixinPartFormationPlane",
"MixinPartAnnihilationPlane"
"MixinPartAnnihilationPlane",
"MixinTickHandler"
],
"server": [],
"client": [],
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/mixins/mixin-forestry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"required": true,
"package": "net.heyzeer0.mgh.mixins.forestry",
"mixins": [
"MixinTileFarmGearbox"
],
"server": [],
"client": [],
"compatibilityLevel": "JAVA_8",
"refmap": "mixin.magihandlers.refmap.json"
}
3 changes: 2 additions & 1 deletion src/main/resources/mixins/mixin-ic2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"mixins":[
"MixinTileEntityTerra",
"MixinEntityMiningLaser",
"MixinEntityIC2Explosive"
"MixinEntityIC2Explosive",
"MixinTileEntityElectricMachine"
],
"server": [],
"client": [],
Expand Down

0 comments on commit 5ad2a85

Please sign in to comment.