Skip to content

Commit

Permalink
Merge pull request #425 from WaitingIdly/pumpkin-place
Browse files Browse the repository at this point in the history
allow placing unsupported pumpkins
  • Loading branch information
ACGaming authored Apr 6, 2024
2 parents 7d0cb15 + a135be6 commit 10a64b2
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ All changes are toggleable via config files.
* **Overlay Message Height:** Sets the Y value of the overlay message (action bar), displayed for playing records etc.
* **Pickup Notification:** Displays highly configurable notifications when the player obtains or loses items
* **Player Speed:** Enables the modification of base and maximum player speeds along with fixing 'Player moved too quickly' messages
* **Pumpkin Placing:** Allows placing Pumpkins and Jack'O'Lanterns without a supporting block
* **Rabbit Killer Spawning:** Configurable chance for rabbits to spawn as the killer bunny variant
* **Rabbit Toast Spawning:** Configurable chance for rabbits to spawn as the Toast variant
* **Rally Health:** Adds Bloodborne's Rally system to Minecraft, regain lost health when attacking back within the risk time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ public static class BlocksCategory
@Config.Comment("Allows the creation of grass paths everywhere (beneath fence gates, trapdoors, ...)")
public boolean utLenientPathsToggle = true;

@Config.Name("Unsupported Pumpkin Placing")
@Config.Comment("Allows placing Pumpkins and Jack'O'Lanterns without a supporting block")
public boolean utUnsupportedPumpkinPlacing = false;

@Config.RequiresMcRestart
@Config.Name("Sugar Cane Size")
@Config.Comment("Determines how tall sugar cane can grow")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.tweaks.blocks.leafdecay.json");
configs.add("mixins.tweaks.blocks.lenientpaths.json");
configs.add("mixins.tweaks.blocks.overhaulbeacon.json");
configs.add("mixins.tweaks.blocks.pumpkinplacing.json");
configs.add("mixins.tweaks.blocks.sapling.json");
configs.add("mixins.tweaks.entities.ai.json");
configs.add("mixins.tweaks.entities.ai.saddledwandering.json");
Expand Down Expand Up @@ -442,6 +443,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigTweaks.BLOCKS.utLenientPathsToggle;
case "mixins.tweaks.blocks.overhaulbeacon.json":
return UTConfigTweaks.BLOCKS.OVERHAUL_BEACON.utOverhaulBeaconToggle;
case "mixins.tweaks.blocks.pumpkinplacing.json":
return UTConfigTweaks.BLOCKS.utUnsupportedPumpkinPlacing;
case "mixins.tweaks.blocks.sapling.json":
return UTConfigTweaks.BLOCKS.SAPLING_BEHAVIOR.utSaplingBehaviorToggle;
case "mixins.tweaks.entities.ai.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package mod.acgaming.universaltweaks.tweaks.blocks.pumpkinplacing.mixin;

import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import net.minecraft.block.BlockPumpkin;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = BlockPumpkin.class)
public abstract class UTUnsupportedPumpkinPlacing
{
@Inject(method = "canPlaceBlockAt", at = @At(value = "HEAD"), cancellable = true)
public void utUnsupportedPlacingOverride(World worldIn, BlockPos pos, CallbackInfoReturnable<Boolean> cir)
{
if (!UTConfigTweaks.BLOCKS.utUnsupportedPumpkinPlacing) return;
cir.setReturnValue(worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public static List<String> obsoleteModsMessage()
if (Loader.isModLoaded("pathundergates") && UTConfigTweaks.BLOCKS.utLenientPathsToggle) messages.add("Path Under Gates");
if (Loader.isModLoaded("pickupnotifier") && UTConfigTweaks.MISC.PICKUP_NOTIFICATION.utPickupNotificationToggle) messages.add("Pick Up Notifier");
if (Loader.isModLoaded("portaldupebegone") && UTConfigBugfixes.WORLD.utPortalTravelingDupeToggle) messages.add("PortalDupeBegone");
if (Loader.isModLoaded("ppa") && UTConfigTweaks.BLOCKS.utUnsupportedPumpkinPlacing) messages.add("PlacePumpkinAnywhere");
if (Loader.isModLoaded("preventghost") && UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle) messages.add("Prevent Ghost Blocks");
if (Loader.isModLoaded("quickleafdecay") && UTConfigTweaks.BLOCKS.utLeafDecayToggle) messages.add("Quick Leaf Decay");
if (Loader.isModLoaded("rallyhealth") && UTConfigTweaks.ENTITIES.RALLY_HEALTH.utRallyHealthToggle) messages.add("Rally Health");
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/mixins.tweaks.blocks.pumpkinplacing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.blocks.pumpkinplacing.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"UTUnsupportedPumpkinPlacing"
]
}

0 comments on commit 10a64b2

Please sign in to comment.