Skip to content

Commit

Permalink
Cancel IItemHandlerFabric::setIItemHandlerStack
Browse files Browse the repository at this point in the history
  • Loading branch information
LXGaming committed Sep 22, 2018
1 parent e5c6b44 commit 16f867b
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 64 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ targetCompatibility = 1.8

group = "io.github.lxgaming"
archivesBaseName = "Sledgehammer"
version = "1.12.2-1.2.10"
version = "1.12.2-1.2.11"

minecraft {
version = "1.12.2-14.23.4.2705"
Expand Down Expand Up @@ -70,6 +70,8 @@ dependencies {
exclude(module: "guava")
exclude(module: "launchwrapper")
}
provided("org.spongepowered:spongeforge:1.12.2-2705-7.1.0-BETA-3361:dev")
provided("org.spongepowered:spongevanilla:1.12.2-7.1.0-BETA-59:dev")
provided("primalcore:PrimalCore:1.12.2:0.6.51")
}

Expand All @@ -78,7 +80,7 @@ jar {
attributes(
"FMLCorePluginContainsFMLMod": true,
"ForceLoadAsMod": true,
"MixinConfigs": "mixins.sledgehammer.core.json,mixins.sledgehammer.forge.json,mixins.sledgehammer.sponge.json",
"MixinConfigs": "mixins.sledgehammer.core.json,mixins.sledgehammer.forge.json,mixins.sledgehammer.spongeforge.json,mixins.sledgehammer.spongevanilla.json",
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": 0
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ private void registerMappings() {
getMixinMappings().put("io.github.lxgaming.sledgehammer.mixin.forge.entity.passive.MixinEntityVillager", MixinCategory::isTravelingMerchant);
getMixinMappings().put("io.github.lxgaming.sledgehammer.mixin.forge.world.storage.MixinWorldInfo", MixinCategory::isCeremonyRain);

// Mixin Sponge
// Mixin SpongeForge
getMixinMappings().put("io.github.lxgaming.sledgehammer.mixin.spongeforge.mod.item.inventory.fabric.MixinIItemHandlerFabric", MixinCategory::isItemHandlerFabric);

// Mixin SpongeVanilla
}

public void debugMessage(String format, Object... arguments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class MixinCategory {
@Setting(value = "harvest-block", comment = "Prevents ClassCastException caused by Sponge assuming things")
private boolean harvestBlock = false;

@Setting(value = "item-handler-fabric", comment = "Prevent item duplication with certain modded inventories")
private boolean itemHandlerFabric = false;

@Setting(value = "network-system", comment = "Fixes potential deadlock on shutdown")
private boolean networkSystem = false;

Expand Down Expand Up @@ -70,6 +73,10 @@ public boolean isHarvestBlock() {
return harvestBlock;
}

public boolean isItemHandlerFabric() {
return itemHandlerFabric;
}

public boolean isNetworkSystem() {
return networkSystem;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2018 Alex Thomson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lxgaming.sledgehammer.mixin.spongeforge.mod.item.inventory.fabric;

import io.github.lxgaming.sledgehammer.Sledgehammer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.mod.item.inventory.fabric.IItemHandlerFabric;

@Mixin(value = IItemHandlerFabric.class, priority = 1337, remap = false)
public abstract class MixinIItemHandlerFabric {

@Inject(method = "setIItemHandlerStack", at = @At(value = "HEAD"), cancellable = true)
private static void onSetIItemHandlerStack(IItemHandler handler, int index, ItemStack stack, CallbackInfo callbackInfo) {
callbackInfo.cancel();
Sledgehammer.getInstance().debugMessage("IItemHandlerFabric::setIItemHandlerStack Cancelled");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Reference {

public static final String PLUGIN_ID = "sledgehammer";
public static final String PLUGIN_NAME = "Sledgehammer";
public static final String PLUGIN_VERSION = "1.12.2-1.2.10";
public static final String PLUGIN_VERSION = "1.12.2-1.2.11";
public static final String DESCRIPTION = "Smashes the stupid out of the server.";
public static final String AUTHORS = "LX_Gaming";
public static final String SOURCE = "https://github.com/LXGaming/Sledgehammer/";
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/mixins.sledgehammer.spongeforge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"required": true,
"minVersion": "0.7.4",
"package": "io.github.lxgaming.sledgehammer.mixin.spongeforge",
"refmap": "mixins.sledgehammer.refmap.json",
"plugin": "io.github.lxgaming.sledgehammer.mixin.plugin.ForgePlugin",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [
"mod.item.inventory.fabric.MixinIItemHandlerFabric"
],
"injectors": {
"defaultRequire": 1
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"required": true,
"minVersion": "0.7.4",
"package": "io.github.lxgaming.sledgehammer.mixin.sponge",
"package": "io.github.lxgaming.sledgehammer.mixin.spongevanilla",
"refmap": "mixins.sledgehammer.refmap.json",
"plugin": "io.github.lxgaming.sledgehammer.mixin.plugin.SpongePlugin",
"plugin": "io.github.lxgaming.sledgehammer.mixin.plugin.CorePlugin",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [
Expand Down

0 comments on commit 16f867b

Please sign in to comment.