-
Notifications
You must be signed in to change notification settings - Fork 38
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 #492 from WaitingIdly/radar-erroring
Catch Radar Exception
- Loading branch information
Showing
5 changed files
with
50 additions
and
0 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
32 changes: 32 additions & 0 deletions
32
...n/java/mod/acgaming/universaltweaks/mods/extrautilities/radar/mixin/UTRadarPingMixin.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,32 @@ | ||
package mod.acgaming.universaltweaks.mods.extrautilities.radar.mixin; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.items.IItemHandler; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.rwtema.extrautils2.crafting.Radar; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
|
||
// Courtesy of WaitingIdly | ||
@Mixin(value = Radar.PacketPing.class, remap = false) | ||
public abstract class UTRadarPingMixin | ||
{ | ||
@WrapOperation(method = "lambda$doStuffServer$1", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/items/IItemHandler;getStackInSlot(I)Lnet/minecraft/item/ItemStack;")) | ||
private ItemStack utCatchItemHandlerException(IItemHandler instance, int slot, Operation<ItemStack> original) | ||
{ | ||
if (!UTConfigMods.EXTRA_UTILITIES.utCatchRadarException) return original.call(instance, slot); | ||
try | ||
{ | ||
return original.call(instance, slot); | ||
} | ||
catch (AbstractMethodError e) | ||
{ | ||
e.printStackTrace(); | ||
return ItemStack.EMPTY; | ||
} | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.mods.extrautilities.radar.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTRadarPingMixin"] | ||
} |