-
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 #507 from WaitingIdly/spawner-egg
Prevent Mob Eggs from Changing Spawners
- Loading branch information
Showing
5 changed files
with
43 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
29 changes: 29 additions & 0 deletions
29
...java/mod/acgaming/universaltweaks/tweaks/items/mobegg/mixin/UTItemMonsterPlacerMixin.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,29 @@ | ||
package mod.acgaming.universaltweaks.tweaks.items.mobegg.mixin; | ||
|
||
import net.minecraft.item.ItemMonsterPlacer; | ||
import net.minecraft.tileentity.TileEntityMobSpawner; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfigTweaks; | ||
|
||
// Courtesy of WaitingIdly | ||
@Mixin(ItemMonsterPlacer.class) | ||
public abstract class UTItemMonsterPlacerMixin | ||
{ | ||
// @Inject(method = "onPlaceItemIntoWorld", target = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;onItemUse(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumHand;Lnet/minecraft/util/EnumFacing;FFF)Lnet/minecraft/util/EnumActionResult;")) | ||
// private boolean utPreventReplacingMobSpawnerEntity(Object instance, Operation<Boolean> original) | ||
// { | ||
// if (!UTConfigTweaks.ITEMS.utPreventMobEggsFromChangingSpawner) return original.call(instance); | ||
// return false; | ||
// } | ||
@WrapOperation(method = "onItemUse", constant = @Constant(classValue = TileEntityMobSpawner.class, ordinal = 0)) | ||
private boolean utPreventReplacingMobSpawnerEntity(Object instance, Operation<Boolean> original) | ||
{ | ||
if (!UTConfigTweaks.ITEMS.utPreventMobEggsFromChangingSpawner) return original.call(instance); | ||
return false; | ||
} | ||
} |
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.tweaks.items.mobegg.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTItemMonsterPlacerMixin"] | ||
} |