Skip to content

Commit

Permalink
Merge pull request #428 from WaitingIdly/end-crystal-place
Browse files Browse the repository at this point in the history
allow placing End Crystals on any block
  • Loading branch information
ACGaming authored Apr 9, 2024
2 parents 0b07ef3 + f0e0171 commit ccd8dc2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ All changes are toggleable via config files.
* **Disable Villager Trade Restock:** Disables restocking of villager trades, only allowing one trade per offer
* **Disable Wither Targeting AI:** Disables withers targeting animals
* **Easy Breeding:** Enables easy breeding of animals by tossing food on the ground
* **End Crystal Placing:** Allows placing End Crystals without requiring Obsidian or Bedrock below
* **End Portal Parallax:** Re-implements parallax rendering of the end portal from 1.11 and older
* **Explosion Block Drop Chance:** Determines the numerator of the block drop formula on explosions
* **Falling Block Lifespan:** Determines how long falling blocks remain in ticks until they are dropped under normal circumstances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public static class BlocksCategory
@Config.Comment("Allows placing Pumpkins and Jack'O'Lanterns without a supporting block")
public boolean utUnsupportedPumpkinPlacing = false;

@Config.RequiresMcRestart
@Config.Name("End Crystal Placing")
@Config.Comment("Allows placing End Crystals without requiring Obsidian or Bedrock below")
public boolean utEndCrystalAnywherePlacing = 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 @@ -200,6 +200,7 @@ public List<String> getMixinConfigs()
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.endcrystal.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 @@ -445,6 +446,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigTweaks.BLOCKS.OVERHAUL_BEACON.utOverhaulBeaconToggle;
case "mixins.tweaks.blocks.pumpkinplacing.json":
return UTConfigTweaks.BLOCKS.utUnsupportedPumpkinPlacing;
case "mixins.tweaks.blocks.endcrystal.json":
return UTConfigTweaks.BLOCKS.utEndCrystalAnywherePlacing;
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,22 @@
package mod.acgaming.universaltweaks.tweaks.blocks.endcrystal.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemEndCrystal;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

// Courtesy of WaitingIdly
@Mixin(value = ItemEndCrystal.class)
public abstract class UTEndCrystalPlacing
{
// Pretend every block is Obsidian when trying to place
@ModifyExpressionValue(method = "onItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getBlock()Lnet/minecraft/block/Block;", ordinal = 0))
public Block utEndCrystalPlacingOverride(Block original)
{
if (!UTConfigTweaks.BLOCKS.utEndCrystalAnywherePlacing) return original;
return Blocks.OBSIDIAN;
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.blocks.endcrystal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.blocks.endcrystal.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTEndCrystalPlacing"]
}

0 comments on commit ccd8dc2

Please sign in to comment.