Skip to content

Commit

Permalink
Hide stacktraces until current ones be fixed (#142)
Browse files Browse the repository at this point in the history
Added a bit of debug to Chemical Thrower. I'll remove it once I have some time to test
Fix Progressive Automation duplication bug, closes #143
Fix WorldEdit Forge unexpected cast... workaround until AsyncWorldEdit isn't out and FAWE is broken
Update Mixin
  • Loading branch information
Eufranio committed Mar 18, 2018
1 parent a28784d commit 1baa5ff
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ repositories {
}

dependencies {
shade("org.spongepowered:mixin:0.6.11-SNAPSHOT"){
shade("org.spongepowered:mixin:0.7.1-SNAPSHOT"){
exclude module: 'launchwrapper'
exclude module: 'guava'
}
Expand Down
Binary file added lib/worldedit-forge-mc1.7.10-6.1.1-dist(1).jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/net/heyzeer0/mgh/MagiCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class MagiCore implements IFMLLoadingPlugin {
public static PathLoader loader = new PathLoader();

public MagiCore() {
System.setProperty("mixin.debug", "true");
System.setProperty("mixin.debug.export", "true");
MixinBootstrap.init();

LogManager.getLogger().warn(" ");
Expand Down
3 changes: 2 additions & 1 deletion 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,9 @@ 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();
Thread.dumpStack();*/
return;
}
if (!MixinManager.canBuild(x, y, z, (World) (Object) this, owner)) {
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/net/heyzeer0/mgh/mixins/ie/MixinItemChemthrower.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.heyzeer0.mgh.mixins.ie;

import blusunrize.immersiveengineering.common.items.ItemChemthrower;
import net.heyzeer0.mgh.MagiHandlers;
import net.heyzeer0.mgh.api.forge.IForgeEntity;
import net.minecraft.entity.Entity;
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 17/03/2018.
*/
@Mixin(value = ItemChemthrower.class, remap = false)
public abstract class MixinItemChemthrower {

@Redirect(method = "onUsingTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntityInWorld(Lnet/minecraft/entity/Entity;)Z"))
private boolean redirectSpawnEntity(World world, Entity entity) {
boolean r = world.spawnEntityInWorld(entity);
MagiHandlers.log("chemtrower entity owner: " + ((IForgeEntity) entity).getMHOwner().getCommandSenderName());
return r;
}

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

import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

/**
* Created by Frani on 17/03/2018.
*/
@Pseudo
@Mixin(targets = "com/vanhal/progressiveautomation/util/OreHelper", remap = false)
public abstract class MixinOreHelper {

@Inject(method = "ItemOreMatch", at = @At(value = "RETURN", ordinal = 0), cancellable = true)
private static void onReturn(ItemStack stackA, ItemStack stackB, CallbackInfoReturnable<Boolean> cir) {
if (!ItemStack.areItemStackTagsEqual(stackA, stackB)) cir.setReturnValue(false);
}

@Inject(method = "ItemOreMatch", at = @At(value = "RETURN", ordinal = 3), cancellable = true)
private static void onReturn2(ItemStack stackA, ItemStack stackB, CallbackInfoReturnable<Boolean> cir) {
if (!ItemStack.areItemStackTagsEqual(stackA, stackB)) cir.setReturnValue(false);
}


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

import com.google.common.collect.Sets;
import com.sk89q.worldedit.forge.ForgeWorld;
import org.bukkit.craftbukkit.v1_7_R4.util.LongHashSet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.lang.reflect.Field;
import java.util.Set;

/**
* Created by Frani on 17/03/2018.
*/
@Mixin(value = ForgeWorld.class, remap = false)
public abstract class MixinForgeWorld {

private LongHashSet longHashSet;

@Redirect(method = "regenerate", at = @At(value = "INVOKE", target = "Ljava/lang/reflect/Field;get(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0))
private Object redirectGet(Field instance, Object otherObj) {
try {
longHashSet = (LongHashSet) instance.get(otherObj);
return Sets.newHashSet(longHashSet.toArray());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

@Redirect(method = "regenerate", at = @At(value = "INVOKE", target = "Ljava/util/Set;remove(Ljava/lang/Object;)Z"))
private boolean redirectRemove(Set set, Object obj) {
return longHashSet.remove((Long) obj);
}

}
5 changes: 5 additions & 0 deletions src/main/resources/mixin-patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,10 @@
"name": "Wireless Redstone",
"file": "WR-CBE-1.7.10-1.4.1.9-universal.jar",
"mixin": "mixins/mixin-wrcbe.json"
},
{
"name": "WorldEdit",
"file": "worldedit-forge-mc1.7.10-6.1.1-dist.jar",
"mixin": "mixins/mixin-worldedit.json"
}
]
3 changes: 2 additions & 1 deletion src/main/resources/mixins/mixin-ie.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"required": true,
"package":"net.heyzeer0.mgh.mixins.ie",
"mixins":[
"MixinImmersiveEngineering"
"MixinImmersiveEngineering",
"MixinItemChemthrower"
],
"server": [],
"client": [],
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/mixins/mixin-progressiveautomation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"required": true,
"package":"net.heyzeer0.mgh.mixins.progressiveauto",
"mixins":[
"MixinTileMiner"
"MixinTileMiner",
"MixinOreHelper"
],
"server": [],
"client": [],
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/mixins/mixin-worldedit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"required": true,
"package": "net.heyzeer0.mgh.mixins.worldedit",
"mixins": [
"MixinForgeWorld"
],
"server": [],
"client": [],
"compatibilityLevel": "JAVA_8",
"refmap": "mixin.magihandlers.refmap.json"
}

0 comments on commit 1baa5ff

Please sign in to comment.