From f4586c257d1ba0d5daca879cdeeab4fa8e16d95e Mon Sep 17 00:00:00 2001 From: Haven Date: Sat, 25 Apr 2020 22:49:10 -0700 Subject: [PATCH] Added passable leaves, sources, and issues --- README.md | 1 + gradle.properties | 4 +-- .../dev/hephaestus/tweaks/TweaksConfig.java | 3 +++ .../tweaks/mixin/LilyPadBlockMixin.java | 10 +++++++- .../tweaks/mixin/plants/LeavesBlockMixin.java | 25 +++++++++++++++++++ .../assets/tinytweaks/lang/en_us.json | 7 ++++-- src/main/resources/fabric.mod.json | 5 +++- src/main/resources/tweaks.mixins.json | 1 + 8 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 src/main/java/dev/hephaestus/tweaks/mixin/plants/LeavesBlockMixin.java diff --git a/README.md b/README.md index ceee2eb..8a0d82e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ A collection of small tweaks for Minecraft. * Easy Harvest Sugarcane - Right clicking sugarcane harvests all sugarcane higher than the one you clicked. Preserves the bottom-most block * Sapling Succession - Saplings that fall on dirt or grass will automatically plant * Grass Spreading - Grass and long grass spread naturally over time. Also removes hitboxes from grass and long grass. Seeds can be obtained by hoeing the ground under them +* Passable Leaves - Removes collision from leaves * Farmer Villager Automation - Farmer villagers will deposit excess items into a nearby chest ## Animal Tweaks diff --git a/gradle.properties b/gradle.properties index 28fbc66..c1d642f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ loader_version = 0.8.2+build.194 #Mod properties mod_version = 1.0.0 -maven_group = tweaks -archives_base_name = littletweaks +maven_group = dev.hephaestus +archives_base_name = tinytweaks #Dependencies fabric_api_version = 0.7.1+build.301-1.15 diff --git a/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java b/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java index df16aeb..0f206ed 100644 --- a/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java +++ b/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java @@ -24,6 +24,9 @@ public class TweaksConfig implements ConfigData { @ConfigEntry.Gui.Tooltip(count = 3) public boolean spreadableGroundcover = true; + @ConfigEntry.Category("plants") + public boolean passableLeaves = true; + @ConfigEntry.Category("plants") @ConfigEntry.Gui.Tooltip public boolean farmerVillagerAutomation = true; diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/LilyPadBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/LilyPadBlockMixin.java index 6add3e8..80d9a60 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/LilyPadBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/LilyPadBlockMixin.java @@ -14,13 +14,17 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; -@SuppressWarnings("OverwriteAuthorRequired") @Mixin(LilyPadBlock.class) public abstract class LilyPadBlockMixin extends PlantBlock { protected LilyPadBlockMixin(Settings settings) { super(settings); } + /** + * @author Haven King + * @reason to stop boats from breaking our lily pads. + * I highly doubt anyone else will mess with this aspect of lily pads, but if you DO, ~~fuck off~~ talk to me + */ @Overwrite public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { super.onEntityCollision(state, world, pos, entity); @@ -28,6 +32,10 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit private static final VoxelShape COLLIDER = Block.createCuboidShape(1.0D, -0.125D, 1.0D, 15.0D, 0D, 15.0D); + /** + * @author Haven King + * @reason Because it's the same as injecting and returning, but with more clarity. + */ @Overwrite public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) { return COLLIDER; diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/plants/LeavesBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/plants/LeavesBlockMixin.java new file mode 100644 index 0000000..cd4c6b6 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/plants/LeavesBlockMixin.java @@ -0,0 +1,25 @@ +package dev.hephaestus.tweaks.mixin.plants; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.LeavesBlock; +import net.minecraft.entity.EntityContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(LeavesBlock.class) +public class LeavesBlockMixin extends Block{ + + public LeavesBlockMixin(Settings settings) { + super(settings); + } + + @Override + public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) { + return Tweaks.CONFIG.passableLeaves ? VoxelShapes.empty() : super.getCollisionShape(state, view, pos, context); + } +} \ No newline at end of file diff --git a/src/main/resources/assets/tinytweaks/lang/en_us.json b/src/main/resources/assets/tinytweaks/lang/en_us.json index 242d77c..bd1f916 100644 --- a/src/main/resources/assets/tinytweaks/lang/en_us.json +++ b/src/main/resources/assets/tinytweaks/lang/en_us.json @@ -19,7 +19,7 @@ "text.autoconfig.tinytweaks.option.saplingsAutoPlant.@Tooltip": "Saplings that fall on dirt or grass will automatically plant", "text.autoconfig.tinytweaks.option.lanternBlastResistance": "Sturdy Lanterns", "text.autoconfig.tinytweaks.option.lanternBlastResistance.@Tooltip[0]": "Gives lanterns a blast resistance of 6", - "text.autoconfig.tinytweaks.option.lanternBlastResistance.@Tooltip[1]": "§cApplied on game start", + "text.autoconfig.tinytweaks.option.lanternBlastResistance.@Tooltip[1]": "§cRequires restart", "text.autoconfig.tinytweaks.option.animalsEatOffGround": "Animals Eat off the Ground", "text.autoconfig.tinytweaks.option.animalsEatOffGround.@Tooltip": "Chickens, cows, horeses, pigs, sheep, and wolves will eat off the ground", "text.autoconfig.tinytweaks.option.breedWildWolves": "Wild Wolves Breed", @@ -28,6 +28,7 @@ "text.autoconfig.tinytweaks.option.spreadableGroundcover.@Tooltip[0]": "Grass and long grass spread naturally over time", "text.autoconfig.tinytweaks.option.spreadableGroundcover.@Tooltip[1]": "§oAlso removes hitboxes from grass and long grass", "text.autoconfig.tinytweaks.option.spreadableGroundcover.@Tooltip[2]": "§oSeeds can be obtained by hoeing the ground under them", + "text.autoconfig.tinytweaks.option.passableLeaves": "Passable Leaves", "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.saplingsAutoPlant.boolean.true": "§aOn", @@ -37,6 +38,7 @@ "text.autoconfig.tinytweaks.option.breedWildWolves.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.flintAndSteel.enabled.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.lanternBlastResistance.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.passableLeaves.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.saplingsAutoPlant.boolean.false": "§cOff", @@ -45,5 +47,6 @@ "text.autoconfig.tinytweaks.option.animalsEatOffGround.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.breedWildWolves.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.flintAndSteel.enabled.boolean.false": "§cOff", - "text.autoconfig.tinytweaks.option.lanternBlastResistance.boolean.false": "§cOff" + "text.autoconfig.tinytweaks.option.lanternBlastResistance.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.passableLeaves.boolean.false": "§aOff" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 056be41..9e91c1a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -8,7 +8,10 @@ "Haven King" ], "contributors": [], - "contact": {}, + "contact": { + "sources": "https://github.com/Hephaestus-Dev/TinyTweaks", + "issues": "https://github.com/Hephaestus-Dev/TinyTweaks/issues" + }, "license": "MIT", "icon": "assets/tinytweaks/icon.png", "environment": "*", diff --git a/src/main/resources/tweaks.mixins.json b/src/main/resources/tweaks.mixins.json index 405fa1c..ba7897e 100644 --- a/src/main/resources/tweaks.mixins.json +++ b/src/main/resources/tweaks.mixins.json @@ -20,6 +20,7 @@ "animals.WolfEntityMixin", "plants.CropBlockMixin", "plants.FernBlockMixin", + "plants.LeavesBlockMixin", "plants.SpreadableBlockMixin", "plants.SugarCaneMixin", "plants.TallPlantBlockMixin"