Skip to content

Commit

Permalink
Fix Embers Melter Item Duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
LXGaming committed Apr 8, 2023
1 parent 1610cd5 commit 350bfb2
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ dependencies {
compileOnly("curse.maven:codechicken-lib-1-8-242818:2779848") // CodeChicken Lib v1.12.2-3.2.3.358-universal
compileOnly("curse.maven:cyclops-core-232758:3010617") // Cyclops Core v1.12.2-1.6.6
compileOnly("curse.maven:dank-null-272514:2831353") // /dank/null v1.12.2-1.7.89
compileOnly("curse.maven:embers-rekindled-300777:3695248") // EmbersRekindled v1.19
compileOnly("curse.maven:ender-io-64578:2858816") // Ender IO v5.1.55
compileOnly("curse.maven:ender-storage-1-8-245174:2755787") // Ender Storage v1.12.2-2.4.6.137-universal
compileOnly("curse.maven:flux-networks-248020:2645165") // Flux Networks v1.12.2-3.0.19
Expand Down Expand Up @@ -216,6 +217,7 @@ jar {
+ "mixins.sledgehammer.chesttransporter.json,"
+ "mixins.sledgehammer.core.json,"
+ "mixins.sledgehammer.danknull.json,"
+ "mixins.sledgehammer.embers.json,"
+ "mixins.sledgehammer.enderio.json,"
+ "mixins.sledgehammer.enderstorage.json,"
+ "mixins.sledgehammer.fluxnetworks.json,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.github.lxgaming.sledgehammer.configuration.category.mixin.ChestTransporterMixinCategory;
import io.github.lxgaming.sledgehammer.configuration.category.mixin.CoreMixinCategory;
import io.github.lxgaming.sledgehammer.configuration.category.mixin.DankNullMixinCategory;
import io.github.lxgaming.sledgehammer.configuration.category.mixin.EmbersMixinCategory;
import io.github.lxgaming.sledgehammer.configuration.category.mixin.EnderIOMixinCategory;
import io.github.lxgaming.sledgehammer.configuration.category.mixin.EnderStorageMixinCategory;
import io.github.lxgaming.sledgehammer.configuration.category.mixin.FluxNetworksMixinCategory;
Expand Down Expand Up @@ -115,6 +116,9 @@ public class MixinCategory {
@Setting(value = "dank-null", comment = "DankNull")
private DankNullMixinCategory dankNullMixinCategory = new DankNullMixinCategory();

@Setting(value = "embers", comment = "Embers")
private EmbersMixinCategory embersMixinCategory = new EmbersMixinCategory();

@Setting(value = "enderio", comment = "Ender IO")
private EnderIOMixinCategory enderIOMixinCategory = new EnderIOMixinCategory();

Expand Down Expand Up @@ -274,6 +278,10 @@ public DankNullMixinCategory getDankNullMixinCategory() {
return dankNullMixinCategory;
}

public EmbersMixinCategory getEmbersMixinCategory() {
return embersMixinCategory;
}

public EnderIOMixinCategory getEnderIOMixinCategory() {
return enderIOMixinCategory;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2023 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.configuration.category.mixin;

import io.github.lxgaming.sledgehammer.configuration.annotation.Mapping;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;

@ConfigSerializable
public class EmbersMixinCategory {

@Mapping(value = "embers.tileentity.TileEntityFurnaceTopMixin", dependencies = "embers")
@Setting(value = "item-duplication", comment = "If 'true', fixes item duplication")
private boolean itemDuplication = false;

public boolean isItemDuplication() {
return itemDuplication;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2023 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.embers.tileentity;

import net.minecraft.entity.Entity;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.math.AxisAlignedBB;
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;
import teamroots.embers.tileentity.TileEntityFurnaceTop;

import java.util.List;

@Mixin(value = TileEntityFurnaceTop.class, remap = false)
public abstract class TileEntityFurnaceTopMixin {

@Redirect(
method = "func_73660_a",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/World;func_72872_a(Ljava/lang/Class;Lnet/minecraft/util/math/AxisAlignedBB;)Ljava/util/List;"
)
)
private <T extends Entity> List<T> onGetEntitiesWithinAABB(World world, Class<T> entityClass, AxisAlignedBB axisAlignedBB) {
return world.getEntitiesWithinAABB(entityClass, axisAlignedBB, entity -> EntitySelectors.NOT_SPECTATING.apply(entity) && entity.isEntityAlive());
}
}
15 changes: 15 additions & 0 deletions src/main/resources/mixins.sledgehammer.embers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"required": false,
"minVersion": "0.7.10",
"package": "io.github.lxgaming.sledgehammer.mixin.embers",
"refmap": "mixins.sledgehammer.refmap.json",
"plugin": "io.github.lxgaming.sledgehammer.mixin.plugin.CorePlugin",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [
"tileentity.TileEntityFurnaceTopMixin"
],
"injectors": {
"defaultRequire": 1
}
}

0 comments on commit 350bfb2

Please sign in to comment.