-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #601 from WaitingIdly/enderio-fixes
Miscellaneous EnderIO fixes
- Loading branch information
Showing
18 changed files
with
267 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...main/java/mod/acgaming/universaltweaks/mods/enderio/chorus/mixin/UTChorusWalkerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package mod.acgaming.universaltweaks.mods.enderio.chorus.mixin; | ||
|
||
import java.util.Set; | ||
|
||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
// Courtesy of WaitingIdly | ||
@Mixin(targets = "crazypants.enderio.base.farming.farmers.ChorusFarmer$ChorusWalker", remap = false) | ||
public abstract class UTChorusWalkerMixin | ||
{ | ||
@Unique | ||
private final Set<BlockPos> universalTweaks$checkedPositions = new ObjectOpenHashSet<>(); | ||
|
||
/** | ||
* @author WaitingIdly | ||
* @reason Prevent StackOverflows by skipping previously already checked positions. | ||
*/ | ||
@Inject(method = "collect", at = @At("HEAD"), cancellable = true) | ||
protected void utIgnoreDuplicatePositions(BlockPos pos, EnumFacing from, CallbackInfoReturnable<Boolean> cir) | ||
{ | ||
if (!universalTweaks$checkedPositions.add(pos)) cir.setReturnValue(false); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTBasicItemFilterGuiAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin; | ||
|
||
import com.enderio.core.client.gui.button.CycleButton; | ||
import crazypants.enderio.base.filter.gui.BasicItemFilterGui; | ||
import crazypants.enderio.base.filter.gui.DamageModeIconHolder; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = BasicItemFilterGui.class, remap = false) | ||
public interface UTBasicItemFilterGuiAccessor | ||
{ | ||
@Accessor("damageB") | ||
CycleButton<DamageModeIconHolder> getDamageB(); | ||
} |
44 changes: 44 additions & 0 deletions
44
...ava/mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTPickerOverlayMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin; | ||
|
||
import java.io.IOException; | ||
|
||
import com.enderio.core.api.client.gui.IGuiScreen; | ||
import com.enderio.core.client.gui.button.CycleButton; | ||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
// Courtesy of WaitingIdly | ||
@Mixin(targets = "com.enderio.core.client.gui.button.CycleButton$PickerOverlay", remap = false) | ||
public abstract class UTPickerOverlayMixin | ||
{ | ||
@Shadow | ||
CycleButton<?> cycleButton; | ||
|
||
/** | ||
* @author WaitingIdly | ||
* @reason Update the filter that the damage button was changed when | ||
* interacting with any of internal buttons of the picker overlay. | ||
* This is required to ensure that the filter damage setting is saved. | ||
*/ | ||
@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "Lcom/enderio/core/client/gui/button/CycleButton;setMode(Ljava/lang/Enum;)V", shift = At.Shift.AFTER)) | ||
private void utNotifyFilterOfChange(int x, int y, int b, CallbackInfoReturnable<Boolean> cir) | ||
{ | ||
if (!UTConfigMods.ENDER_IO.utSaveFilterCycleButtonProperly) return; | ||
try | ||
{ | ||
if (cycleButton instanceof UTTooltipButtonAccessor) | ||
{ | ||
IGuiScreen gui = ((UTTooltipButtonAccessor) cycleButton).getGui(); | ||
if (gui instanceof UTBasicItemFilterGuiAccessor) | ||
{ | ||
gui.doActionPerformed(((UTBasicItemFilterGuiAccessor) gui).getDamageB()); | ||
} | ||
} | ||
} | ||
catch (IOException ignored) {} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../mod/acgaming/universaltweaks/mods/enderio/cyclebutton/mixin/UTTooltipButtonAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package mod.acgaming.universaltweaks.mods.enderio.cyclebutton.mixin; | ||
|
||
import com.enderio.core.api.client.gui.IGuiScreen; | ||
import com.enderio.core.client.gui.button.TooltipButton; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = TooltipButton.class, remap = false) | ||
public interface UTTooltipButtonAccessor | ||
{ | ||
@Accessor("gui") | ||
@NotNull IGuiScreen getGui(); | ||
} |
2 changes: 1 addition & 1 deletion
2
.../mixin/UTObeliskSpecialRendererMixin.java → .../mixin/UTObeliskSpecialRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ing/universaltweaks/mods/enderio/soulbinderjei/mixin/UTSoulBinderRecipeCategoryMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package mod.acgaming.universaltweaks.mods.enderio.soulbinderjei.mixin; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import crazypants.enderio.machines.integration.jei.SoulBinderRecipeCategory; | ||
import mezz.jei.api.gui.IGuiItemStackGroup; | ||
import mezz.jei.api.recipe.IFocus; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import static crazypants.enderio.base.init.ModObject.itemSoulVial; | ||
|
||
// Courtesy of WaitingIdly | ||
@Mixin(value = SoulBinderRecipeCategory.class, remap = false) | ||
public abstract class UTSoulBinderRecipeCategoryMixin | ||
{ | ||
/** | ||
* @author WaitingIdly | ||
* @reason ensure list replacing prior entries isn't empty, | ||
* as this will cause JEI to appear in an incorrect state. | ||
*/ | ||
@WrapWithCondition(method = "setRecipe(Lmezz/jei/api/gui/IRecipeLayout;Lcrazypants/enderio/machines/integration/jei/SoulBinderRecipeCategory$SoulBinderRecipeWrapper;Lmezz/jei/api/ingredients/IIngredients;)V", at = @At(value = "INVOKE", target = "Lmezz/jei/api/gui/IGuiItemStackGroup;set(ILjava/util/List;)V")) | ||
private boolean utEnsureListNotEmpty(IGuiItemStackGroup instance, int i, List<?> list) | ||
{ | ||
return !list.isEmpty(); | ||
} | ||
|
||
/** | ||
* @author WaitingIdly | ||
* @reason check that the focus is not an soul vial, as | ||
* checking for recipes that output that will cause | ||
* soul vials to replace the second output slot on all recipes. | ||
*/ | ||
@ModifyExpressionValue(method = "setRecipe(Lmezz/jei/api/gui/IRecipeLayout;Lcrazypants/enderio/machines/integration/jei/SoulBinderRecipeCategory$SoulBinderRecipeWrapper;Lmezz/jei/api/ingredients/IIngredients;)V", at = @At(value = "INVOKE", target = "Lcrazypants/enderio/util/CapturedMob;containsSoul(Lnet/minecraft/item/ItemStack;)Z", ordinal = 1)) | ||
private boolean utCheckFocusNotVial(boolean original, @Local IFocus<?> focus) | ||
{ | ||
// at this point, focus.getValue() has already been checked if its an instanceof ItemStack. | ||
return original && ((ItemStack) focus.getValue()).getItem() != itemSoulVial.getItemNN(); | ||
} | ||
} |
Oops, something went wrong.