Skip to content

Commit

Permalink
Merge pull request #464 from WaitingIdly/wither-air
Browse files Browse the repository at this point in the history
Weaken Wither Structure Requirements
  • Loading branch information
ACGaming authored May 12, 2024
2 parents 790d6ad + ac6086b commit 79bfad6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ All changes are toggleable via config files.
* **Taming:** Allows taming of undead horses
* **Village Distance:** Sets the village generation distance in chunks
* **Water Fall Damage:** Re-implements an improved version of pre-1.4 fall damage in water
* **Weaken Wither Structure Requirements:** Allows creating Withers with non-air blocks in the bottom corners of the structure
* **XP Bottle Amount:** Sets the amount of experience spawned by bottles o' enchanting
* **XP Level Cap:** Sets the maximum experience level players can reach

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ public static class EntitiesCategory
@Config.Comment("Disables withers targeting animals")
public boolean utWitherAIToggle = false;

@Config.RequiresMcRestart
@Config.Name("Weaken Wither Structure Requirements")
@Config.Comment("Allows creating Withers with non-air blocks in the bottom corners of the structure")
public boolean utWitherPlacement = false;

@Config.RequiresMcRestart
@Config.Name("First Person Burning Overlay")
@Config.Comment("Sets the offset for the fire overlay in first person when the player is burning")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
put("mixins.tweaks.blocks.overhaulbeacon.json", () -> UTConfigTweaks.BLOCKS.OVERHAUL_BEACON.utOverhaulBeaconToggle);
put("mixins.tweaks.blocks.pumpkinplacing.json", () -> UTConfigTweaks.BLOCKS.utUnsupportedPumpkinPlacing);
put("mixins.tweaks.blocks.sapling.json", () -> UTConfigTweaks.BLOCKS.SAPLING_BEHAVIOR.utSaplingBehaviorToggle);
put("mixins.tweaks.blocks.witherstructure.json", () -> UTConfigTweaks.ENTITIES.utWitherPlacement);
put("mixins.tweaks.entities.ai.json", () -> UTConfigTweaks.ENTITIES.utAIReplacementToggle);
put("mixins.tweaks.entities.ai.saddledwandering.json", () -> UTConfigTweaks.ENTITIES.utSaddledWanderingToggle);
put("mixins.tweaks.entities.ai.wither.json", () -> UTConfigTweaks.ENTITIES.utWitherAIToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package mod.acgaming.universaltweaks.tweaks.blocks.witherstructure.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.BlockSkull;
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(BlockSkull.class)
public abstract class UTWitherFormationMixin
{
@WrapWithCondition(method = "checkWitherSpawn", 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.utWitherPlacement) return true;
return k != 2 || (j != 0 && j != 2);
}

@ModifyReceiver(method = {"getWitherPattern", "getWitherBasePattern"}, 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.utWitherPlacement) return receiver;
return receiver.where('~', unused -> true);
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.blocks.witherstructure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.blocks.witherstructure.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTWitherFormationMixin"]
}

0 comments on commit 79bfad6

Please sign in to comment.