-
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 #465 from WaitingIdly/golem-air
Weaken Golem Structure Requirements
- Loading branch information
Showing
5 changed files
with
45 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
31 changes: 31 additions & 0 deletions
31
...od/acgaming/universaltweaks/tweaks/blocks/golemstructure/mixin/UTGolemFormationMixin.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.tweaks.blocks.golemstructure.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReceiver; | ||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import mod.acgaming.universaltweaks.config.UTConfigTweaks; | ||
import net.minecraft.block.BlockPumpkin; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.block.state.pattern.FactoryBlockPattern; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(BlockPumpkin.class) | ||
public abstract class UTGolemFormationMixin | ||
{ | ||
@WrapWithCondition(method = "trySpawnGolem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;I)Z", ordinal = 1)) | ||
private boolean utOverrideRemovalLogic(World world, BlockPos pos, IBlockState newState, int flags, @Local(ordinal = 0) int j, @Local(ordinal = 1) int k) | ||
{ | ||
if (!UTConfigTweaks.ENTITIES.utGolemPlacement) return true; | ||
return (k != 0 && k != 2) || (j != 0 && j != 2); | ||
} | ||
|
||
@ModifyReceiver(method = {"getGolemPattern", "getGolemBasePattern"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/pattern/FactoryBlockPattern;build()Lnet/minecraft/block/state/pattern/BlockPattern;")) | ||
private FactoryBlockPattern utReplaceAirRequirementWithAny(FactoryBlockPattern receiver) | ||
{ | ||
if (!UTConfigTweaks.ENTITIES.utGolemPlacement) return receiver; | ||
return receiver.where('~', unused -> true); | ||
} | ||
} |
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.blocks.golemstructure.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTGolemFormationMixin"] | ||
} |