Skip to content

Commit

Permalink
Added dragonEggConvertsCobbleToEndstone rule
Browse files Browse the repository at this point in the history
  • Loading branch information
RubixDev committed Mar 5, 2021
1 parent 9d9a8fe commit cbc3fd2
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 3 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Extension Mod for [gnembon's fabric-carpet](https://github.com/gnembon/fabric-ca
- [`SURVIVAL`](markdown/SURVIVAL_Category.md)

## Index
Count: 55
Count: 56
- [anvilledBlueIce](#anvilledblueice)
- [anvilledIce](#anvilledice)
- [anvilledPackedIce](#anvilledpackedice)
Expand All @@ -31,6 +31,7 @@ Count: 55
- [craftableNameTags](#craftablenametags)
- [craftableNotchApple](#craftablenotchapple)
- [dragonDropsElytra](#dragondropselytra)
- [dragonEggConvertsCobbleToEndstone](#dragoneggconvertscobbletoendstone)
- [easyBoneBlockCrafting](#easyboneblockcrafting)
- [easyChestCrafting](#easychestcrafting)
- [easyDispenserCrafting](#easydispensercrafting)
Expand Down Expand Up @@ -167,6 +168,13 @@ Ender Dragon drops an Elytra when killed
- Additional notes:
- Idea from [VanillaTweaks](https://vanillatweaks.net/picker/datapacks/)

### dragonEggConvertsCobbleToEndstone
Dragon Eggs will convert Cobble under them to Endstone either on set event
- Type: `String`
- Default value: `off`
- Required options: `off`, `on_teleport`, `on_landing`, `both`
- Categories: `EXPERIMENTAL`, `FEATURE`, `RUG`

### easyBoneBlockCrafting
Bone Blocks can be crafted out of Bones
Expect a lag spike when changing the value
Expand Down
10 changes: 9 additions & 1 deletion markdown/EXPERIMENTAL_Category.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

For a list of all implemented Rules go [here](../README.md)
## Index
Count: 20
Count: 21
- [anvilledBlueIce](#anvilledblueice)
- [anvilledIce](#anvilledice)
- [anvilledPackedIce](#anvilledpackedice)
- [dragonEggConvertsCobbleToEndstone](#dragoneggconvertscobbletoendstone)
- [easyHarvesting](#easyharvesting)
- [easyHarvestingRequireHoe](#easyharvestingrequirehoe)
- [edibleGoldIngots](#ediblegoldingots)
Expand Down Expand Up @@ -56,6 +57,13 @@ Custom amount of ice crushed by falling anvils make one packed ice.
- You must choose a value from 0 to 32
- From [QuickCarpet](https://github.com/DeadlyMC/QuickCarpet114)

### dragonEggConvertsCobbleToEndstone
Dragon Eggs will convert Cobble under them to Endstone either on set event
- Type: `String`
- Default value: `off`
- Required options: `off`, `on_teleport`, `on_landing`, `both`
- Categories: `EXPERIMENTAL`, `FEATURE`, `RUG`

### easyHarvesting
Right clicking on fully grown crops harvests and immediately replants it
Works on: Wheat, Potatoes, Carrots, Beetroots, Nether Warts and Cocoa Beans
Expand Down
10 changes: 9 additions & 1 deletion markdown/FEATURE_Category.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

For a list of all implemented Rules go [here](../README.md)
## Index
Count: 24
Count: 25
- [anvilledBlueIce](#anvilledblueice)
- [anvilledIce](#anvilledice)
- [anvilledPackedIce](#anvilledpackedice)
- [concreteConvertOnCauldron](#concreteconvertoncauldron)
- [dragonDropsElytra](#dragondropselytra)
- [dragonEggConvertsCobbleToEndstone](#dragoneggconvertscobbletoendstone)
- [easyHarvesting](#easyharvesting)
- [easyHarvestingRequireHoe](#easyharvestingrequirehoe)
- [edibleGoldIngots](#ediblegoldingots)
Expand Down Expand Up @@ -76,6 +77,13 @@ Ender Dragon drops an Elytra when killed
- Additional notes:
- Idea from [VanillaTweaks](https://vanillatweaks.net/picker/datapacks/)

### dragonEggConvertsCobbleToEndstone
Dragon Eggs will convert Cobble under them to Endstone either on set event
- Type: `String`
- Default value: `off`
- Required options: `off`, `on_teleport`, `on_landing`, `both`
- Categories: `EXPERIMENTAL`, `FEATURE`, `RUG`

### easyHarvesting
Right clicking on fully grown crops harvests and immediately replants it
Works on: Wheat, Potatoes, Carrots, Beetroots, Nether Warts and Cocoa Beans
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/rubixdev/rug/RugSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,13 @@ public String description() {
)
public static String honeyCombStickiness = "both";
// honeyCombStickinessAdditional: Suggestion by DragonEggBedrockBreaking#0034

@Rule(
desc = "Dragon Eggs will convert Cobble under them to Endstone either on set event",
options = {"off", "on_teleport", "on_landing", "both"},
category = {EXPERIMENTAL, FEATURE, RUG}
)
public static String dragonEggConvertsCobbleToEndstone = "off";
}

// BUGFIX
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/rubixdev/rug/mixins/DragonEggBlockMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.rubixdev.rug.mixins;

import com.rubixdev.rug.RugSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.DragonEggBlock;
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.CallbackInfo;

@Mixin(DragonEggBlock.class)
public class DragonEggBlockMixin {
@Inject(method = "teleport", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
private void onTeleport(BlockState state, World world, BlockPos pos, CallbackInfo ci) {
String rugSetting = RugSettings.dragonEggConvertsCobbleToEndstone;
if ((rugSetting.equals("both") || rugSetting.equals("on_teleport")) && world.getBlockState(pos.down()).getBlock().is(Blocks.COBBLESTONE)) {
world.setBlockState(pos.down(), Blocks.END_STONE.getDefaultState(), 3);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ private void onTick(CallbackInfo ci, Block block, BlockPos pos) {
world.setBlockState(posBelow, Blocks.BLUE_ICE.getDefaultState(), 3);
}
}
} else if (block.is(Blocks.DRAGON_EGG)) {
BlockPos posBelow = new BlockPos(this.getX(), this.getY() - 0.06, this.getZ());
Block blockBelow = this.world.getBlockState(posBelow).getBlock();
String rugSetting = RugSettings.dragonEggConvertsCobbleToEndstone;
if (blockBelow == Blocks.COBBLESTONE && (rugSetting.equals("both") || rugSetting.equals("on_landing"))) {
world.breakBlock(posBelow, false);
world.setBlockState(posBelow, Blocks.END_STONE.getDefaultState(), 3);
}
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/rug.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ClientPlayerInteractionManagerMixin",
"ConcretePowderBlockMixin",
"CreeperEntityMixin",
"DragonEggBlockMixin",
"EnderDragonEntityMixin",
"EndermanEntityMixin",
"EnderPearlEntityMixin",
Expand Down

0 comments on commit cbc3fd2

Please sign in to comment.