Skip to content

Commit

Permalink
Added passable leaves, sources, and issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Haven-King committed Apr 26, 2020
1 parent 57b32b1 commit f4586c2
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/dev/hephaestus/tweaks/TweaksConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@
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);
}

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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
7 changes: 5 additions & 2 deletions src/main/resources/assets/tinytweaks/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
5 changes: 4 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/tweaks.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"animals.WolfEntityMixin",
"plants.CropBlockMixin",
"plants.FernBlockMixin",
"plants.LeavesBlockMixin",
"plants.SpreadableBlockMixin",
"plants.SugarCaneMixin",
"plants.TallPlantBlockMixin"
Expand Down

0 comments on commit f4586c2

Please sign in to comment.