Skip to content

Commit

Permalink
Remove MixinIItemHandlerFabric as it was fixed upstream
Browse files Browse the repository at this point in the history
Delete items that collide with portal blocks to prevent the world from getting loaded
  • Loading branch information
LXGaming committed Sep 23, 2018
1 parent 16f867b commit ac8fd0b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 48 deletions.
2 changes: 1 addition & 1 deletion 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.11"
version = "1.12.2-1.2.12"

minecraft {
version = "1.12.2-14.23.4.2705"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ private void registerMappings() {
getMixinMappings().put("io.github.lxgaming.sledgehammer.mixin.forge.world.storage.MixinWorldInfo", MixinCategory::isCeremonyRain);

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

// Mixin SpongeVanilla
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ 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 @@ -73,10 +70,6 @@ public boolean isHarvestBlock() {
return harvestBlock;
}

public boolean isItemHandlerFabric() {
return itemHandlerFabric;
}

public boolean isNetworkSystem() {
return networkSystem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
import io.github.lxgaming.sledgehammer.util.Toolbox;
import org.apache.commons.lang3.StringUtils;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.entity.Item;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.block.CollideBlockEvent;
import org.spongepowered.api.event.entity.MoveEntityEvent;
import org.spongepowered.api.event.filter.cause.Root;
import org.spongepowered.api.text.Text;
Expand All @@ -41,13 +43,36 @@ public boolean prepareIntegration() {
return true;
}

@Listener(order = Order.LAST)
public void onCollideBlock(CollideBlockEvent event, @Root Item item) {
if (event.getTargetBlock().getType() != BlockTypes.PORTAL && event.getTargetBlock().getType() != BlockTypes.END_PORTAL) {
return;
}

if (item.isRemoved()) {
return;
}

item.remove();

Sledgehammer.getInstance().debugMessage("Item {} removed", item.getItemType().getId());
Sledgehammer.getInstance().getConfig().map(Config::getMessageCategory).map(MessageCategory::getItemTeleport).filter(StringUtils::isNotBlank).ifPresent(message -> {
item.getCreator().flatMap(Sponge.getServer()::getPlayer).ifPresent(player -> {
player.sendMessage(Text.of(Toolbox.getTextPrefix(), Toolbox.convertColor(message.replace("[ITEM]", item.getItemType().getId()))));
});
});
}

@Listener(order = Order.LAST)
public void onMoveEntity(MoveEntityEvent.Teleport event, @Root Item item) {
if (event.getFromTransform().getExtent() == event.getToTransform().getExtent()) {
return;
}

event.setCancelled(true);
if (item.isRemoved()) {
return;
}

item.remove();

Sledgehammer.getInstance().debugMessage("Item {} removed", item.getItemType().getId());
Expand Down

This file was deleted.

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.11";
public static final String PLUGIN_VERSION = "1.12.2-1.2.12";
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
1 change: 0 additions & 1 deletion src/main/resources/mixins.sledgehammer.spongeforge.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [
"mod.item.inventory.fabric.MixinIItemHandlerFabric"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit ac8fd0b

Please sign in to comment.