diff --git a/README.md b/README.md index c53f9b1..69c5e0b 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,27 @@ A collection of small tweaks for Minecraft. ## Plant Tweaks * Easy Harvest Crops - Right clicking fully grown clops harvests and replants them * 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 +* Auto Planting - Plants that fall on dirt or grass will automatically plant. Applies to saplings, wheat seeds, pumpkin seeds, melon seeds, beetroot seeds, carrots, and potatoes +* Grass Spreading - Grass and long grass spread naturally over time +* Plant Hitboxes - Removes hitboxes from long grass. Hitboxes are shown when using shears. Seeds can be gathered by using a hoe on the ground below them * Passable Leaves - Removes collision from leaves * Better Lily Pads - Allows boats to pass through lily pads without breaking them. Also allows entities to rise through the bottom of a lily pad * Farmer Villager Automation - Farmer villagers will deposit excess items into a nearby chest ## Animal Tweaks -* Animals Eat off the Ground - Chickens, cows, horeses, pigs, sheep, and wolves will eat off the ground +* Animals Eat off the Ground - Chickens, cows, horses, pigs, sheep, and wolves will eat off the ground * Wild Wolves Breed - Wild wolves are able to be bred. Allows for some neat natural systems! ## Miscellaneous Tweaks +* Bubble Columns Flow - When set to On, bubble columns behave as they do in vanilla. When set to Off, bubble columns don't spread water to their surrounding blocks +* Burned Logs Drop Charcoal - When a log on fire burns, it drops a charcoal (Also makes charcoal fireproof) +* Double Doors - Doors and trapdoors open adjacent doors and trapdoors of the same type. Works when opened by hand or with redstone +* Editable Signs - No config for this one, just don't use it if you don't want it! * Entity Ignition - Right click mobs with flint and steel to light them on fire -* Sturdy Lanterns - Gives lanterns a blast resistance of 6 (allows them to survive Ghast fireballs) \ No newline at end of file +* Sturdy Lanterns - Gives lanterns a blast resistance of 6 (allows them to survive Ghast fireballs) +* Infinite Cauldrons - Right clicking a Cauldron with a Heart of the Sea creates an infinite water source +* Easy XP - All vanilla XP sources give their XP directly to the player that earns them (other than the Ender Dragon) +* Tinted Tipped Arrows - The heads of tipped arrows render the color of their status effect + +## Contact Me +I can be found hanging out on the Fabric Discord as Haven King#2790. Feel free to shoot me a message there if you have any questions. diff --git a/build.gradle b/build.gradle index 5e8e8bc..e85c903 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.2.7-SNAPSHOT' + id 'fabric-loom' version '0.5-SNAPSHOT' id 'maven-publish' } @@ -11,10 +11,22 @@ version = project.mod_version group = project.maven_group minecraft { + accessWidener = file("src/main/resources/tweaks.accesswidener") } repositories { + mavenLocal() jcenter() + maven { + url = "https://www.cursemaven.com" + } + maven { + url = "http://maven.fabricmc.net/" + name = "Fabric" + } + maven { + url "https://hephaestus.dev/release" + } } dependencies { @@ -24,15 +36,33 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" compileOnly "com.google.code.findbugs:jsr305:3.0.2" - modImplementation "io.github.prospector:modmenu:${project.modmenu_version}" + modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}") { + exclude group: "net.fabricmc.fabric-api" + } + + modImplementation ("dev.hephaestus:climbable:${project.climbable_version}") + include "dev.hephaestus:climbable:${project.climbable_version}" + - modApi "me.shedaniel.cloth:config-2:${project.cloth_config_2_version}" - include "me.shedaniel.cloth:config-2:${project.cloth_config_2_version}" +// modImplementation ("net.fabricmc:fabric-language-kotlin:1.3.72+build.1") { +// exclude group: "net.fabricmc.fabric-api" +// } +// modImplementation "curse.maven:sodium:3003093" +// modImplementation "curse.maven:lithium:3000628" + + modApi ("me.shedaniel.cloth:config-2:${project.cloth_config_version}") { + exclude group: "net.fabricmc.fabric-api" + } + + include "me.shedaniel.cloth:config-2:${project.cloth_config_version}" + + modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}") { + exclude group: "net.fabricmc.fabric-api" + } - modCompile "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u_version}" - include "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u_version}" + include "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" } processResources { diff --git a/gradle.properties b/gradle.properties index f63470c..edaf6f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,20 @@ org.gradle.jvmargs = -Xmx1G #Fabric properties -minecraft_version = 1.15.2 -yarn_mappings = 1.15.2+build.15 -loader_version = 0.8.2+build.194 +minecraft_version = 1.16.3 +yarn_mappings = 1.16.3+build.11 +loader_version = 0.10.0+local #Mod properties -mod_version = 1.0.7 -maven_group = dev.hephaestus -archives_base_name = tinytweaks +mod_version = 1.0.16 +maven_group = dev.hephaestus +archives_base_name = tinytweaks #Dependencies -fabric_api_version = 0.7.1+build.301-1.15 -modmenu_version = 1.10.2+build.32 -cloth_config_2_version = 2.13.2 -autoconfig1u_version = 2.0.1 \ No newline at end of file +fabric_version = 0.21.0+build.407-1.16 +cloth_config_version = 4.8.1 +auto_config_version = 3.2.2 +climbable_version = 0.2.0 + +# Dev Mods +mod_menu_version = 1.14.6+build.31 \ No newline at end of file diff --git a/src/main/java/dev/hephaestus/tweaks/Tweaks.java b/src/main/java/dev/hephaestus/tweaks/Tweaks.java index e2092b4..0f8f4d4 100644 --- a/src/main/java/dev/hephaestus/tweaks/Tweaks.java +++ b/src/main/java/dev/hephaestus/tweaks/Tweaks.java @@ -1,5 +1,6 @@ package dev.hephaestus.tweaks; +import dev.hephaestus.climbable.api.ClimbingSpeedRegistry; import dev.hephaestus.tweaks.block.Moistener; import dev.hephaestus.tweaks.client.render.block.entity.BarrelBlockLabelRenderer; import me.sargunvohra.mcmods.autoconfig1u.AutoConfig; @@ -9,18 +10,19 @@ import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.tag.BlockTags; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Tweaks implements ModInitializer, ClientModInitializer { - - public static Logger LOGGER = LogManager.getLogger(); + public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "tinytweaks"; public static final String MOD_NAME = "TinyTweaks"; - public static final double LILY_PAD_MOD = 0.2109375D /* 27 / 128 */; + public static final double LILY_PAD_MOD = 0.2109375D; public static TweaksConfig CONFIG = new TweaksConfig(); @@ -38,6 +40,8 @@ public void onInitialize() { Moistener.canMoisten(Blocks.STONE_BRICK_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB); Moistener.canMoisten(Blocks.STONE_BRICK_STAIRS, Blocks.MOSSY_STONE_BRICK_STAIRS); Moistener.canMoisten(Blocks.STONE_BRICK_WALL, Blocks.MOSSY_STONE_BRICK_WALL); + + ClimbingSpeedRegistry.registerClimbableTag(BlockTags.LOGS, e -> CONFIG.leaves.treeClimbingSpeed, e -> CONFIG.leaves.climb); } public static void log(Level level, String message, Object... args){ diff --git a/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java b/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java index 72229c2..252feac 100644 --- a/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java +++ b/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java @@ -17,8 +17,8 @@ public class TweaksConfig implements ConfigData { public boolean easyHarvestSugarcane = true; @ConfigEntry.Category("plants") - @ConfigEntry.Gui.Tooltip - public boolean saplingsAutoPlant = true; + @ConfigEntry.Gui.CollapsibleObject + public AutoPlanting autoPlanting = new AutoPlanting(); @ConfigEntry.Category("plants") @ConfigEntry.Gui.CollapsibleObject @@ -49,6 +49,19 @@ public class TweaksConfig implements ConfigData { @ConfigEntry.Gui.Tooltip public boolean breedWildWolves = true; + // - Nether! -------------------------------------------------------------- + @ConfigEntry.Category("nether") + @ConfigEntry.Gui.CollapsibleObject + public NetherRejuvenation netherRejuvenation = new NetherRejuvenation(); + + @ConfigEntry.Category("nether") + @ConfigEntry.Gui.Tooltip(count = 2) + public boolean blueSoulFireEffects = true; + + @ConfigEntry.Category("nether") + @ConfigEntry.Gui.Tooltip(count = 2) + public boolean soulFireDoesMoreDamage = false; + // - Miscellaneous! ------------------------------------------------------- @ConfigEntry.Category("misc") @ConfigEntry.Gui.CollapsibleObject @@ -63,23 +76,70 @@ public class TweaksConfig implements ConfigData { public NamesAndThings namesAndThings = new NamesAndThings(); @ConfigEntry.Category("misc") - @ConfigEntry.Gui.Tooltip(count = 2) + @ConfigEntry.Gui.Tooltip(count = 4) public boolean mossyThings = true; - @ConfigEntry.Category("debug") - public boolean grassDestroysRedstoneTorches = false; + @ConfigEntry.Category("misc") + public boolean burningLogsDropCharcoal = true; + + @ConfigEntry.Category("misc") + @ConfigEntry.Gui.Tooltip(count = 2) + public boolean doubleDoors = true; + + @ConfigEntry.Category("misc") + public boolean bubbleColumnsFlow = false; + + @ConfigEntry.Category("misc") + @ConfigEntry.Gui.Tooltip + public boolean infiniteCauldrons = true; + + @ConfigEntry.Category("misc") + @ConfigEntry.Gui.Tooltip(count = 2) + public boolean easyXp = true; + + public static class AutoPlanting { + @ConfigEntry.Gui.Tooltip(count = 4) + public boolean enabled = true; + + @ConfigEntry.Gui.Tooltip + public int delay = 20; + } public static class Rejuvenation { @ConfigEntry.Gui.Tooltip public boolean enabled = true; + @ConfigEntry.Gui.Tooltip + public double grassGrowthRate = 0.0125D; + + @ConfigEntry.Gui.Tooltip(count = 5) + public double thePowerOfFriendship = 1.25; + @ConfigEntry.Gui.Tooltip(count = 2) - public float longGrass = 0.01f; + public float longGrass = 0.01F; @ConfigEntry.Gui.Tooltip public boolean saplings = true; } + public static class NetherRejuvenation { + @ConfigEntry.Gui.Tooltip(count = 2) + public boolean enabled = true; + + @ConfigEntry.Gui.Tooltip + public double rootsGrowthRate = 0.0125D; + + @ConfigEntry.Gui.Tooltip(count = 5) + public double thePowerOfFriendship = 1.25; + + @ConfigEntry.Gui.Tooltip(count = 2) + @ConfigEntry.BoundedDiscrete(min = 0, max = 100) + public int sproutRootsRatio = 75; + + @ConfigEntry.Gui.Tooltip(count = 2) + public double vinesChance = 0.01; + } + public static class LeavesConfig { public boolean collide = false; @ConfigEntry.Gui.Tooltip @@ -88,7 +148,12 @@ public static class LeavesConfig { @ConfigEntry.Gui.Tooltip public boolean slow = true; + public double slowAmount = 0.75D; + public boolean climb = true; + + @ConfigEntry.Gui.Tooltip(count = 2) + public double treeClimbingSpeed = 0.75D; } public static class FlintAndSteelConfig { diff --git a/src/main/java/dev/hephaestus/tweaks/block/Moistener.java b/src/main/java/dev/hephaestus/tweaks/block/Moistener.java index 35eab4f..cabe8cc 100644 --- a/src/main/java/dev/hephaestus/tweaks/block/Moistener.java +++ b/src/main/java/dev/hephaestus/tweaks/block/Moistener.java @@ -25,4 +25,8 @@ public static BlockState dry(BlockState blockState) { public static void canMoisten(Block in, Block out) { CONVERTIBLE.put(in, out); } + + public static boolean canMoisten(Block block) { + return CONVERTIBLE.containsKey(block) || CONVERTIBLE.inverse().containsKey(block); + } } diff --git a/src/main/java/dev/hephaestus/tweaks/block/PlayerProvider.java b/src/main/java/dev/hephaestus/tweaks/block/PlayerProvider.java new file mode 100644 index 0000000..4783091 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/block/PlayerProvider.java @@ -0,0 +1,28 @@ +package dev.hephaestus.tweaks.block; + +import net.minecraft.server.network.ServerPlayerEntity; + +public interface PlayerProvider { + ThreadLocal STATIC = new ThreadLocal<>(); + + static void init() { + if (STATIC.get() == null) { + STATIC.set(new PlayerProvider() { + private ServerPlayerEntity playerEntity = null; + + @Override + public ServerPlayerEntity getPlayer() { + return this.playerEntity; + } + + @Override + public void setPlayer(ServerPlayerEntity player) { + this.playerEntity = player; + } + }); + } + } + + ServerPlayerEntity getPlayer(); + void setPlayer(ServerPlayerEntity player); +} diff --git a/src/main/java/dev/hephaestus/tweaks/client/render/block/entity/LabelRenderer.java b/src/main/java/dev/hephaestus/tweaks/client/render/block/entity/LabelRenderer.java index e717f55..dfb2acd 100644 --- a/src/main/java/dev/hephaestus/tweaks/client/render/block/entity/LabelRenderer.java +++ b/src/main/java/dev/hephaestus/tweaks/client/render/block/entity/LabelRenderer.java @@ -36,15 +36,7 @@ public class LabelRenderer { private static final Quaternion rotate180 = new Quaternion(yAxis, 180, true); private static final Quaternion rotate270 = new Quaternion(yAxis, 270, true); - static boolean test = true; public static void renderLabel(LockableContainerBlockEntity blockEntity, BlockEntityRenderDispatcher dispatcher, MatrixStack matrices, VertexConsumerProvider vertexConsumers, boolean open, Direction facing) { - if (test) { - BlockState state = Blocks.STONE.getDefaultState(); - BakedModel model = MinecraftClient.getInstance().getBlockRenderManager().getModel(state); - List quads = model.getQuads(state, null, new Random()); - - test = false; - } if (!blockEntity.hasCustomName() && MinecraftClient.getInstance().getNetworkHandler() != null) { MinecraftClient.getInstance().getNetworkHandler().getDataQueryHandler().queryBlockNbt(blockEntity.getPos(), (tag) -> { if (tag.contains("CustomName", 8)) { @@ -97,7 +89,7 @@ else if (dispatcher.crosshairTarget.getType() == HitResult.Type.BLOCK){ TextRenderer textRenderer = dispatcher.getTextRenderer(); String string = blockEntity.getName().asString(); - float s = (float) (-textRenderer.getStringWidth(string) / 2); + float s = (float) (-textRenderer.getWidth(string) / 2); textRenderer.draw(string, s, 0f, 16777215, true, matrices.peek().getModel(), vertexConsumers, false, 0, 15728880); matrices.pop(); } @@ -177,7 +169,7 @@ public static void renderLabel(LockableContainerBlockEntity blockEntity, BlockEn TextRenderer textRenderer = dispatcher.getTextRenderer(); String string = blockEntity.getName().asString(); - float s = (float) (-textRenderer.getStringWidth(string) / 2); + float s = (float) (-textRenderer.getWidth(string) / 2); textRenderer.draw(string, s, 0f, 16777215, true, matrices.peek().getModel(), vertexConsumers, false, 0, 15728880); matrices.pop(); } diff --git a/src/main/java/dev/hephaestus/tweaks/entity/ai/goal/GroundFoodMateGoal.java b/src/main/java/dev/hephaestus/tweaks/entity/ai/goal/GroundFoodMateGoal.java index 6d2d66f..e4b39a2 100644 --- a/src/main/java/dev/hephaestus/tweaks/entity/ai/goal/GroundFoodMateGoal.java +++ b/src/main/java/dev/hephaestus/tweaks/entity/ai/goal/GroundFoodMateGoal.java @@ -1,7 +1,6 @@ package dev.hephaestus.tweaks.entity.ai.goal; import dev.hephaestus.tweaks.Tweaks; -import jdk.internal.jline.internal.Nullable; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.ai.goal.Goal; import net.minecraft.entity.passive.AnimalEntity; @@ -32,7 +31,7 @@ public GroundFoodMateGoal(AnimalEntity animal, Ingredient food) { } public boolean canStart() { - if (Tweaks.CONFIG.animalsEatOffGround && this.animal.getEntityWorld().getGameRules().getBoolean(GameRules.MOB_GRIEFING) && this.animal.canEat() && this.animal.getBreedingAge() == 0) { + if (Tweaks.CONFIG.animalsEatOffGround && this.animal.getEntityWorld().getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING) && this.animal.canEat() && this.animal.getBreedingAge() == 0) { this.foodEntity = this.findFood(); } @@ -57,9 +56,8 @@ public void tick() { } } - @Nullable private ItemEntity findFood() { - List list = animal.world.getEntities(ItemEntity.class, this.animal.getBoundingBox().expand(8.0D), null); + List list = animal.world.getEntitiesByClass(ItemEntity.class, this.animal.getBoundingBox().expand(8.0D), null); double d = Double.MAX_VALUE; ItemEntity result = null; diff --git a/src/main/java/dev/hephaestus/tweaks/item/Tags.java b/src/main/java/dev/hephaestus/tweaks/item/Tags.java new file mode 100644 index 0000000..3db4113 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/item/Tags.java @@ -0,0 +1,11 @@ +package dev.hephaestus.tweaks.item; + +import dev.hephaestus.tweaks.Tweaks; +import net.fabricmc.fabric.api.tag.TagRegistry; +import net.minecraft.item.Item; +import net.minecraft.tag.Tag; +import net.minecraft.util.Identifier; + +public class Tags { + public static final Tag PLANTABLE = TagRegistry.item(new Identifier(Tweaks.MOD_ID, "plantable")); +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/BurnedLogsDropCharcoal.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/BurnedLogsDropCharcoal.java new file mode 100644 index 0000000..8c12ed5 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/BurnedLogsDropCharcoal.java @@ -0,0 +1,26 @@ +package dev.hephaestus.tweaks.mixin.block; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.FireBlock; +import net.minecraft.entity.ItemEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.tag.BlockTags; +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; + +import java.util.Random; + +@Mixin(FireBlock.class) +public class BurnedLogsDropCharcoal { + @Inject(method = "trySpreadingFire", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;", ordinal = 1)) + private void beforeSet(World world, BlockPos pos, int spreadFactor, Random rand, int currentAge, CallbackInfo ci) { + if (Tweaks.CONFIG.burningLogsDropCharcoal && world.getBlockState(pos).getBlock().isIn(BlockTags.LOGS_THAT_BURN)) { + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.CHARCOAL))); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java new file mode 100644 index 0000000..dedde59 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java @@ -0,0 +1,31 @@ +package dev.hephaestus.tweaks.mixin.block; + +import net.minecraft.block.AbstractSignBlock; +import net.minecraft.block.BlockState; +import net.minecraft.block.SignBlock; +import net.minecraft.block.entity.SignBlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.SignType; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(SignBlock.class) +public class EditableSigns extends AbstractSignBlock { + protected EditableSigns(Settings settings, SignType type) { + super(settings, type); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + if (!world.isClient && player != null) { + player.openEditSignScreen((SignBlockEntity)world.getBlockEntity(pos)); + return ActionResult.SUCCESS; + } + + return super.onUse(state, world, pos, player, hand, hit); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/FlowerBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/FlowerBlockMixin.java deleted file mode 100644 index 26af82c..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/FlowerBlockMixin.java +++ /dev/null @@ -1,33 +0,0 @@ -package dev.hephaestus.tweaks.mixin.block; - -import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.BlockState; -import net.minecraft.block.FernBlock; -import net.minecraft.block.FlowerBlock; -import net.minecraft.block.PlantBlock; -import net.minecraft.entity.EntityContext; -import net.minecraft.item.Items; -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.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(FlowerBlock.class) -public class FlowerBlockMixin extends PlantBlock { - @Shadow @Final protected static VoxelShape SHAPE; - - protected FlowerBlockMixin(Settings settings) { - super(settings); - } - - - public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) { - if (!Tweaks.CONFIG.plantHitboxes && !context.isHolding(Items.SHEARS)) - return VoxelShapes.empty(); - else - return SHAPE; - } -} \ No newline at end of file diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/LeafCollision.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/LeafCollision.java new file mode 100644 index 0000000..6e2528e --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/LeafCollision.java @@ -0,0 +1,55 @@ +package dev.hephaestus.tweaks.mixin.block; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.ItemEntity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.state.property.Properties; +import net.minecraft.tag.BlockTags; +import net.minecraft.tag.Tag; +import net.minecraft.text.HoverEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(AbstractBlock.AbstractBlockState.class) +public abstract class LeafCollision { + @Shadow public abstract Block getBlock(); + + @Inject(method = "getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;", at = @At("HEAD"), cancellable = true) + private void getCollisionShape(BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + if (context != EntityShapeContext.ABSENT && this.getBlock().isIn(BlockTags.LEAVES)) { + BlockState state = world.getBlockState(pos); + if (state.getBlock().getStateManager().getProperty("persistent") != null && state.get(Properties.PERSISTENT)) { + cir.setReturnValue(Tweaks.CONFIG.leaves.persistentCollide ? VoxelShapes.fullCube() : VoxelShapes.empty()); + } else { + cir.setReturnValue(Tweaks.CONFIG.leaves.collide ? VoxelShapes.fullCube() : VoxelShapes.empty()); + } + } + } + + @Inject(method = "onEntityCollision", at = @At("HEAD")) + private void onEntityCollision(World world, BlockPos pos, Entity entity, CallbackInfo ci) { + if (this.getBlock().isIn(BlockTags.LEAVES)) { + entity.fallDistance = entity.fallDistance * 0.7f; + + Vec3d velocity = entity.getVelocity(); + entity.setVelocity(velocity.multiply(0.7D, (velocity.y > 0 ? 1.0D : 0.7D), 0.7D)); + + if (entity.getVelocity().length() > 0.1D) { + entity.handleFallDamage(entity.fallDistance, 0.5f); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/LeavesBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/LeavesBlockMixin.java deleted file mode 100644 index 986e4e7..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/LeavesBlockMixin.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.hephaestus.tweaks.mixin.block; - -import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.LeavesBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityContext; -import net.minecraft.entity.ItemEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -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) { - if (state.get(LeavesBlock.PERSISTENT)) - return Tweaks.CONFIG.leaves.persistentCollide ? super.getCollisionShape(state, view, pos, context) : VoxelShapes.empty(); - else - return Tweaks.CONFIG.leaves.collide ? super.getCollisionShape(state, view, pos, context) : VoxelShapes.empty(); - } - - @Override - public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { - if (Tweaks.CONFIG.leaves.slow && !(entity instanceof ItemEntity)) - entity.slowMovement(state, new Vec3d(0.75D, 2D, 0.75D)); - } -} \ No newline at end of file diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/MakeCauldronsInfinite.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/MakeCauldronsInfinite.java new file mode 100644 index 0000000..4d8e1bb --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/MakeCauldronsInfinite.java @@ -0,0 +1,90 @@ +package dev.hephaestus.tweaks.mixin.block; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.CauldronChunk; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.CauldronBlock; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.particle.BlockStateParticleEffect; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.particle.ParticleTypes; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.Properties; +import net.minecraft.text.TranslatableText; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Formatting; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ServerWorldAccess; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.Random; + +@Mixin(CauldronBlock.class) +public class MakeCauldronsInfinite { + @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) + private void makeInfinite(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { + ItemStack stack = player.getStackInHand(hand); + + CauldronChunk cauldronChunk = (CauldronChunk) world.getChunk(pos); + + if (Tweaks.CONFIG.infiniteCauldrons && stack.getItem().equals(Items.HEART_OF_THE_SEA) && !cauldronChunk.isInfinite(pos)) { + if (!world.isClient) { + world.setBlockState(pos, state.with(Properties.LEVEL_3, 3)); + cauldronChunk.setInfinite(pos, true); + + for (int int_1 = -2; int_1 <= 2; ++int_1) { + for (int int_2 = -2; int_2 <= 2; ++int_2) { + if (int_1 > -2 && int_1 < 2 && int_2 == -1) { + int_2 = 2; + } + + Random random = world.getRandom(); + for (int int_3 = 0; int_3 <= 1; ++int_3) { + ((ServerWorld) world).spawnParticles( + ParticleTypes.ENCHANT, + (double) pos.getX() + 0.5D, + (double) pos.getY() + 2.0D, + (double) pos.getZ() + 0.5D, + 1, + (double) ((float) int_1 + random.nextFloat()) - 0.5D, + (float) int_3 - random.nextFloat() - 1.0F, + (double) ((float) int_2 + random.nextFloat()) - 0.5D, + 1); + } + } + } + + if (!player.isCreative()) { + stack.decrement(1); + } + + world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.BLOCKS, 1F, 1F); + player.sendMessage(new TranslatableText("block.cauldron.makeInfinite").styled(style -> style.withItalic(true).withColor(Formatting.AQUA)), true); + cir.setReturnValue(ActionResult.SUCCESS); + } + } + } + + @Inject(method = "setLevel", at = @At("HEAD"), cancellable = true) + private void dontDecreaseLevelIfInfinite(World world, BlockPos pos, BlockState state, int level, CallbackInfo ci) { + CauldronChunk cauldronChunk = (CauldronChunk) world.getChunk(pos); + if (level < state.get(Properties.LEVEL_3) && cauldronChunk.isInfinite(pos)) { + ci.cancel(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/LanternResistanceMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/MakeLanternsBlastResistant.java similarity index 94% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/LanternResistanceMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/MakeLanternsBlastResistant.java index cc5e0b2..ec065b6 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/LanternResistanceMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/MakeLanternsBlastResistant.java @@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(Blocks.class) -public class LanternResistanceMixin { +public class MakeLanternsBlastResistant { @SuppressWarnings("UnresolvedMixinReference") @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/block/LanternBlock")) private static LanternBlock redirLantern(Block.Settings settings) { diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/MoistBlocksMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/MoistBlocksMixin.java deleted file mode 100644 index 0f3a68e..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/MoistBlocksMixin.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.hephaestus.tweaks.mixin.block; - -import dev.hephaestus.tweaks.block.MoistBlock; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(Blocks.class) -public class MoistBlocksMixin { - @SuppressWarnings("UnresolvedMixinReference") - @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/block/Block", ordinal = 9)) - private static Block moistenCobblestone(Block.Settings settings) { - return new MoistBlock(settings); - } - - @SuppressWarnings("UnresolvedMixinReference") - @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/block/Block", ordinal = 40)) - private static Block dryMossyCobblestone(Block.Settings settings) { - return new MoistBlock(settings); - } - - @SuppressWarnings("UnresolvedMixinReference") - @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/block/Block", ordinal = 47)) - private static Block moistenStoneBricks(Block.Settings settings) { - return new MoistBlock(settings); - } - - @SuppressWarnings("UnresolvedMixinReference") - @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/block/Block", ordinal = 48)) - private static Block dryStoneBricks(Block.Settings settings) { - return new MoistBlock(settings); - } -} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/MoistObjectsMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/MoistObjectsMixin.java deleted file mode 100644 index 7c475b6..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/MoistObjectsMixin.java +++ /dev/null @@ -1,33 +0,0 @@ -package dev.hephaestus.tweaks.mixin.block; - -import dev.hephaestus.tweaks.block.MoistBlock; -import dev.hephaestus.tweaks.block.Moistener; -import net.minecraft.block.*; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldView; -import org.spongepowered.asm.mixin.Mixin; - -import java.util.Random; - -@Mixin({StairsBlock.class, SlabBlock.class, WallBlock.class}) -public abstract class MoistObjectsMixin extends Block { - public MoistObjectsMixin(Settings settings) { - super(settings); - } - - @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - MoistBlock.randomTick(state, world, pos); - } - - @Override - public boolean hasRandomTicks(BlockState state) { - return true; - } - - @Override - public int getTickRate(WorldView worldView) { - return 5; - } -} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/NetherRejuvenationNyliumSpread.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/NetherRejuvenationNyliumSpread.java new file mode 100644 index 0000000..5af82d6 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/NetherRejuvenationNyliumSpread.java @@ -0,0 +1,74 @@ +package dev.hephaestus.tweaks.mixin.block; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.*; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; +import net.minecraft.world.WorldView; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Random; + +@Mixin(NyliumBlock.class) +public abstract class NetherRejuvenationNyliumSpread { + @Shadow private static boolean stayAlive(BlockState state, WorldView world, BlockPos pos) {return true;} + + private static boolean canSpread(BlockState state, ServerWorld world, BlockPos pos) { + BlockPos blockPos = pos.up(); + BlockState blockState = world.getBlockState(blockPos); + + + + return blockState.isAir() && + (state.getBlock() == Blocks.WARPED_NYLIUM && world.getRegistryManager().get(Registry.BIOME_KEY).getId(world.getBiome(pos)).getPath().equals("warped_forest") || + state.getBlock() == Blocks.CRIMSON_NYLIUM && world.getRegistryManager().get(Registry.BIOME_KEY).getId(world.getBiome(pos)).getPath().equals("crimson_forest")); + } + + @Inject(method = "randomTick", at = @At("TAIL")) + private void spread(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) { + if (Tweaks.CONFIG.netherRejuvenation.enabled && stayAlive(state, world, pos)) { + int friends = 0; + + for (int x = -1; x <= 1; x++) { + for (int y = 0; y <= 1; y++) { + for (int z = -1; z <= 1; z++) { + Block friend = world.getBlockState(pos.add(x, y, z)).getBlock(); + if (friend instanceof RootsBlock || friend instanceof SproutsBlock) { + friends++; + friends *= Tweaks.CONFIG.netherRejuvenation.thePowerOfFriendship; + } + } + } + } + + if (world.getBlockState(pos.up()).isAir() && random.nextFloat() < Tweaks.CONFIG.netherRejuvenation.rootsGrowthRate * (friends)) { + float f = random.nextFloat(); + double ratio = Tweaks.CONFIG.netherRejuvenation.sproutRootsRatio / 100D; + Block block; + + if (f < Tweaks.CONFIG.netherRejuvenation.vinesChance && state.isOf(Blocks.WARPED_NYLIUM)) { + block = Blocks.TWISTING_VINES; + } else if (f > ratio) { + block = state.isOf(Blocks.CRIMSON_NYLIUM) ? Blocks.CRIMSON_ROOTS : Blocks.WARPED_ROOTS; + } else { + block = state.isOf(Blocks.CRIMSON_NYLIUM) ? Blocks.CRIMSON_ROOTS : Blocks.NETHER_SPROUTS; + } + + world.setBlockState(pos.up(), block.getDefaultState()); + } else { + for(int i = 0; i < 4; ++i) { + BlockPos blockPos = pos.add(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + + if (world.getBlockState(blockPos).isOf(Blocks.NETHERRACK) && canSpread(state, world, blockPos)) { + world.setBlockState(blockPos, state); + } + } + } + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/RedstoneTorchMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/RedstoneTorchMixin.java deleted file mode 100644 index 0b79e5a..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/RedstoneTorchMixin.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.hephaestus.tweaks.mixin.block; - -import dev.hephaestus.tweaks.Tweaks; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.block.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldView; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(RedstoneTorchBlock.class) -public class RedstoneTorchMixin extends TorchBlock { - protected RedstoneTorchMixin(Settings settings) { - super(settings); - } - - @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return ((!Tweaks.CONFIG.grassDestroysRedstoneTorches) || world.getBlockState(pos.down()).getBlock() != Blocks.GRASS_BLOCK) && super.canPlaceAt(state, world, pos); - } -} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/StopBubbleColumnsFromFlowing.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/StopBubbleColumnsFromFlowing.java new file mode 100644 index 0000000..32b43f1 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/StopBubbleColumnsFromFlowing.java @@ -0,0 +1,20 @@ +package dev.hephaestus.tweaks.mixin.block; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.BubbleColumnBlock; +import net.minecraft.fluid.Fluid; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.TickScheduler; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = BubbleColumnBlock.class, priority = 2000) +public class StopBubbleColumnsFromFlowing { + @Redirect(method = "getStateForNeighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/TickScheduler;schedule(Lnet/minecraft/util/math/BlockPos;Ljava/lang/Object;I)V", ordinal = 1)) + private void dontFluidTick(TickScheduler tickScheduler, BlockPos pos, T object, int delay) { + if (Tweaks.CONFIG.bubbleColumnsFlow) { + tickScheduler.schedule(pos, object, delay); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/LilyPadBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/betterlilypads/Collision.java similarity index 68% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/LilyPadBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/betterlilypads/Collision.java index 45970fd..4d624f4 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/LilyPadBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/betterlilypads/Collision.java @@ -1,12 +1,8 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.betterlilypads; import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.LilyPadBlock; -import net.minecraft.block.PlantBlock; +import net.minecraft.block.*; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityContext; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; @@ -14,7 +10,6 @@ import net.minecraft.world.World; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -22,10 +17,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(LilyPadBlock.class) -public abstract class LilyPadBlockMixin extends PlantBlock { +public abstract class Collision extends PlantBlock { @Shadow @Final protected static VoxelShape SHAPE; - protected LilyPadBlockMixin(Settings settings) { + protected Collision(Settings settings) { super(settings); } @@ -35,18 +30,19 @@ public void overwriteEntityCollision(BlockState state, World world, BlockPos pos ci.cancel(); } - private static final VoxelShape COLLIDER = Block.createCuboidShape(1.0D, -0.155D, 1.0D, 15.0D, -1.5D, 15.0D); + private static final VoxelShape OUTLINES = Block.createCuboidShape(1D, -1.75D, 1D, 15D, -0.75D, 15D); + private static final VoxelShape COLLIDER = Block.createCuboidShape(1.0D, -10D, 1.0D, 15.0D, 0, 15.0D); @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) - public void overwriteOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context, CallbackInfoReturnable cir) { + public void overwriteOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { if (Tweaks.CONFIG.betterLilyPads) - cir.setReturnValue(COLLIDER); + cir.setReturnValue(OUTLINES); } @Override - public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) { + public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { if (Tweaks.CONFIG.betterLilyPads) - return context.isAbove(COLLIDER, pos, false) ? super.getCollisionShape(state, view, pos, context) : VoxelShapes.empty(); + return context.isAbove(COLLIDER, pos, false) ? COLLIDER : VoxelShapes.empty(); else return super.getCollisionShape(state, view, pos, context); } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/betterlilypads/Rendering.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/betterlilypads/Rendering.java new file mode 100644 index 0000000..a540b34 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/betterlilypads/Rendering.java @@ -0,0 +1,28 @@ +package dev.hephaestus.tweaks.mixin.block.betterlilypads; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.BlockView; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(AbstractBlock.AbstractBlockState.class) +public abstract class Rendering { + @Shadow public abstract Block getBlock(); + + private static final Vec3d DOWN = new Vec3d(0, -0.1D, 0); + + @Inject(method = "getModelOffset", at = @At("HEAD"), cancellable = true) + private void offsetLilyPadsDown(BlockView world, BlockPos pos, CallbackInfoReturnable cir) { + if (Tweaks.CONFIG.betterLilyPads && this.getBlock() == Blocks.LILY_PAD) { + cir.setReturnValue(DOWN); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/doubledoors/Doors.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/doubledoors/Doors.java new file mode 100644 index 0000000..86e193f --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/doubledoors/Doors.java @@ -0,0 +1,73 @@ +package dev.hephaestus.tweaks.mixin.block.doubledoors; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.DoorBlock; +import net.minecraft.block.enums.DoorHinge; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(DoorBlock.class) +public abstract class Doors { + @Shadow @Final public static DirectionProperty FACING; + + @Shadow @Final public static EnumProperty HINGE; + + @Shadow @Final public static BooleanProperty OPEN; + + @Shadow protected abstract int getCloseSoundEventId(); + + @Shadow protected abstract int getOpenSoundEventId(); + + @Shadow @Final public static BooleanProperty POWERED; + + @Inject(method = "onUse", at = @At(value = "TAIL", ordinal = 1)) + private void openOther(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { + openOther(world, pos, player); + } + + @Inject(method = "neighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) + private void openOther(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify, CallbackInfo ci, boolean bl) { + openOther(world, pos, null); + } + + private void openOther(World world, BlockPos pos, PlayerEntity player) { + if (Tweaks.CONFIG.doubleDoors) { + BlockState state = world.getBlockState(pos); + BlockPos otherPos = null; + BlockState otherState = null; + switch (state.get(HINGE)) { + case LEFT: + otherPos = pos.offset(state.get(FACING).rotateYClockwise()); + otherState = world.getBlockState(otherPos); + break; + case RIGHT: + otherPos = pos.offset(state.get(FACING).rotateYCounterclockwise()); + otherState = world.getBlockState(otherPos); + break; + } + + if (otherState.getBlock() == state.getBlock() && otherState.get(FACING) == state.get(FACING) && otherState.get(OPEN) != state.get(OPEN)) { + otherState = otherState.cycle(OPEN); + world.setBlockState(otherPos, otherState, 10); + world.syncWorldEvent(player, state.get(OPEN) ? this.getCloseSoundEventId() : this.getOpenSoundEventId(), pos, 0); + } + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/doubledoors/TrapDoors.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/doubledoors/TrapDoors.java new file mode 100644 index 0000000..45c1850 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/doubledoors/TrapDoors.java @@ -0,0 +1,103 @@ +package dev.hephaestus.tweaks.mixin.block.doubledoors; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.HorizontalFacingBlock; +import net.minecraft.block.TrapdoorBlock; +import net.minecraft.block.enums.BlockHalf; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluids; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +import javax.annotation.Nullable; + +@Mixin(TrapdoorBlock.class) +public abstract class TrapDoors extends HorizontalFacingBlock { + @Shadow @Final public static BooleanProperty OPEN; + + @Shadow @Final public static BooleanProperty WATERLOGGED; + + @Shadow protected abstract void playToggleSound(@Nullable PlayerEntity player, World world, BlockPos pos, boolean open); + + @Shadow @Final public static EnumProperty HALF; + + protected TrapDoors(Settings settings) { + super(settings); + } + + @Inject(method = "onUse", at = @At(value = "TAIL", ordinal = 1)) + private void openOthers(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { + openOthers(world, pos, player); + } + + @Inject(method = "neighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) + private void openOthers(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify, CallbackInfo ci) { + openOthers(world, pos, null); + } + + private void openOthers(World world, BlockPos pos, PlayerEntity player) { + if (Tweaks.CONFIG.doubleDoors) { + BlockState state = world.getBlockState(pos); + BlockPos otherPos = pos.offset(state.get(FACING)); + BlockState otherState = world.getBlockState(otherPos); + if (otherState.getBlock() == state.getBlock() && otherState.get(OPEN) != state.get(OPEN) && otherState.get(HALF) == state.get(HALF)) { + world.setBlockState(otherPos, otherState.cycle(OPEN)); + toggleAdjacent(world, otherPos, player); + } + + toggleAdjacent(world, pos, player); + } + } + + private void toggleAdjacent(World world, BlockPos pos, PlayerEntity player) { + BlockState state = world.getBlockState(pos); + Direction [] dirs = new Direction[2]; + switch (state.get(FACING)) { + case NORTH: + case SOUTH: + dirs[0] = Direction.EAST; + dirs[1] = Direction.WEST; + break; + case WEST: + case EAST: + dirs[0] = Direction.NORTH; + dirs[1] = Direction.SOUTH; + break; + default: + return; + } + + BlockPos otherPos; + BlockState otherState; + for (int d = 0; d < 2; ++d) { + for (int i = 1; i < 16; ++i) { + if ((otherState = world.getBlockState(otherPos = pos.offset(dirs[d], i))).getBlock() == state.getBlock() && otherState.get(OPEN) != state.get(OPEN) && otherState.get(HALF) == state.get(HALF)) { + world.setBlockState(otherPos, otherState.cycle(OPEN), 2); + if (otherState.get(WATERLOGGED)) { + world.getFluidTickScheduler().schedule(otherPos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + } + + this.playToggleSound(player, world, otherPos, otherState.get(OPEN)); + } else { + break; + } + } + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/CocoaBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/CocoaBeans.java similarity index 88% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/CocoaBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/CocoaBeans.java index bfe02ab..604e058 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/CocoaBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/CocoaBeans.java @@ -1,4 +1,4 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.easyharvest; import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.*; @@ -14,8 +14,8 @@ import org.spongepowered.asm.mixin.Mixin; @Mixin(CocoaBlock.class) -public abstract class CocoaBlockMixin extends HorizontalFacingBlock { - protected CocoaBlockMixin(Settings settings) { super(settings);} +public abstract class CocoaBeans extends HorizontalFacingBlock { + protected CocoaBeans(Settings settings) { super(settings);} @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { @@ -26,7 +26,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt stack.setCount(stack.getCount() - 1); } - boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity)player).method_14239(); + boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity)player).isDisconnected(); if (playerAvailable) player.inventory.offerOrDrop(world, stack); else diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/CropBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/Crops.java similarity index 91% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/CropBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/Crops.java index 473bb77..74ad328 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/CropBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/Crops.java @@ -1,4 +1,4 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.easyharvest; import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.Block; @@ -18,8 +18,8 @@ @SuppressWarnings("deprecation") @Mixin(CropBlock.class) -public abstract class CropBlockMixin extends PlantBlock { - protected CropBlockMixin(Settings settings) { +public abstract class Crops extends PlantBlock { + protected Crops(Settings settings) { super(settings); } @@ -35,7 +35,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt stack.setCount(stack.getCount() - 1); } - boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity)player).method_14239(); + boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity)player).isDisconnected(); if (playerAvailable) player.inventory.offerOrDrop(world, stack); else diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/NetherWartBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/NetherWarts.java similarity index 89% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/NetherWartBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/NetherWarts.java index 115b8c6..2302782 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/NetherWartBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/NetherWarts.java @@ -1,4 +1,4 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.easyharvest; import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.Block; @@ -17,8 +17,8 @@ import org.spongepowered.asm.mixin.Mixin; @Mixin(NetherWartBlock.class) -public abstract class NetherWartBlockMixin extends PlantBlock { - protected NetherWartBlockMixin(Settings settings) { super(settings);} +public abstract class NetherWarts extends PlantBlock { + protected NetherWarts(Settings settings) { super(settings);} @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { @@ -29,7 +29,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt stack.setCount(stack.getCount() - 1); } - boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity)player).method_14239(); + boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity)player).isDisconnected(); if (playerAvailable) player.inventory.offerOrDrop(world, stack); else diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/SugarCaneMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/SugarCane.java similarity index 93% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/SugarCaneMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/SugarCane.java index ce8cf96..15ed304 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/SugarCaneMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyharvest/SugarCane.java @@ -1,4 +1,4 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.easyharvest; import dev.hephaestus.tweaks.Tweaks; import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; @@ -22,13 +22,11 @@ import org.spongepowered.asm.mixin.Mixin; @Mixin(SugarCaneBlock.class) -public class SugarCaneMixin extends Block { - public SugarCaneMixin(Settings settings) { +public class SugarCane extends Block { + public SugarCane(Settings settings) { super(settings); } - - private int destroySugarcane(World world, BlockPos pos) { int r = 0; if (world.getBlockState(pos).getBlock() == Blocks.SUGAR_CANE) { @@ -49,7 +47,7 @@ private boolean tryBreakSugarcane(World world, BlockPos pos, PlayerEntity player } if (n > 0) { - boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity) player).method_14239(); + boolean playerAvailable = player.isAlive() || player instanceof ServerPlayerEntity && !((ServerPlayerEntity) player).isDisconnected(); if (playerAvailable) player.inventory.offerOrDrop(world, new ItemStack(Items.SUGAR_CANE, n)); else diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/Blocks.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/Blocks.java new file mode 100644 index 0000000..48589f6 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/Blocks.java @@ -0,0 +1,50 @@ +package dev.hephaestus.tweaks.mixin.block.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.block.PlayerProvider; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Block.class) +public class Blocks implements PlayerProvider { + @Unique private final ThreadLocal playerEntity = new ThreadLocal<>(); + + @Override + public ServerPlayerEntity getPlayer() { + return this.playerEntity.get(); + } + + @Override + public void setPlayer(ServerPlayerEntity player) { + this.playerEntity.set(player); + } + + @Inject(method = "dropStacks(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/entity/BlockEntity;Lnet/minecraft/entity/Entity;Lnet/minecraft/item/ItemStack;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;onStacksDropped(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;)V")) + private static void assignPlayerToBlock(BlockState state, World world, BlockPos pos, BlockEntity blockEntity, Entity entity, ItemStack stack, CallbackInfo ci) { + if (entity instanceof ServerPlayerEntity && Tweaks.CONFIG.easyXp) { + ((PlayerProvider) state.getBlock()).setPlayer((ServerPlayerEntity) entity); + } + } + + @Inject(method = "dropExperience", at = @At("HEAD"), cancellable = true) + protected void depositXpToPlayer(ServerWorld world, BlockPos pos, int size, CallbackInfo ci) { + if (this.getPlayer() != null && Tweaks.CONFIG.easyXp) { + XpUtil.addXp(this.getPlayer(), size); + this.setPlayer(null); + ci.cancel(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/FurnaceBlockEntityPlayerProvider.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/FurnaceBlockEntityPlayerProvider.java new file mode 100644 index 0000000..6ab2c1f --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/FurnaceBlockEntityPlayerProvider.java @@ -0,0 +1,34 @@ +package dev.hephaestus.tweaks.mixin.block.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.block.PlayerProvider; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.block.entity.AbstractFurnaceBlockEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(AbstractFurnaceBlockEntity.class) +public abstract class FurnaceBlockEntityPlayerProvider implements PlayerProvider { + @Shadow private static void dropExperience(World world, Vec3d vec3d, int i, float f) { + throw new RuntimeException(); + } + + @SuppressWarnings("UnresolvedMixinReference") + @Redirect(method = "method_17761", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;dropExperience(Lnet/minecraft/world/World;Lnet/minecraft/util/math/Vec3d;IF)V")) + private static void depositXpToPlayer(World world, Vec3d vec3d, int i, float f) { + ServerPlayerEntity playerEntity = PlayerProvider.STATIC.get().getPlayer(); + + if (playerEntity != null && Tweaks.CONFIG.easyXp) { + XpUtil.addXp(playerEntity, i); + PlayerProvider.init(); + PlayerProvider.STATIC.get().setPlayer(null); + } else { + dropExperience(world, vec3d, i, f); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/PassPlayerToEntity.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/PassPlayerToEntity.java new file mode 100644 index 0000000..b04b3ab --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/easyxp/PassPlayerToEntity.java @@ -0,0 +1,21 @@ +package dev.hephaestus.tweaks.mixin.block.easyxp; + +import dev.hephaestus.tweaks.block.PlayerProvider; +import net.minecraft.block.AbstractFurnaceBlock; +import net.minecraft.block.BlockState; +import net.minecraft.server.network.ServerPlayerEntity; +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(AbstractFurnaceBlock.class) +public class PassPlayerToEntity { + @Inject(method = "onStateReplaced", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;method_27354(Lnet/minecraft/world/World;Lnet/minecraft/util/math/Vec3d;)Ljava/util/List;")) + private void setStaticPlayer(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved, CallbackInfo ci) { + PlayerProvider.init(); + PlayerProvider.STATIC.get().setPlayer(((PlayerProvider) state.getBlock()).getPlayer()); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/block/MoistBlock.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/mossythings/MoistenAbstractBlock.java similarity index 50% rename from src/main/java/dev/hephaestus/tweaks/block/MoistBlock.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/mossythings/MoistenAbstractBlock.java index 920e6eb..ac50746 100644 --- a/src/main/java/dev/hephaestus/tweaks/block/MoistBlock.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/mossythings/MoistenAbstractBlock.java @@ -1,27 +1,24 @@ -package dev.hephaestus.tweaks.block; +package dev.hephaestus.tweaks.mixin.block.mossythings; import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.Block; +import dev.hephaestus.tweaks.block.Moistener; +import net.minecraft.block.AbstractBlock; import net.minecraft.block.BlockState; import net.minecraft.fluid.Fluids; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldView; +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; import java.util.Random; -public class MoistBlock extends Block { - public MoistBlock(Settings settings) { - super(settings); - } - - @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - randomTick(state, world, pos); - } - - public static void randomTick(BlockState state, ServerWorld world, BlockPos pos) { - if (Tweaks.CONFIG.mossyThings) { +@Mixin(AbstractBlock.class) +public class MoistenAbstractBlock { + @Inject(method = "scheduledTick", at = @At("HEAD")) + private void doTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) { + if (Tweaks.CONFIG.mossyThings && Moistener.canMoisten(state.getBlock())) { boolean isSkyVisible = false; boolean isWaterNearby = false; for (BlockPos adjacent : BlockPos.iterate(pos.up().north().west(), pos.down().south().east())) { @@ -30,22 +27,13 @@ public static void randomTick(BlockState state, ServerWorld world, BlockPos pos) } if (isSkyVisible) { - if (world.isRaining()) { + if (world.isRaining() && world.getBiome(pos).getDownfall() > 0) { world.setBlockState(pos, Moistener.moisten(state)); } else if (world.isDay() && !isWaterNearby) { world.setBlockState(pos, Moistener.dry(state)); } + } } } - - @Override - public boolean hasRandomTicks(BlockState state) { - return true; - } - - @Override - public int getTickRate(WorldView worldView) { - return 5; - } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/mossythings/MoistenBlock.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/mossythings/MoistenBlock.java new file mode 100644 index 0000000..81c6ace --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/mossythings/MoistenBlock.java @@ -0,0 +1,19 @@ +package dev.hephaestus.tweaks.mixin.block.mossythings; + +import dev.hephaestus.tweaks.block.Moistener; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +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(Block.class) +public class MoistenBlock { + @Inject(method = "hasRandomTicks", at = @At("HEAD"), cancellable = true) + private void hasRandomTicks(BlockState state, CallbackInfoReturnable cir) { + if (Moistener.canMoisten(state.getBlock())) { + cir.setReturnValue(true); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/FernBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/planthitboxes/FernBlocks.java similarity index 64% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/FernBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/planthitboxes/FernBlocks.java index 7d7e9ef..c98b12f 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/FernBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/planthitboxes/FernBlocks.java @@ -1,11 +1,7 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.planthitboxes; import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.BlockState; -import net.minecraft.block.FernBlock; -import net.minecraft.block.FlowerBlock; -import net.minecraft.block.PlantBlock; -import net.minecraft.entity.EntityContext; +import net.minecraft.block.*; import net.minecraft.item.Items; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -16,15 +12,15 @@ import org.spongepowered.asm.mixin.Shadow; @Mixin(FernBlock.class) -public class FernBlockMixin extends PlantBlock { +public class FernBlocks extends PlantBlock { @Shadow @Final protected static VoxelShape SHAPE; - protected FernBlockMixin(Settings settings) { + protected FernBlocks(Settings settings) { super(settings); } - - public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) { + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { if (!Tweaks.CONFIG.plantHitboxes && !context.isHolding(Items.SHEARS)) return VoxelShapes.empty(); else diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/TallPlantBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/planthitboxes/TallPlants.java similarity index 72% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/TallPlantBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/planthitboxes/TallPlants.java index a47152e..3f49633 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/TallPlantBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/planthitboxes/TallPlants.java @@ -1,11 +1,10 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.planthitboxes; import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.BlockState; -import net.minecraft.block.FernBlock; import net.minecraft.block.PlantBlock; +import net.minecraft.block.ShapeContext; import net.minecraft.block.TallPlantBlock; -import net.minecraft.entity.EntityContext; import net.minecraft.item.Items; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; @@ -14,12 +13,12 @@ import org.spongepowered.asm.mixin.Mixin; @Mixin(TallPlantBlock.class) -public class TallPlantBlockMixin extends PlantBlock { - protected TallPlantBlockMixin(Settings settings) { +public class TallPlants extends PlantBlock { + protected TallPlants(Settings settings) { super(settings); } - public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) { + public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { if (!Tweaks.CONFIG.plantHitboxes && !context.isHolding(Items.SHEARS)) return VoxelShapes.empty(); else diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/DeadBushBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/rejuvenation/RejuvenateDeadBushes.java similarity index 90% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/DeadBushBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/rejuvenation/RejuvenateDeadBushes.java index 2432803..825bde3 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/DeadBushBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/rejuvenation/RejuvenateDeadBushes.java @@ -1,4 +1,4 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.rejuvenation; import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.BlockState; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(DeadBushBlock.class) -public class DeadBushBlockMixin { +public class RejuvenateDeadBushes { @Inject(method = "canPlantOnTop", at = @At("TAIL"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void canBeOnGrass(BlockState floor, BlockView view, BlockPos pos, CallbackInfoReturnable cir) { if (Tweaks.CONFIG.rejuvenation.enabled && floor.getBlock() == Blocks.GRASS_BLOCK) diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/SpreadableBlockMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/rejuvenation/TallGrassSpread.java similarity index 76% rename from src/main/java/dev/hephaestus/tweaks/mixin/block/SpreadableBlockMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/block/rejuvenation/TallGrassSpread.java index 280179b..7a7a8e1 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/SpreadableBlockMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/rejuvenation/TallGrassSpread.java @@ -1,8 +1,7 @@ -package dev.hephaestus.tweaks.mixin.block; +package dev.hephaestus.tweaks.mixin.block.rejuvenation; import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.*; -import net.minecraft.client.MinecraftClient; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import org.spongepowered.asm.mixin.Mixin; @@ -14,12 +13,12 @@ import java.util.Random; @Mixin(SpreadableBlock.class) -public class SpreadableBlockMixin { - @Inject(method = "scheduledTick", at = @At(value = "INVOKE", target = "net/minecraft/block/SpreadableBlock.getDefaultState()Lnet/minecraft/block/BlockState;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) +public class TallGrassSpread { + @Inject(method = "randomTick", at = @At(value = "INVOKE", target = "net/minecraft/block/SpreadableBlock.getDefaultState()Lnet/minecraft/block/BlockState;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void growGrass(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) { if (Tweaks.CONFIG.rejuvenation.enabled && state.getBlock() == Blocks.GRASS_BLOCK) { Block above = world.getBlockState(pos.up()).getBlock(); - int friends = 0; + int friends = 1; for (int x = -1; x <= 1; x++) { @@ -28,19 +27,19 @@ public void growGrass(BlockState state, ServerWorld world, BlockPos pos, Random Block friend = world.getBlockState(pos.add(x, y, z)).getBlock(); if (friend instanceof FernBlock || friend instanceof TallPlantBlock) { friends++; - friends *= 1.25; + friends *= Tweaks.CONFIG.rejuvenation.thePowerOfFriendship; } } } } - if (above == Blocks.AIR && random.nextFloat() < 0.01 + 0.2 * (friends)) { + if (above == Blocks.AIR && random.nextFloat() < Tweaks.CONFIG.rejuvenation.grassGrowthRate * (friends)) { world.setBlockState(pos.up(), Blocks.GRASS.getDefaultState()); ci.cancel(); } else if (Tweaks.CONFIG.rejuvenation.longGrass > 0.000001 && above == Blocks.GRASS) { Random tallGrassRandom = new Random(); tallGrassRandom.setSeed(pos.asLong()); - if (tallGrassRandom.nextFloat() < Tweaks.CONFIG.rejuvenation.longGrass && random.nextFloat() < 0.01) { + if (tallGrassRandom.nextFloat() < Tweaks.CONFIG.rejuvenation.longGrass && random.nextFloat() < Tweaks.CONFIG.rejuvenation.grassGrowthRate) { ((TallPlantBlock) Blocks.TALL_GRASS).placeAt(world, pos.up(), 2); ci.cancel(); } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/client/gui/hud/RenderSoulFire.java b/src/main/java/dev/hephaestus/tweaks/mixin/client/gui/hud/RenderSoulFire.java new file mode 100644 index 0000000..d2b6876 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/client/gui/hud/RenderSoulFire.java @@ -0,0 +1,33 @@ +package dev.hephaestus.tweaks.mixin.client.gui.hud; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.SoulFire; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.hud.InGameOverlayRenderer; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Environment(EnvType.CLIENT) +@Mixin(InGameOverlayRenderer.class) +public class RenderSoulFire { + @Redirect(method = "renderFireOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SpriteIdentifier;getSprite()Lnet/minecraft/client/texture/Sprite;")) + private static Sprite getSoulFireSprite(SpriteIdentifier spriteIdentifier) { + ClientPlayerEntity playerEntity = MinecraftClient.getInstance().player; + + if (playerEntity != null && Tweaks.CONFIG.blueSoulFireEffects) { + SoulFire.FireTypeModifier.of(playerEntity).updateFireType(); + + if (SoulFire.FireTypeModifier.of(playerEntity).getFireType() == SoulFire.FireType.SOUL) { + return SoulFire.SPRITE_1.getSprite(); + } + } + + return spriteIdentifier.getSprite(); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/client/gui/screen/ingame/PopulateSignEditScreen.java b/src/main/java/dev/hephaestus/tweaks/mixin/client/gui/screen/ingame/PopulateSignEditScreen.java new file mode 100644 index 0000000..05f7549 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/client/gui/screen/ingame/PopulateSignEditScreen.java @@ -0,0 +1,31 @@ +package dev.hephaestus.tweaks.mixin.client.gui.screen.ingame; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.block.entity.SignBlockEntity; +import net.minecraft.client.gui.screen.ingame.SignEditScreen; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SignEditScreen.class) +@Environment(EnvType.CLIENT) +public class PopulateSignEditScreen { + @Shadow @Final private String[] text; + + @Shadow @Final private SignBlockEntity sign; + + @Inject(method = "init", at = @At("TAIL")) + private void setRows(CallbackInfo ci) { + for (int i = 0; i < 4; ++i) { + Text text = sign.getTextOnRow(i); + + this.text[i] = (text == null ? LiteralText.EMPTY : text).getString(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/client/particle/GetParticlesForEmptyBlocks.java b/src/main/java/dev/hephaestus/tweaks/mixin/client/particle/GetParticlesForEmptyBlocks.java new file mode 100644 index 0000000..5d572a3 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/client/particle/GetParticlesForEmptyBlocks.java @@ -0,0 +1,20 @@ +package dev.hephaestus.tweaks.mixin.client.particle; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.particle.ParticleManager; +import net.minecraft.util.math.Box; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Environment(EnvType.CLIENT) +@Mixin(ParticleManager.class) +public class GetParticlesForEmptyBlocks { + @Redirect(method = "addBlockBreakingParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/shape/VoxelShape;getBoundingBox()Lnet/minecraft/util/math/Box;")) + private Box makeParticlesForEmptyBlocks(VoxelShape voxelShape) { + return voxelShape.isEmpty() ? VoxelShapes.fullCube().getBoundingBox() : voxelShape.getBoundingBox(); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/client/render/entity/RenderSoulFire.java b/src/main/java/dev/hephaestus/tweaks/mixin/client/render/entity/RenderSoulFire.java new file mode 100644 index 0000000..c4df6b9 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/client/render/entity/RenderSoulFire.java @@ -0,0 +1,49 @@ +package dev.hephaestus.tweaks.mixin.client.render.entity; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.SoulFire; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Environment(EnvType.CLIENT) +@Mixin(EntityRenderDispatcher.class) +public class RenderSoulFire { + @Unique private Entity renderedEntity; + + @Inject(method = "renderFire", at = @At("HEAD")) + private void captureEntity(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Entity entity, CallbackInfo ci) { + this.renderedEntity = entity; + } + + @Redirect(method = "renderFire", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SpriteIdentifier;getSprite()Lnet/minecraft/client/texture/Sprite;", ordinal = 0)) + private Sprite renderSoulFire0(SpriteIdentifier spriteIdentifier) { + SoulFire.FireTypeModifier.of(renderedEntity).updateFireType(); + if (this.renderedEntity != null && Tweaks.CONFIG.blueSoulFireEffects && SoulFire.FireTypeModifier.of(this.renderedEntity).getFireType() == SoulFire.FireType.SOUL) { + return SoulFire.SPRITE_0.getSprite(); + } else { + return spriteIdentifier.getSprite(); + } + } + + @Redirect(method = "renderFire", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/SpriteIdentifier;getSprite()Lnet/minecraft/client/texture/Sprite;", ordinal = 1)) + private Sprite renderSoulFire1(SpriteIdentifier spriteIdentifier) { + SoulFire.FireTypeModifier.of(renderedEntity).updateFireType(); + if (this.renderedEntity != null && Tweaks.CONFIG.blueSoulFireEffects && SoulFire.FireTypeModifier.of(this.renderedEntity).getFireType() == SoulFire.FireType.SOUL) { + return SoulFire.SPRITE_1.getSprite(); + } else { + return spriteIdentifier.getSprite(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/client/render/entity/TippedArrowEntityRenderer.java b/src/main/java/dev/hephaestus/tweaks/mixin/client/render/entity/TippedArrowEntityRenderer.java new file mode 100644 index 0000000..75d481a --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/client/render/entity/TippedArrowEntityRenderer.java @@ -0,0 +1,52 @@ +package dev.hephaestus.tweaks.mixin.client.render.entity; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.render.OverlayTexture; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.ProjectileEntityRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.util.math.Vector3f; +import net.minecraft.entity.projectile.ArrowEntity; +import net.minecraft.entity.projectile.PersistentProjectileEntity; +import net.minecraft.util.math.Matrix3f; +import net.minecraft.util.math.Matrix4f; +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; + +@Environment(EnvType.CLIENT) +@Mixin(ProjectileEntityRenderer.class) +public abstract class TippedArrowEntityRenderer extends EntityRenderer { + protected TippedArrowEntityRenderer(EntityRenderDispatcher dispatcher) { + super(dispatcher); + } + + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;pop()V")) + private void drawArrowHead(T persistentProjectileEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { + if (persistentProjectileEntity instanceof ArrowEntity && ((ArrowEntity) persistentProjectileEntity).getColor() != 0) { + int color = ((ArrowEntity) persistentProjectileEntity).getColor(); + VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(persistentProjectileEntity))); + MatrixStack.Entry entry = matrixStack.peek(); + Matrix4f matrix4f = entry.getModel(); + Matrix3f matrix3f = entry.getNormal(); + + for (int u = 0; u < 4; ++u) { + matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90.0F)); + draw(matrix4f, matrix3f, vertexConsumer, 5, -2, 0.40625F, 0, i, color); + draw(matrix4f, matrix3f, vertexConsumer, 8, -2, 0.5F, 0, i, color); + draw(matrix4f, matrix3f, vertexConsumer, 8, 2, 0.5F, 0.15625F, i, color); + draw(matrix4f, matrix3f, vertexConsumer, 5, 2, 0.40625F, 0.15625F, i, color); + } + } + } + + private void draw(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, int i, int j, float f, float g, int o, int color) { + vertexConsumer.vertex(matrix4f, (float)i, (float)j, 0.001F).color(color >> 16 & 255, color >> 8 & 255, color & 255, 128).texture(f, g).overlay(OverlayTexture.DEFAULT_UV).light(o).normal(matrix3f, (float) 0, (float) 0, (float) 1).next(); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/client/render/model/ModelLoaderMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/client/render/model/ModelLoaderMixin.java new file mode 100644 index 0000000..8e3a91a --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/client/render/model/ModelLoaderMixin.java @@ -0,0 +1,23 @@ +package dev.hephaestus.tweaks.mixin.client.render.model; + +import dev.hephaestus.tweaks.util.SoulFire; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.render.model.ModelLoader; +import net.minecraft.client.util.SpriteIdentifier; +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; + +import java.util.HashSet; + +@Environment(EnvType.CLIENT) +@Mixin(ModelLoader.class) +public class ModelLoaderMixin { + @Inject(method = "method_24150(Ljava/util/HashSet;)V", at = @At("TAIL")) + private static void addSoulFireToHashSet(HashSet hashSet, CallbackInfo ci) { + hashSet.add(SoulFire.SPRITE_0); + hashSet.add(SoulFire.SPRITE_1); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/dev/ChestBlockEntityRendererMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/dev/ChestBlockEntityRendererMixin.java index 74ece0e..222f109 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/dev/ChestBlockEntityRendererMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/dev/ChestBlockEntityRendererMixin.java @@ -21,7 +21,7 @@ public ChestBlockEntityRendererMixin(BlockEntityRenderDispatcher dispatcher) { super(dispatcher); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;pop()V")) + @Inject(method = "render(Lnet/minecraft/block/entity/BlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;pop()V")) public void renderLabel(T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) { if (Tweaks.CONFIG.namesAndThings.containerLabels && blockEntity instanceof LockableContainerBlockEntity) { LabelRenderer.renderLabel((LockableContainerBlockEntity) blockEntity, dispatcher, matrices, vertexConsumers, tickDelta); diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/dev/DepositGrindstoneXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/dev/DepositGrindstoneXp.java new file mode 100644 index 0000000..d051514 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/dev/DepositGrindstoneXp.java @@ -0,0 +1,38 @@ +package dev.hephaestus.tweaks.mixin.dev; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(targets = "net/minecraft/screen/GrindstoneScreenHandler$4") +public abstract class DepositGrindstoneXp { + @Shadow protected abstract int getExperience(World world); + + @Unique private final ThreadLocal player = new ThreadLocal<>(); + + @Inject(method = "onTakeItem", at = @At("HEAD")) + private void captureArgs(PlayerEntity player, ItemStack stack, CallbackInfoReturnable cir) { + this.player.set(player); + } + + @SuppressWarnings("UnresolvedMixinReference") + @Inject(method = "method_17417", at = @At("HEAD"), cancellable = true) + private void depositXpToPlayer(World world, BlockPos blockPos, CallbackInfo ci) { + if (Tweaks.CONFIG.easyXp && this.player.get() instanceof ServerPlayerEntity) { + XpUtil.addXp((ServerPlayerEntity) this.player.get(), this.getExperience(world)); + world.syncWorldEvent(1042, blockPos, 0); + ci.cancel(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/AutoPlant.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/AutoPlant.java new file mode 100644 index 0000000..575ded8 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/AutoPlant.java @@ -0,0 +1,59 @@ +package dev.hephaestus.tweaks.mixin.entity; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.item.Tags; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.pattern.CachedBlockPosition; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.ItemEntity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.tag.ItemTags; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.RaycastContext; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + + +@Mixin(ItemEntity.class) +public abstract class AutoPlant extends Entity { + public AutoPlant(EntityType type, World world) { + super(type, world); + } + + @Shadow public abstract ItemStack getStack(); + + private BlockPos triedToPlantAt; + + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;tick()V")) + public void plantSaplings(CallbackInfo ci) { + if (Tweaks.CONFIG.autoPlanting.enabled && this.age >= Tweaks.CONFIG.autoPlanting.delay) { + ItemStack stack = this.getStack(); + BlockPos pos = this.getBlockPos(); + if (this.getBlockPos() != triedToPlantAt && world.getFluidState(pos).isEmpty()) { + if (stack.getItem().isIn(ItemTags.SAPLINGS) || stack.getItem().isIn(Tags.PLANTABLE) && stack.getItem() instanceof BlockItem) { + ((BlockItem) stack.getItem()).place(new ItemPlacementContext(world, null, null, stack, world.raycast( + new RaycastContext( + new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), + new Vec3d(pos.getX() + 0.5, pos.getY() - 0.5, pos.getZ() + 0.5), + RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.ANY, + this + ) + ))); + + triedToPlantAt = this.getBlockPos(); + } + } + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/BurnUsableEntities.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/BurnUsableEntities.java new file mode 100644 index 0000000..934c496 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/BurnUsableEntities.java @@ -0,0 +1,23 @@ +package dev.hephaestus.tweaks.mixin.entity; + +import net.minecraft.entity.mob.PiglinEntity; +import net.minecraft.entity.passive.VillagerEntity; +import net.minecraft.entity.passive.WanderingTraderEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Items; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +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 = {WanderingTraderEntity.class, PiglinEntity.class, VillagerEntity.class}) +public class BurnUsableEntities { + @Inject(method = "interactMob", at = @At("HEAD"), cancellable = true) + private void useFlintAndSteel(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { + if (player.getStackInHand(hand).getItem().equals(Items.FLINT_AND_STEEL)) { + cir.setReturnValue(ActionResult.PASS); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/ItemEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/ItemEntityMixin.java deleted file mode 100644 index b49599d..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/ItemEntityMixin.java +++ /dev/null @@ -1,48 +0,0 @@ -package dev.hephaestus.tweaks.mixin.entity; - -import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.ItemEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.tag.ItemTags; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - - -@Mixin(ItemEntity.class) -public abstract class ItemEntityMixin extends Entity { - public ItemEntityMixin(EntityType type, World world) { - super(type, world); - } - - @Shadow public abstract ItemStack getStack(); - - private static boolean isDirt(Block block) { - return block == Blocks.DIRT || block == Blocks.GRASS_BLOCK || block == Blocks.PODZOL || block == Blocks.COARSE_DIRT || block == Blocks.MYCELIUM; - } - - private BlockPos triedToPlantAt; - @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;tick()V")) - public void plantSaplings(CallbackInfo ci) { - if (Tweaks.CONFIG.saplingsAutoPlant && this.age > 20) { - ItemStack stack = this.getStack(); - BlockPos pos = this.getBlockPos(); - BlockState state = world.getBlockState(pos); - if (this.getBlockPos() != triedToPlantAt && stack.getItem().isIn(ItemTags.SAPLINGS) && stack.getItem() instanceof BlockItem && state.getBlock() == Blocks.AIR && isDirt(world.getBlockState(pos.down()).getBlock())) { - world.setBlockState(pos, ((BlockItem) stack.getItem()).getBlock().getDefaultState()); - stack.decrement(1); - triedToPlantAt = this.getBlockPos(); - } - } - } -} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/LivingEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/LivingEntityMixin.java deleted file mode 100644 index a116486..0000000 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/LivingEntityMixin.java +++ /dev/null @@ -1,40 +0,0 @@ -package dev.hephaestus.tweaks.mixin.entity; - -import dev.hephaestus.tweaks.Tweaks; -import net.minecraft.block.BlockState; -import net.minecraft.block.LeavesBlock; -import net.minecraft.block.LogBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -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; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -@Mixin(LivingEntity.class) -public abstract class LivingEntityMixin extends Entity { - public LivingEntityMixin(EntityType type, World world) { - super(type, world); - } - - @Inject(method = "isClimbing", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) - public void onIsClimbing(CallbackInfoReturnable info, BlockState state) { - BlockPos pos = this.getBlockPos(); - - if ((state.getBlock() instanceof LeavesBlock || world.getBlockState(pos.up()).getBlock() instanceof LeavesBlock)) { - if (Tweaks.CONFIG.leaves.climb) { - boolean logsAdjacent = - world.getBlockState(pos.north()).getBlock() instanceof LogBlock || - world.getBlockState(pos.east()).getBlock() instanceof LogBlock || - world.getBlockState(pos.south()).getBlock() instanceof LogBlock || - world.getBlockState(pos.west()).getBlock() instanceof LogBlock; - - info.setReturnValue(logsAdjacent); - } - } - } -} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/SoulFireDoesMoreDamage.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/SoulFireDoesMoreDamage.java new file mode 100644 index 0000000..98b369a --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/SoulFireDoesMoreDamage.java @@ -0,0 +1,98 @@ +package dev.hephaestus.tweaks.mixin.entity; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.SoulFire; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Entity.class) +public abstract class SoulFireDoesMoreDamage implements SoulFire.FireTypeModifier { + @Shadow + public World world; + + @Shadow public abstract Box getBoundingBox(); + + @Shadow public abstract boolean isInLava(); + + @Shadow private int fireTicks; + + @Unique private SoulFire.FireType fireType = SoulFire.FireType.NORMAL; + + @Override + public SoulFire.FireType getFireType() { + return this.fireType; + } + + private void setFireType(SoulFire.FireType fireType) { + this.fireType = fireType; + } + + @Override + public void updateFireType() { + if (this.isInLava()) { + setFireType(SoulFire.FireType.NORMAL); + return; + } + + if (Tweaks.CONFIG.blueSoulFireEffects) { + Box box = this.getBoundingBox(); + BlockPos blockPos = new BlockPos(box.minX + 0.001D, box.minY + 0.001D, box.minZ + 0.001D); + BlockPos blockPos2 = new BlockPos(box.maxX - 0.001D, box.maxY - 0.001D, box.maxZ - 0.001D); + BlockPos.Mutable mutable = new BlockPos.Mutable(); + if (this.world.isRegionLoaded(blockPos, blockPos2)) { + for (int i = blockPos.getX(); i <= blockPos2.getX(); ++i) { + for (int j = blockPos.getY(); j <= blockPos2.getY(); ++j) { + for (int k = blockPos.getZ(); k <= blockPos2.getZ(); ++k) { + mutable.set(i, j, k); + + Block fire = this.world.getBlockState(mutable).getBlock(); + if (fire == Blocks.SOUL_FIRE) { + this.setFireType(SoulFire.FireType.SOUL); + } else if (fire == Blocks.FIRE) { + this.setFireType(SoulFire.FireType.NORMAL); + } + } + } + } + } + } + } + + @Inject(method = "setFireTicks", at = @At("HEAD")) + private void setFireType(int ticks, CallbackInfo ci) { + if (ticks > this.fireTicks) { + this.updateFireType(); + } + } + + @ModifyConstant(method = "baseTick", constant = @Constant(floatValue = 1.0F)) + private float getDamage(float damage) { + return this.getFireType() == SoulFire.FireType.NORMAL ? damage : damage * 2; + } + + @Inject(method = "toTag", at = @At("TAIL")) + private void saveFireType(CompoundTag tag, CallbackInfoReturnable cir) { + tag.putString("TinyTweaksFireType", this.getFireType().name()); + } + + @Inject(method = "fromTag", at = @At("HEAD")) + private void loadFireType(CompoundTag tag, CallbackInfo ci) { + if (tag.contains("TinyTweaksFireType")) { + this.setFireType(SoulFire.FireType.valueOf(tag.getString("TinyTweaksFireType"))); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/ai/brain/task/FarmerVillagerTaskMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/ai/brain/task/FarmerVillagersDepositSurplus.java similarity index 92% rename from src/main/java/dev/hephaestus/tweaks/mixin/entity/ai/brain/task/FarmerVillagerTaskMixin.java rename to src/main/java/dev/hephaestus/tweaks/mixin/entity/ai/brain/task/FarmerVillagersDepositSurplus.java index e1a5773..67438af 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/ai/brain/task/FarmerVillagerTaskMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/ai/brain/task/FarmerVillagersDepositSurplus.java @@ -23,7 +23,7 @@ import javax.annotation.Nullable; @Mixin(FarmerVillagerTask.class) -public class FarmerVillagerTaskMixin { +public class FarmerVillagersDepositSurplus { @Shadow @Nullable private BlockPos currentTarget; private BlockPos storage; @@ -57,17 +57,17 @@ public void shouldStoreThings(ServerWorld serverWorld, VillagerEntity villagerEn if (target != null) { Inventory inventory = villagerEntity.getInventory(); - for(int i = 0; i < inventory.getInvSize(); ++i) { - ItemStack stack = inventory.getInvStack(i); + for(int i = 0; i < inventory.size(); ++i) { + ItemStack stack = inventory.getStack(i); if (stack.getCount() > stack.getMaxCount()/2) { int amount = stack.getCount() - stack.getMaxCount()/2; - ItemStack itemStack2 = HopperBlockEntity.transfer(inventory, target, inventory.takeInvStack(i, amount), null); + ItemStack itemStack2 = HopperBlockEntity.transfer(inventory, target, inventory.removeStack(i, amount), null); if (itemStack2.isEmpty()) { inventory.markDirty(); break; } - inventory.getInvStack(i).decrement(amount); + inventory.getStack(i).decrement(amount); } } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/betterlilypads/FallingParticles.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/betterlilypads/FallingParticles.java new file mode 100644 index 0000000..8df44cb --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/betterlilypads/FallingParticles.java @@ -0,0 +1,40 @@ +package dev.hephaestus.tweaks.mixin.entity.betterlilypads; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.particle.BlockStateParticleEffect; +import net.minecraft.particle.ParticleType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(LivingEntity.class) +public abstract class FallingParticles extends Entity { + @Unique private BlockState landedState; + @Unique private BlockPos landedPosition; + + public FallingParticles(EntityType type, World world) { + super(type, world); + } + + @Inject(method = "fall", at = @At(value = "NEW", target = "net/minecraft/particle/BlockStateParticleEffect")) + private void captureArgs(double heightDifference, boolean onGround, BlockState landedState, BlockPos landedPosition, CallbackInfo ci) { + this.landedState = landedState; + this.landedPosition = landedPosition; + } + + @Redirect(method = "fall", at = @At(value = "NEW", target = "net/minecraft/particle/BlockStateParticleEffect")) + private BlockStateParticleEffect lilyPadsOnWater(ParticleType particleType, BlockState blockState) { + BlockState above = this.world.getBlockState(this.landedPosition.up()); + + return new BlockStateParticleEffect(particleType, this.landedState.getBlock().is(Blocks.WATER) && above.getBlock().is(Blocks.LILY_PAD) ? above : this.landedState); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/betterlilypads/SprintingParticles.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/betterlilypads/SprintingParticles.java new file mode 100644 index 0000000..816bfab --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/betterlilypads/SprintingParticles.java @@ -0,0 +1,24 @@ +package dev.hephaestus.tweaks.mixin.entity.betterlilypads; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(Entity.class) +public class SprintingParticles { + @Shadow public World world; + + @Redirect(method = "spawnSprintingParticles", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;")) + private BlockState lilyPadsOnWater(World world, BlockPos pos) { + BlockState original = world.getBlockState(pos); + BlockState above = world.getBlockState(pos.up()); + + return original.getBlock().is(Blocks.WATER) && above.getBlock().is(Blocks.LILY_PAD) ? above : original; + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/AnimalEntityBreedXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/AnimalEntityBreedXp.java new file mode 100644 index 0000000..017383f --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/AnimalEntityBreedXp.java @@ -0,0 +1,39 @@ +package dev.hephaestus.tweaks.mixin.entity.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import javax.annotation.Nullable; + +@Mixin(AnimalEntity.class) +public abstract class AnimalEntityBreedXp extends LivingEntity { + @Shadow @Nullable public abstract ServerPlayerEntity getLovingPlayer(); + + protected AnimalEntityBreedXp(EntityType entityType, World world) { + super(entityType, world); + } + + @Inject(method = "breed", at = @At(value = "NEW", target = "net/minecraft/entity/ExperienceOrbEntity"), cancellable = true) + private void depositXpToPlayer(ServerWorld serverWorld, AnimalEntity other, CallbackInfo ci) { + ServerPlayerEntity playerEntity = this.getLovingPlayer(); + if (playerEntity == null && other.getLovingPlayer() != null) { + playerEntity = other.getLovingPlayer(); + } + + if (playerEntity != null && Tweaks.CONFIG.easyXp) { + XpUtil.addXp(playerEntity, this.getRandom().nextInt(7) + 1); + ci.cancel(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/FishingXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/FishingXp.java new file mode 100644 index 0000000..7f71a2e --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/FishingXp.java @@ -0,0 +1,31 @@ +package dev.hephaestus.tweaks.mixin.entity.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.Entity; +import net.minecraft.entity.ExperienceOrbEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.projectile.FishingBobberEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import javax.annotation.Nullable; + +@Mixin(FishingBobberEntity.class) +public abstract class FishingXp { + @Shadow @Nullable public abstract PlayerEntity getPlayerOwner(); + + @Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z")) + private boolean depositXpToPlayer(World world, Entity entity) { + if (this.getPlayerOwner() != null && Tweaks.CONFIG.easyXp && entity instanceof ExperienceOrbEntity) { + XpUtil.addXp((ServerPlayerEntity) this.getPlayerOwner(), (int) (Math.random() * 6 + 1)); + return false; + } + + return world.spawnEntity(entity); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/LivingEntityGiveXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/LivingEntityGiveXp.java new file mode 100644 index 0000000..b23c920 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/LivingEntityGiveXp.java @@ -0,0 +1,26 @@ +package dev.hephaestus.tweaks.mixin.entity.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin(LivingEntity.class) +public class LivingEntityGiveXp { + @Shadow protected PlayerEntity attackingPlayer; + + @Inject(method = "dropXp", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/entity/LivingEntity;getCurrentExperience(Lnet/minecraft/entity/player/PlayerEntity;)I"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) + private void depositXpToPlayer(CallbackInfo ci, int i) { + if (i > 0 && this.attackingPlayer instanceof ServerPlayerEntity && Tweaks.CONFIG.easyXp) { + XpUtil.addXp((ServerPlayerEntity) this.attackingPlayer, i); + ci.cancel(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/MateGoalXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/MateGoalXp.java new file mode 100644 index 0000000..998e4b6 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/MateGoalXp.java @@ -0,0 +1,33 @@ +package dev.hephaestus.tweaks.mixin.entity.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.ai.goal.AnimalMateGoal; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.FoxEntity; +import net.minecraft.entity.passive.TurtleEntity; +import net.minecraft.server.network.ServerPlayerEntity; +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({ + FoxEntity.MateGoal.class, + TurtleEntity.MateGoal.class +}) +public abstract class MateGoalXp extends AnimalMateGoal { + public MateGoalXp(AnimalEntity animal, double chance) { + super(animal, chance); + } + + @Inject(method = "breed", at = @At(value = "NEW", target = "net/minecraft/entity/ExperienceOrbEntity"), cancellable = true) + private void depositXpToPlayer(CallbackInfo ci) { + ServerPlayerEntity playerEntity = this.animal.getLovingPlayer(); + + if (playerEntity != null && Tweaks.CONFIG.easyXp) { + XpUtil.addXp(playerEntity, this.animal.getRandom().nextInt(7) + 1); + ci.cancel(); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/VillagerTradeXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/VillagerTradeXp.java new file mode 100644 index 0000000..c83988d --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/easyxp/VillagerTradeXp.java @@ -0,0 +1,42 @@ +package dev.hephaestus.tweaks.mixin.entity.easyxp; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.passive.MerchantEntity; +import net.minecraft.entity.passive.VillagerEntity; +import net.minecraft.entity.passive.WanderingTraderEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.village.TradeOffer; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +@Mixin({VillagerEntity.class, WanderingTraderEntity.class}) +public abstract class VillagerTradeXp extends MerchantEntity { + public VillagerTradeXp(EntityType entityType, World world) { + super(entityType, world); + } + + @Unique private int i; + @Inject(method = "afterUsing", at = @At(value = "NEW", target = "net/minecraft/entity/ExperienceOrbEntity"), locals = LocalCapture.CAPTURE_FAILHARD) + private void captureLocals(TradeOffer offer, CallbackInfo ci, int i) { + this.i = i; + } + + @Redirect(method = "afterUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z")) + private boolean depositXpToPlayer(World world, Entity entity) { + if (this.getCurrentCustomer() instanceof ServerPlayerEntity && Tweaks.CONFIG.easyXp) { + XpUtil.addXp((ServerPlayerEntity) this.getCurrentCustomer(), i); + return false; + } else { + return world.spawnEntity(entity); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/ChickenEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/ChickenEntityMixin.java index b9f0422..8555ba2 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/ChickenEntityMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/ChickenEntityMixin.java @@ -6,6 +6,7 @@ import net.minecraft.entity.passive.ChickenEntity; import net.minecraft.entity.passive.PassiveEntity; import net.minecraft.recipe.Ingredient; +import net.minecraft.server.world.ServerWorld; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -17,7 +18,7 @@ import javax.annotation.Nullable; @Mixin(ChickenEntity.class) -public class ChickenEntityMixin extends AnimalEntity { +public abstract class ChickenEntityMixin extends AnimalEntity { @Shadow @Final private static Ingredient BREEDING_INGREDIENT; protected ChickenEntityMixin(EntityType type, World world) { @@ -26,13 +27,6 @@ protected ChickenEntityMixin(EntityType type, World worl @Inject(method = "initGoals", at = @At("TAIL")) public void addGoal(CallbackInfo ci) { - this.goalSelector.add(4, new GroundFoodMateGoal(this, BREEDING_INGREDIENT)); - } - - @Shadow - @Nullable - @Override - public ChickenEntity createChild(PassiveEntity mate) { - return null; + this.goalSelector.add(2, new GroundFoodMateGoal(this, BREEDING_INGREDIENT)); } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/CowEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/CowEntityMixin.java index d04900c..d18d006 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/CowEntityMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/CowEntityMixin.java @@ -17,20 +17,13 @@ import javax.annotation.Nullable; @Mixin(CowEntity.class) -public class CowEntityMixin extends AnimalEntity { +public abstract class CowEntityMixin extends AnimalEntity { protected CowEntityMixin(EntityType type, World world) { super(type, world); } @Inject(method = "initGoals", at = @At("TAIL")) public void addGoal(CallbackInfo ci) { - this.goalSelector.add(4, new GroundFoodMateGoal(this, Ingredient.ofItems(Items.WHEAT))); - } - - @Shadow - @Nullable - @Override - public CowEntity createChild(PassiveEntity mate) { - return null; + this.goalSelector.add(2, new GroundFoodMateGoal(this, Ingredient.ofItems(Items.WHEAT))); } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/HorseAndDonkeyMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/HorseAndDonkeyMixin.java index 49c94ea..289cd6c 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/HorseAndDonkeyMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/HorseAndDonkeyMixin.java @@ -15,7 +15,7 @@ import javax.annotation.Nullable; @Mixin(HorseBaseEntity.class) -public class HorseAndDonkeyMixin extends AnimalEntity { +public abstract class HorseAndDonkeyMixin extends AnimalEntity { private static final Ingredient BREEDING_INGREDIENT = Ingredient.ofItems(Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_CARROT); protected HorseAndDonkeyMixin(EntityType type, World world) { @@ -24,13 +24,6 @@ protected HorseAndDonkeyMixin(EntityType type, World wor @Inject(method = "initGoals", at = @At("TAIL")) protected void initGoals(CallbackInfo ci) { - this.goalSelector.add(3, new GroundFoodMateGoal(this, BREEDING_INGREDIENT)); - } - - @Shadow - @Nullable - @Override - public PassiveEntity createChild(PassiveEntity mate) { - return null; + this.goalSelector.add(2, new GroundFoodMateGoal(this, BREEDING_INGREDIENT)); } } \ No newline at end of file diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/PigEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/PigEntityMixin.java index 5cc747e..7551382 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/PigEntityMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/PigEntityMixin.java @@ -17,7 +17,7 @@ import javax.annotation.Nullable; @Mixin(PigEntity.class) -public class PigEntityMixin extends AnimalEntity { +public abstract class PigEntityMixin extends AnimalEntity { @Shadow @Final private static Ingredient BREEDING_INGREDIENT; protected PigEntityMixin(EntityType type, World world) { @@ -26,13 +26,6 @@ protected PigEntityMixin(EntityType type, World world) { @Inject(method = "initGoals", at = @At("TAIL")) public void addGoal(CallbackInfo ci) { - this.goalSelector.add(4, new GroundFoodMateGoal(this, BREEDING_INGREDIENT)); - } - - @Shadow - @Nullable - @Override - public PigEntity createChild(PassiveEntity mate) { - return null; + this.goalSelector.add(3, new GroundFoodMateGoal(this, BREEDING_INGREDIENT)); } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/SheepEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/SheepEntityMixin.java index 0afc2ef..4c0921c 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/SheepEntityMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/SheepEntityMixin.java @@ -17,20 +17,13 @@ import javax.annotation.Nullable; @Mixin(SheepEntity.class) -public class SheepEntityMixin extends AnimalEntity { +public abstract class SheepEntityMixin extends AnimalEntity { protected SheepEntityMixin(EntityType type, World world) { super(type, world); } @Inject(method = "initGoals", at = @At("TAIL")) public void addGoal(CallbackInfo ci) { - this.goalSelector.add(3, new GroundFoodMateGoal(this, Ingredient.ofItems(Items.WHEAT))); - } - - @Shadow - @Nullable - @Override - public SheepEntity createChild(PassiveEntity mate) { - return null; + this.goalSelector.add(2, new GroundFoodMateGoal(this, Ingredient.ofItems(Items.WHEAT))); } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/WolfEntityMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/WolfEntityMixin.java index 37a1acc..34778e0 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/WolfEntityMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/entity/passive/WolfEntityMixin.java @@ -17,21 +17,14 @@ import javax.annotation.Nullable; @Mixin(WolfEntity.class) -public class WolfEntityMixin extends TameableEntity { +public abstract class WolfEntityMixin extends TameableEntity { protected WolfEntityMixin(EntityType type, World world) { super(type, world); } @Inject(method = "initGoals", at = @At("TAIL")) public void addGoal(CallbackInfo ci) { - this.goalSelector.add(8, new GroundFoodMateGoal(this, this::isBreedingItem)); - } - - @Shadow - @Nullable - @Override - public WolfEntity createChild(PassiveEntity mate) { - return null; + this.goalSelector.add(7, new GroundFoodMateGoal(this, this::isBreedingItem)); } @Redirect(method = "canBreedWith", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;isTamed()Z")) diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/fluid/WaterFluidMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/fluid/WaterFluidMixin.java index 9475cfa..9c30dff 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/fluid/WaterFluidMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/fluid/WaterFluidMixin.java @@ -1,8 +1,9 @@ package dev.hephaestus.tweaks.mixin.fluid; +import dev.hephaestus.tweaks.Tweaks; import dev.hephaestus.tweaks.block.Moistener; import net.minecraft.block.BlockState; -import net.minecraft.fluid.BaseFluid; +import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.WaterFluid; import net.minecraft.util.math.BlockPos; @@ -12,10 +13,10 @@ import java.util.Random; @Mixin(WaterFluid.class) -public abstract class WaterFluidMixin extends BaseFluid { +public abstract class WaterFluidMixin extends Fluid { @Override protected void onRandomTick(World world, BlockPos pos, FluidState state, Random random) { - if (this.isStill(state)) { + if (this.isStill(state) && Tweaks.CONFIG.mossyThings) { Iterable adjacent = BlockPos.iterate(pos.down().north().west(), pos.south().east()); for (BlockPos potentialPos : adjacent) { diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/item/BucketItemMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/item/BucketItemMixin.java new file mode 100644 index 0000000..f6040e8 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/item/BucketItemMixin.java @@ -0,0 +1,50 @@ +package dev.hephaestus.tweaks.mixin.item; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.BubbleColumnBlock; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.BucketItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +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.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(value = BucketItem.class, priority = 2000) +public class BucketItemMixin { + boolean shouldChange = false; + @Inject(method = "use", at = @At("HEAD")) + private void captureVariables(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable> cir) { + shouldChange = user.isSneaking(); + } + + @Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;", ordinal = 2)) + private Block change(BlockState blockState) { + if (shouldChange) + return Blocks.BEDROCK; + else + return blockState.getBlock(); + } + + @Redirect(method = "placeFluid", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) + private boolean placeBubbleColumnIfPossible(World world, BlockPos pos, BlockState state, int flags) { + if (!Tweaks.CONFIG.bubbleColumnsFlow && state.getFluidState().getFluid() == Fluids.WATER) { + BlockState downState = world.getBlockState(pos.down()); + if (downState.getBlock() == Blocks.BUBBLE_COLUMN) + state = downState; + else if (downState.getBlock() == Blocks.SOUL_SAND || downState.getBlock() == Blocks.MAGMA_BLOCK) + state = Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, BubbleColumnBlock.calculateDrag(world, pos.down())); + } + + return world.setBlockState(pos, state, flags); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/item/CharcoalDoesntBurnMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/item/CharcoalDoesntBurnMixin.java new file mode 100644 index 0000000..62a3e87 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/item/CharcoalDoesntBurnMixin.java @@ -0,0 +1,16 @@ +package dev.hephaestus.tweaks.mixin.item; + +import net.minecraft.item.Item; +import net.minecraft.item.Items; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(Items.class) +public class CharcoalDoesntBurnMixin { + @SuppressWarnings("UnresolvedMixinReference") + @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/item/Item", ordinal = 3)) + private static Item charcoalShouldntBurn(Item.Settings settings) { + return new Item(settings.fireproof()); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/item/FlintAndSteelMixin.java b/src/main/java/dev/hephaestus/tweaks/mixin/item/FlintAndSteelMixin.java index eddd75a..a4a3d9f 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/item/FlintAndSteelMixin.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/item/FlintAndSteelMixin.java @@ -6,6 +6,7 @@ import net.minecraft.item.FlintAndSteelItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import org.spongepowered.asm.mixin.Mixin; @@ -16,13 +17,13 @@ public FlintAndSteelMixin(Settings settings) { } @Override - public boolean useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { if (Tweaks.CONFIG.flintAndSteel.enabled && !entity.isFireImmune()) { entity.setOnFireFor(Tweaks.CONFIG.flintAndSteel.burnTime); stack.damage(1, user, ((p) -> p.sendToolBreakStatus(hand))); - return true; + return ActionResult.SUCCESS; } else { - return false; + return ActionResult.PASS; } } } diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/prod/DepositGrindstoneXp.java b/src/main/java/dev/hephaestus/tweaks/mixin/prod/DepositGrindstoneXp.java new file mode 100644 index 0000000..516b5d3 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/prod/DepositGrindstoneXp.java @@ -0,0 +1,44 @@ +package dev.hephaestus.tweaks.mixin.prod; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.XpUtil; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.GrindstoneScreenHandler; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(GrindstoneScreenHandler.class) +public abstract class DepositGrindstoneXp { + @SuppressWarnings("UnresolvedMixinReference") + @Mixin(targets = "net/minecraft/screen/GrindstoneScreenHandler$4") + public static abstract class SlotMixin { + @Shadow + protected abstract int getExperience(World world); + + @Unique + private final ThreadLocal player = new ThreadLocal<>(); + + @Inject(method = "method_7667", remap = false, at = @At("HEAD")) + private void captureArgs(PlayerEntity player, ItemStack stack, CallbackInfoReturnable cir) { + this.player.set(player); + } + + @Inject(method = "method_17417", at = @At("HEAD"), cancellable = true) + private void depositXpToPlayer(World world, BlockPos blockPos, CallbackInfo ci) { + if (Tweaks.CONFIG.easyXp && this.player.get() instanceof ServerPlayerEntity) { + XpUtil.addXp((ServerPlayerEntity) this.player.get(), this.getExperience(world)); + world.syncWorldEvent(1042, blockPos, 0); + ci.cancel(); + } + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/world/SerializeChunkData.java b/src/main/java/dev/hephaestus/tweaks/mixin/world/SerializeChunkData.java new file mode 100644 index 0000000..61204dc --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/world/SerializeChunkData.java @@ -0,0 +1,60 @@ +package dev.hephaestus.tweaks.mixin.world; + +import dev.hephaestus.tweaks.util.CauldronChunk; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.LongArrayTag; +import net.minecraft.nbt.Tag; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.structure.StructureManager; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.world.ChunkSerializer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ProtoChunk; +import net.minecraft.world.chunk.ReadOnlyChunk; +import net.minecraft.world.poi.PointOfInterestStorage; +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; + +import java.util.Map; +import java.util.stream.Collectors; + +@Mixin(ChunkSerializer.class) +public class SerializeChunkData { + @Inject(method = "serialize", at = @At("RETURN")) + private static void serializeCauldrons(ServerWorld world, Chunk chunk, CallbackInfoReturnable cir) { + if (chunk instanceof CauldronChunk && ((CauldronChunk) chunk).getCauldrons().size() > 0) { + getOrCreate(cir.getReturnValue(), "TinyTweaks").put("InfiniteCauldrons", new LongArrayTag( + ((CauldronChunk) chunk).getCauldrons().stream() + .filter(Map.Entry::getValue) + .map(e -> e.getKey().asLong()) + .collect(Collectors.toList()))); + } + } + + @Inject(method = "deserialize", at = @At("RETURN")) + private static void deserializeCauldrons(ServerWorld world, StructureManager structureManager, PointOfInterestStorage poiStorage, ChunkPos pos, CompoundTag tag, CallbackInfoReturnable cir) { + CauldronChunk chunk = (CauldronChunk) cir.getReturnValue(); + chunk = chunk instanceof ReadOnlyChunk ? (CauldronChunk) ((ReadOnlyChunk) chunk).getWrappedChunk() : chunk; + + for (Long l : tag.getCompound("TinyTweaks").getLongArray("InfiniteCauldrons")) { + chunk.setInfinite(BlockPos.fromLong(l), true); + } + } + + private static CompoundTag getOrCreate(CompoundTag tag, String key) { + return getOrCreate(tag, key, new CompoundTag()); + } + + @SuppressWarnings("unchecked") + private static T getOrCreate(CompoundTag tag, String key, T newTag) { + if (tag.contains(key, newTag.getType())) { + return (T) tag.get(key); + } else { + tag.put(key, newTag); + return newTag; + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/world/TrackBlockChanges.java b/src/main/java/dev/hephaestus/tweaks/mixin/world/TrackBlockChanges.java new file mode 100644 index 0000000..cafb38d --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/world/TrackBlockChanges.java @@ -0,0 +1,46 @@ +package dev.hephaestus.tweaks.mixin.world; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.CauldronChunk; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.chunk.ProtoChunk; +import net.minecraft.world.chunk.WorldChunk; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +@Mixin(value = {WorldChunk.class, ProtoChunk.class}) +public abstract class TrackBlockChanges implements BlockView, CauldronChunk { + @Unique private final Map cauldrons = new HashMap<>(); + + @Inject(method = "setBlockState", at = @At("HEAD")) + private void captureStateChange(BlockPos pos, BlockState state, boolean moved, CallbackInfoReturnable cir) { + if (this.getBlockState(pos).isOf(Blocks.CAULDRON) && !state.getBlock().is(Blocks.CAULDRON)) { + cauldrons.remove(pos); + } + } + + @Override + public Collection> getCauldrons() { + return this.cauldrons.entrySet(); + } + + @Override + public boolean isInfinite(BlockPos pos) { + return Tweaks.CONFIG.infiniteCauldrons && this.cauldrons.getOrDefault(pos, false); + } + + @Override + public void setInfinite(BlockPos pos, boolean infinite) { + this.cauldrons.put(pos, infinite); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/world/UpgradeChunk.java b/src/main/java/dev/hephaestus/tweaks/mixin/world/UpgradeChunk.java new file mode 100644 index 0000000..ce5512b --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/mixin/world/UpgradeChunk.java @@ -0,0 +1,25 @@ +package dev.hephaestus.tweaks.mixin.world; + +import dev.hephaestus.tweaks.Tweaks; +import dev.hephaestus.tweaks.util.CauldronChunk; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ProtoChunk; +import net.minecraft.world.chunk.WorldChunk; +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; + +import java.util.Map; + +@Mixin(WorldChunk.class) +public abstract class UpgradeChunk implements CauldronChunk { + @Inject(method = "(Lnet/minecraft/world/World;Lnet/minecraft/world/chunk/ProtoChunk;)V", at = @At("TAIL")) + private void copyCauldrons(World world, ProtoChunk protoChunk, CallbackInfo ci) { + for (Map.Entry entry : ((CauldronChunk) protoChunk).getCauldrons()) { + this.setInfinite(entry.getKey(), entry.getValue()); + Tweaks.log("FUCKING HELL"); + } + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/util/CauldronChunk.java b/src/main/java/dev/hephaestus/tweaks/util/CauldronChunk.java new file mode 100644 index 0000000..6119333 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/util/CauldronChunk.java @@ -0,0 +1,12 @@ +package dev.hephaestus.tweaks.util; + +import net.minecraft.util.math.BlockPos; + +import java.util.Collection; +import java.util.Map; + +public interface CauldronChunk { + boolean isInfinite(BlockPos pos); + void setInfinite(BlockPos pos, boolean infinite); + Collection> getCauldrons(); +} diff --git a/src/main/java/dev/hephaestus/tweaks/util/SoulFire.java b/src/main/java/dev/hephaestus/tweaks/util/SoulFire.java new file mode 100644 index 0000000..71f8650 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/util/SoulFire.java @@ -0,0 +1,27 @@ +package dev.hephaestus.tweaks.util; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.texture.SpriteAtlasTexture; +import net.minecraft.client.util.SpriteIdentifier; +import net.minecraft.util.Identifier; + +@Environment(EnvType.CLIENT) +public class SoulFire { + public static final SpriteIdentifier SPRITE_0 = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("block/soul_fire_0")); + public static final SpriteIdentifier SPRITE_1 = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("block/soul_fire_1")); + + public enum FireType { + NORMAL, + SOUL + } + + public interface FireTypeModifier { + static FireTypeModifier of(Object object) { + return (FireTypeModifier) object; + } + + FireType getFireType(); + void updateFireType(); + } +} diff --git a/src/main/java/dev/hephaestus/tweaks/util/XpUtil.java b/src/main/java/dev/hephaestus/tweaks/util/XpUtil.java new file mode 100644 index 0000000..542c8b1 --- /dev/null +++ b/src/main/java/dev/hephaestus/tweaks/util/XpUtil.java @@ -0,0 +1,35 @@ +package dev.hephaestus.tweaks.util; + +import dev.hephaestus.tweaks.Tweaks; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.item.ItemStack; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; + +import java.util.Map; +import java.util.Random; + +public class XpUtil { + private static final Random random = new Random(); + public static void addXp(ServerPlayerEntity player, int amount) { + if (amount > 0) { + Map.Entry entry = EnchantmentHelper.chooseEquipmentWith(Enchantments.MENDING, player, ItemStack::isDamaged); + if (entry != null) { + ItemStack itemStack = entry.getValue(); + if (!itemStack.isEmpty() && itemStack.isDamaged()) { + int i = Math.min(amount * 2, itemStack.getDamage()); + amount -= i / 2; + itemStack.setDamage(itemStack.getDamage() - i); + } + } + + player.addExperience(amount); + player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.1F, (random.nextFloat() - random.nextFloat()) * 0.35F + 0.9F); + } else { + Tweaks.log("Huh"); + } + } +} diff --git a/src/main/resources/assets/minecraft/models/block/lily_pad.json b/src/main/resources/assets/minecraft/models/block/lily_pad.json deleted file mode 100644 index 953ddaf..0000000 --- a/src/main/resources/assets/minecraft/models/block/lily_pad.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "ambientocclusion": false, - "textures": { - "particle": "block/lily_pad", - "texture": "block/lily_pad" - }, - "elements": [ - { "from": [ 0, -1.55, 0 ], - "to": [ 16, -1.5, 16 ], - "faces": { - "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, - "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } - } - } - ] -} diff --git a/src/main/resources/assets/tinytweaks/lang/en_us.json b/src/main/resources/assets/tinytweaks/lang/en_us.json index 108e33e..2b8db9b 100644 --- a/src/main/resources/assets/tinytweaks/lang/en_us.json +++ b/src/main/resources/assets/tinytweaks/lang/en_us.json @@ -3,8 +3,8 @@ "text.autoconfig.boolean.value.true": "On", "text.autoconfig.tinytweaks.category.plants": "Plants", "text.autoconfig.tinytweaks.category.animals": "Animals", + "text.autoconfig.tinytweaks.category.nether": "Nether", "text.autoconfig.tinytweaks.category.misc": "Miscellaneous", - "text.autoconfig.tinytweaks.category.debug": "Debug", "text.autoconfig.tinytweaks.option.easyHarvestCrops": "Easy Harvest Crops", "text.autoconfig.tinytweaks.option.easyHarvestCrops.@Tooltip": "Right clicking fully grown crops harvests and replants them", "text.autoconfig.tinytweaks.option.easyHarvestSugarcane": "Easy Harvest Sugarcane", @@ -16,8 +16,14 @@ "text.autoconfig.tinytweaks.option.flintAndSteel.enabled": "Should Burn Entities", "text.autoconfig.tinytweaks.option.flintAndSteel.enabled.@Tooltip": "Right click mobs with flint and steel to light them on fire", "text.autoconfig.tinytweaks.option.flintAndSteel.burnTime": "Burn Time (in seconds)", - "text.autoconfig.tinytweaks.option.saplingsAutoPlant": "Sapling Succession", - "text.autoconfig.tinytweaks.option.saplingsAutoPlant.@Tooltip": "Saplings that fall on dirt or grass will automatically plant", + "text.autoconfig.tinytweaks.option.autoPlanting": "Auto Planting", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled": "Enabled", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled.@Tooltip[0]": "Plants that fall on their base block plant themselves", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled.@Tooltip[1]": "By default applies to saplings, wheat seeds, pumpkin seeds,", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled.@Tooltip[2]": "melon seeds, beetroot seeds, carrots, and potatoes", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled.@Tooltip[3]": "§7§oCan be modified with datapacks via the \"plantable\" tag", + "text.autoconfig.tinytweaks.option.autoPlanting.delay": "Plant Delay", + "text.autoconfig.tinytweaks.option.autoPlanting.delay.@Tooltip": "Delay (in ticks) before items plant themselves", "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]": "§cRequires restart", @@ -28,6 +34,14 @@ "text.autoconfig.tinytweaks.option.rejuvenation": "Rejuvenation", "text.autoconfig.tinytweaks.option.rejuvenation.enabled": "Enabled", "text.autoconfig.tinytweaks.option.rejuvenation.enabled.@Tooltip": "Grass grows taller over time", + "text.autoconfig.tinytweaks.option.rejuvenation.grassGrowthRate": "Grass Growth Rate", + "text.autoconfig.tinytweaks.option.rejuvenation.grassGrowthRate.@Tooltip": "Percent chance of grass spreading", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship": "The Power of Friendship", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[0]": "Changes how high of an influence adjacent", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[1]": "grass has on the chance of grass growing", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[2]": "", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[3]": "§7§oRepresents the power of a pseudo-", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[4]": "§7§oexponential function, so be careful", "text.autoconfig.tinytweaks.option.rejuvenation.longGrass": "Long Grass", "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.@Tooltip[0]": "Percent of grass that can grow into tall grass", "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.@Tooltip[1]": "0.0 is disabled, 0.01 is default, 1.0 is all of them", @@ -42,7 +56,11 @@ "text.autoconfig.tinytweaks.option.leaves.collide": "Leaf Collision", "text.autoconfig.tinytweaks.option.leaves.slow": "Leaves Slow", "text.autoconfig.tinytweaks.option.leaves.slow.@Tooltip": "Leaves slow non-item entities passing through them", + "text.autoconfig.tinytweaks.option.leaves.slowAmount": "Slow Amount", "text.autoconfig.tinytweaks.option.leaves.climb": "Climbable Trees", + "text.autoconfig.tinytweaks.option.leaves.treeClimbingSpeed": "Tree Climbing Speed", + "text.autoconfig.tinytweaks.option.leaves.treeClimbingSpeed.@Tooltip[0]": "Controls the speed at which you climb trees", + "text.autoconfig.tinytweaks.option.leaves.treeClimbingSpeed.@Tooltip[1]": "1.0 is the default speed for ladders and vines", "text.autoconfig.tinytweaks.option.leaves.persistentCollide": "Persistent Leaf Collision", "text.autoconfig.tinytweaks.option.leaves.persistentCollide.@Tooltip": "These are leaves placed by the player", "text.autoconfig.tinytweaks.option.namesAndThings": "Names and Things", @@ -53,12 +71,47 @@ "text.autoconfig.tinytweaks.option.betterLilyPads.@Tooltip[0]": "Allows boats to pass through lily pads without breaking them", "text.autoconfig.tinytweaks.option.betterLilyPads.@Tooltip[1]": "Also allows entities to rise through the bottom of a lily pad", "text.autoconfig.tinytweaks.option.mossyThings": "Mossy Things", - "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[0]": "Cobblestone, stone bricks, and their stairs/slabs/walls turn mossy when near water or in rain", - "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[1]": "Mossy cobblestone, stone bricks, and their stairs/slabs/walls turn normal in sunlight", - "text.autoconfig.tinytweaks.option.grassDestroysRedstoneTorches": "Grass Destroys Redstone Torches", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[0]": "Cobblestone, stone bricks, and their stairs/slabs/walls", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[1]": "turn mossy when near water or in rain", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[2]": "Mossy cobblestone, stone bricks, and their stairs/slabs/", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[3]": "walls turn normal in sunlight", + "text.autoconfig.tinytweaks.option.burningLogsDropCharcoal": "Burned Logs Drop Charcoal", + "text.autoconfig.tinytweaks.option.doubleDoors": "Double Doors & Trapdoors", + "text.autoconfig.tinytweaks.option.doubleDoors.@Tooltip[0]": "Doors and trapdoors open adjacent doors and trapdoors of the same type", + "text.autoconfig.tinytweaks.option.doubleDoors.@Tooltip[1]": "Works when opened by hand or with redstone", + "text.autoconfig.tinytweaks.option.bubbleColumnsFlow": "Bubble Columns Flow", + "text.autoconfig.tinytweaks.option.netherRejuvenation": "Nether Rejuvenation", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled": "Enabled", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.@Tooltip[0]": "Causes nylium, roots, and nether sprouts to spread", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.@Tooltip[1]": "Only spread within their respective biomes", + "text.autoconfig.tinytweaks.option.netherRejuvenation.rootsGrowthRate": "Growth Rate", + "text.autoconfig.tinytweaks.option.netherRejuvenation.rootsGrowthRate.@Tooltip": "Percent chance of roots/sprouts spreading", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship": "The Power of Friendship", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[0]": "Changes how high of an influence adjacent", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[1]": "roots have on the chance of roots growing", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[2]": "", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[3]": "§7§oRepresents the power of a pseudo-", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[4]": "§7§oexponential function, so be careful", + "text.autoconfig.tinytweaks.option.netherRejuvenation.sproutRootsRatio": "Ratio of Sprouts to Roots", + "text.autoconfig.tinytweaks.option.netherRejuvenation.sproutRootsRatio.@Tooltip[0]": "0 is all sprouts and no roots, 100 is all roots and no sprouts", + "text.autoconfig.tinytweaks.option.netherRejuvenation.sproutRootsRatio.@Tooltip[1]": "Only effects the Warped Forest biome", + "text.autoconfig.tinytweaks.option.netherRejuvenation.vinesChance": "Vines Chance", + "text.autoconfig.tinytweaks.option.netherRejuvenation.vinesChance.@Tooltip[0]": "Percent chance of warped vines spawning", + "text.autoconfig.tinytweaks.option.netherRejuvenation.vinesChance.@Tooltip[1]": "0.0 is never, 1.0 is every random tick", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects": "Improved Soul Fire", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects.@Tooltip[0]": "Makes fire rendered on the hud and entities on fire blue", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects.@Tooltip[1]": "when lit on fire by soul fire", + "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage": "Higher Damage Soul Fire", + "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage.@Tooltip[0]": "Makes entities ignited by soul fire take", + "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage.@Tooltip[1]": "twice as much damage while burning", + "text.autoconfig.tinytweaks.option.infiniteCauldrons": "Infinite Cauldrons", + "text.autoconfig.tinytweaks.option.infiniteCauldrons.@Tooltip": "Right click a cauldron with a Heart of the Sea to make it infinite", + "text.autoconfig.tinytweaks.option.easyXp": "Easy XP", + "text.autoconfig.tinytweaks.option.easyXp.@Tooltip[0]": "XP is given right to the player, instead of spawning", + "text.autoconfig.tinytweaks.option.easyXp.@Tooltip[1]": "experience orbs in the world", "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.true": "§aOn", - "text.autoconfig.tinytweaks.option.saplingsAutoPlant.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.rejuvenation.enabled.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.rejuvenation.saplings.boolean.true": "§aOn", @@ -76,9 +129,17 @@ "text.autoconfig.tinytweaks.option.leaves.persistentCollide.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.leaves.climb.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.mossyThings.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.burningLogsDropCharcoal.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.doubleDoors.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.bubbleColumnsFlow.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.infiniteCauldrons.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.easyXp.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage.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", + "text.autoconfig.tinytweaks.option.autoPlanting.enabled.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.rejuvenation.enabled.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.rejuvenation.saplings.boolean.false": "§cOff", @@ -95,5 +156,14 @@ "text.autoconfig.tinytweaks.option.leaves.slow.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.leaves.persistentCollide.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.leaves.climb.boolean.false": "§cOff", - "text.autoconfig.tinytweaks.option.mossyThings.boolean.false": "§cOff" + "text.autoconfig.tinytweaks.option.mossyThings.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.burningLogsDropCharcoal.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.doubleDoors.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.bubbleColumnsFlow.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.infiniteCauldrons.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.easyXp.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage.boolean.false": "§cOff", + "block.cauldron.makeInfinite": "This cauldron has been blessed with the heart of the sea" } \ No newline at end of file diff --git a/src/main/resources/assets/tinytweaks/lang/zh_cn.json b/src/main/resources/assets/tinytweaks/lang/zh_cn.json new file mode 100644 index 0000000..b595cd1 --- /dev/null +++ b/src/main/resources/assets/tinytweaks/lang/zh_cn.json @@ -0,0 +1,148 @@ +{ + "text.autoconfig.tinytweaks.title": "细微调整 (Tiny Tweaks)", + "text.autoconfig.boolean.value.true": "启用", + "text.autoconfig.tinytweaks.category.plants": "植物", + "text.autoconfig.tinytweaks.category.animals": "动物", + "text.autoconfig.tinytweaks.category.nether": "下界", + "text.autoconfig.tinytweaks.category.misc": "杂项", + "text.autoconfig.tinytweaks.option.easyHarvestCrops": "一键收获农作物", + "text.autoconfig.tinytweaks.option.easyHarvestCrops.@Tooltip": "右键成熟的农作物以收获并补种它们", + "text.autoconfig.tinytweaks.option.easyHarvestSugarcane": "一键收获甘蔗", + "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.@Tooltip[0]": "右键一格甘蔗以收取高于它的所有甘蔗", + "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.@Tooltip[1]": "( 会保留最底层的甘蔗根 )", + "text.autoconfig.tinytweaks.option.farmerVillagerAutomation": "农夫自动囤粮", + "text.autoconfig.tinytweaks.option.farmerVillagerAutomation.@Tooltip": "农夫村民会将多余的收成存放到附近的箱子里", + "text.autoconfig.tinytweaks.option.flintAndSteel": "对生物用打火石", + "text.autoconfig.tinytweaks.option.flintAndSteel.enabled": "可以点燃生物", + "text.autoconfig.tinytweaks.option.flintAndSteel.enabled.@Tooltip": "用打火石右键生物来点燃它们", + "text.autoconfig.tinytweaks.option.flintAndSteel.burnTime": "燃烧时间 (秒)", + "text.autoconfig.tinytweaks.option.saplingsAutoPlant": "落地成树", + "text.autoconfig.tinytweaks.option.saplingsAutoPlant.@Tooltip": "掉落在泥土或草方块上的树苗会自动种植在上面", + "text.autoconfig.tinytweaks.option.lanternBlastResistance": "坚挺的灯笼", + "text.autoconfig.tinytweaks.option.lanternBlastResistance.@Tooltip[0]": "给予灯笼 6 级的爆炸抗性", + "text.autoconfig.tinytweaks.option.lanternBlastResistance.@Tooltip[1]": "§c需要重启游戏", + "text.autoconfig.tinytweaks.option.animalsEatOffGround": "动物吃草", + "text.autoconfig.tinytweaks.option.animalsEatOffGround.@Tooltip": "鸡, 牛, 马, 猪, 羊和狼会把绿地吃贫瘠", + "text.autoconfig.tinytweaks.option.breedWildWolves": "野生狼群繁殖", + "text.autoconfig.tinytweaks.option.breedWildWolves.@Tooltip": "野生狼群也可以繁殖了!", + "text.autoconfig.tinytweaks.option.rejuvenation": "植物复兴", + "text.autoconfig.tinytweaks.option.rejuvenation.enabled": "启用", + "text.autoconfig.tinytweaks.option.rejuvenation.enabled.@Tooltip": "植物会随时间生长", + "text.autoconfig.tinytweaks.option.rejuvenation.grassGrowthRate": "草丛蔓延率", + "text.autoconfig.tinytweaks.option.rejuvenation.grassGrowthRate.@Tooltip": "草丛蔓延的概率", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship": "邻里草丛的力量", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[0]": "调整目标方块周围的草丛", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[1]": "对其生成草丛概率的影响", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[2]": "", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[3]": "§7§o该数值表示一个伪指数函数的指数,", + "text.autoconfig.tinytweaks.option.rejuvenation.thePowerOfFriendship.@Tooltip[4]": "§7§o所以调整时请务必小心谨慎", + "text.autoconfig.tinytweaks.option.rejuvenation.longGrass": "草丛长高", + "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.@Tooltip[0]": "可以长成高草丛的草的百分比", + "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.@Tooltip[1]": "( 0.0 表示关闭此功能, 0.01 为默认值, 1.0 表示所有草都会长高 )", + "text.autoconfig.tinytweaks.option.rejuvenation.saplings": "树苗复生", + "text.autoconfig.tinytweaks.option.rejuvenation.saplings.@Tooltip": "枯死的灌木在草方块上会恢复成树苗", + "text.autoconfig.tinytweaks.option.plantHitboxes": "植物互动箱", + "text.autoconfig.tinytweaks.option.plantHitboxes.@Tooltip[0]": "当 §a启用§r 时, 与原版相比不会有任何变化", + "text.autoconfig.tinytweaks.option.plantHitboxes.@Tooltip[1]": "当 §c关闭§r 时, 草丛、花卉和海草将不再拥有交互箱", + "text.autoconfig.tinytweaks.option.plantHitboxes.@Tooltip[2]": "( 在草方块上使用锹或锄头,会破坏附着其上的植物 )", + "text.autoconfig.tinytweaks.option.plantHitboxes.@Tooltip[3]": "( 手持剪刀就可以看见交互箱了 )", + "text.autoconfig.tinytweaks.option.leaves": "可穿过的树叶", + "text.autoconfig.tinytweaks.option.leaves.collide": "自然生成树叶的碰撞箱", + "text.autoconfig.tinytweaks.option.leaves.slow": "在树叶中穿行时会减速", + "text.autoconfig.tinytweaks.option.leaves.slow.@Tooltip": "树叶将会减速身处其中的非物品实体", + "text.autoconfig.tinytweaks.option.leaves.slowAmount": "减速幅度", + "text.autoconfig.tinytweaks.option.leaves.climb": "可攀爬的树干", + "text.autoconfig.tinytweaks.option.leaves.persistentCollide": "手动放置树叶的碰撞箱", + "text.autoconfig.tinytweaks.option.leaves.persistentCollide.@Tooltip": "此指玩家手动放置的树叶方块", + "text.autoconfig.tinytweaks.option.namesAndThings": "命名显示", + "text.autoconfig.tinytweaks.option.namesAndThings.containerLabels": "箱子标签", + "text.autoconfig.tinytweaks.option.namesAndThings.containerLabels.@Tooltip": "看向箱子时会显示其名称标签", + "text.autoconfig.tinytweaks.option.namesAndThings.labelScale": "标签尺寸", + "text.autoconfig.tinytweaks.option.betterLilyPads": "更好的睡莲", + "text.autoconfig.tinytweaks.option.betterLilyPads.@Tooltip[0]": "允许船只在不破坏睡莲的情况下穿过它们,", + "text.autoconfig.tinytweaks.option.betterLilyPads.@Tooltip[1]": "同时也允许实体从睡莲下方浮上水面", + "text.autoconfig.tinytweaks.option.mossyThings": "潮湿的家伙", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[0]": "圆石、石砖以及它们的楼梯、台阶和墙体变种", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[1]": "会在接近水源或暴露于雨水中时转化为苔石及其变种方块", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[2]": "而苔石以及它的楼梯、台阶和墙体变种", + "text.autoconfig.tinytweaks.option.mossyThings.@Tooltip[3]": "会在阳光下恢复其原本的样子", + "text.autoconfig.tinytweaks.option.burningLogsDropCharcoal": "烧毁的原木会掉落木炭", + "text.autoconfig.tinytweaks.option.doubleDoors": "双门", + "text.autoconfig.tinytweaks.option.doubleDoors.@Tooltip[0]": "使用一扇门 / 活板门时, 也会同时使用其相邻的同种门 / 活板门", + "text.autoconfig.tinytweaks.option.doubleDoors.@Tooltip[1]": "( 只在用手或改变红石信号时有效 )", + "text.autoconfig.tinytweaks.option.bubbleColumnsFlow": "气泡柱流", + "text.autoconfig.tinytweaks.option.netherRejuvenation": "下界复兴", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled": "启用", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.@Tooltip[0]": "菌岩、菌索和下界苗会逐渐蔓延", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.@Tooltip[1]": "( 蔓延范围仅限于对应群系中 )", + "text.autoconfig.tinytweaks.option.netherRejuvenation.rootsGrowthRate": "菌索 / 下界苗蔓延率", + "text.autoconfig.tinytweaks.option.netherRejuvenation.rootsGrowthRate.@Tooltip": "菌索 / 下界苗蔓延的概率", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship": "邻里菌索的力量", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[0]": "调整目标方块周围的菌索", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[1]": "对其生成菌索概率的影响", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[2]": "", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[3]": "§7§o该数值表示一个伪指数函数的指数,", + "text.autoconfig.tinytweaks.option.netherRejuvenation.thePowerOfFriendship.@Tooltip[4]": "§7§o所以调整时请务必小心谨慎", + "text.autoconfig.tinytweaks.option.netherRejuvenation.sproutRootsRatio": "下界苗 / 菌索比例 ( 设定值等于菌索的百分比 )", + "text.autoconfig.tinytweaks.option.netherRejuvenation.sproutRootsRatio.@Tooltip[0]": "0 表示只生成下界苗而没有菌索, 100 表示都是菌索而没有下界苗", + "text.autoconfig.tinytweaks.option.netherRejuvenation.sproutRootsRatio.@Tooltip[1]": "( 仅影响诡异森林群系 )", + "text.autoconfig.tinytweaks.option.netherRejuvenation.vinesChance": "缠怨藤生成率", + "text.autoconfig.tinytweaks.option.netherRejuvenation.vinesChance.@Tooltip[0]": "蔓延过程中生成缠怨藤的概率", + "text.autoconfig.tinytweaks.option.netherRejuvenation.vinesChance.@Tooltip[1]": "( 0.0 表示永不生成, 1.0 表示每个随机刻都尝试生成 )", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects": "改进的灵魂火", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects.@Tooltip[0]": "被灵魂火点燃后, HUD 中的火焰渲染", + "text.autoconfig.tinytweaks.option.blueSoulFireEffects.@Tooltip[1]": "和实体身上的火焰渲染都会变为蓝色", + "text.autoconfig.tinytweaks.option.infiniteCauldrons": "无限水源的炼药锅", + "text.autoconfig.tinytweaks.option.infiniteCauldrons.@Tooltip": "用海洋之心右键一个炼药锅以使其永不枯竭", + "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.saplingsAutoPlant.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.rejuvenation.enabled.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.rejuvenation.saplings.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.farmerVillagerAutomation.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.animalsEatOffGround.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.breedWildWolves.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.flintAndSteel.enabled.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.lanternBlastResistance.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.betterLilyPads.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.namesAndThings.freeRenames.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.namesAndThings.containerLabels.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.plantHitboxes.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.leaves.collide.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.leaves.slow.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.leaves.persistentCollide.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.leaves.climb.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.mossyThings.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.burningLogsDropCharcoal.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.doubleDoors.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.bubbleColumnsFlow.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.infiniteCauldrons.boolean.true": "§a启用", + "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.saplingsAutoPlant.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.rejuvenation.enabled.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.rejuvenation.longGrass.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.rejuvenation.saplings.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.farmerVillagerAutomation.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.animalsEatOffGround.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.breedWildWolves.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.flintAndSteel.enabled.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.lanternBlastResistance.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.betterLilyPads.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.namesAndThings.freeRenames.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.namesAndThings.containerLabels.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.plantHitboxes.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.leaves.collide.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.leaves.slow.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.leaves.persistentCollide.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.leaves.climb.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.mossyThings.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.burningLogsDropCharcoal.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.doubleDoors.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.bubbleColumnsFlow.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.netherRejuvenation.enabled.boolean.false": "§c关闭", + "text.autoconfig.tinytweaks.option.infiniteCauldrons.boolean.false": "§c关闭", + "block.cauldron.makeInfinite": "这个炼药锅现已被海洋之心所祝福" +} diff --git a/src/main/resources/data/tinytweaks/tags/items/plantable.json b/src/main/resources/data/tinytweaks/tags/items/plantable.json new file mode 100644 index 0000000..1206de6 --- /dev/null +++ b/src/main/resources/data/tinytweaks/tags/items/plantable.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "minecraft:wheat_seeds", + "minecraft:pumpkin_seeds", + "minecraft:melon_seeds", + "minecraft:beetroot_seeds", + "minecraft:carrot", + "minecraft:potato" + ] +} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5b2b40a..fcbdbf7 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -9,6 +9,7 @@ ], "contributors": [], "contact": { + "website": "https://www.curseforge.com/minecraft/mc-mods/tinytweaks", "sources": "https://github.com/Hephaestus-Dev/TinyTweaks", "issues": "https://github.com/Hephaestus-Dev/TinyTweaks/issues" }, @@ -26,11 +27,16 @@ "dev.hephaestus.tweaks.ModMenuIntegration" ] }, + "accessWidener" : "tweaks.accesswidener", "mixins": [ "tweaks.mixins.json" ], "depends": { + "minecraft": ">=1.16.2", "fabricloader": ">=0.4.0", "fabric": "*" + }, + "breaks": { + "onsoulfire": "*" } } \ No newline at end of file diff --git a/src/main/resources/tweaks.accesswidener b/src/main/resources/tweaks.accesswidener new file mode 100644 index 0000000..60e98d0 --- /dev/null +++ b/src/main/resources/tweaks.accesswidener @@ -0,0 +1,6 @@ +accessWidener v1 named +accessible class net/minecraft/entity/passive/FoxEntity$MateGoal +accessible class net/minecraft/entity/passive/TurtleEntity$MateGoal +accessible method net/minecraft/item/ItemPlacementContext (Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/hit/BlockHitResult;)V +accessible method net/minecraft/block/BubbleColumnBlock calculateDrag (Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z +accessible field net/minecraft/block/EntityShapeContext ABSENT Lnet/minecraft/block/ShapeContext; \ No newline at end of file diff --git a/src/main/resources/tweaks.mixins.json b/src/main/resources/tweaks.mixins.json index 6305fca..32d7096 100644 --- a/src/main/resources/tweaks.mixins.json +++ b/src/main/resources/tweaks.mixins.json @@ -4,24 +4,42 @@ "compatibilityLevel": "JAVA_8", "plugin": "dev.hephaestus.tweaks.mixin.VolatileMixinPlugin", "mixins": [ - "block.CocoaBlockMixin", - "block.CropBlockMixin", - "block.DeadBushBlockMixin", - "block.FernBlockMixin", - "block.FlowerBlockMixin", - "block.LanternResistanceMixin", - "block.LeavesBlockMixin", - "block.LilyPadBlockMixin", - "block.MoistBlocksMixin", - "block.MoistObjectsMixin", - "block.NetherWartBlockMixin", - "block.RedstoneTorchMixin", - "block.SpreadableBlockMixin", - "block.SugarCaneMixin", - "block.TallPlantBlockMixin", - "entity.ItemEntityMixin", - "entity.LivingEntityMixin", - "entity.ai.brain.task.FarmerVillagerTaskMixin", + "block.BurnedLogsDropCharcoal", + "block.EditableSigns", + "block.LeafCollision", + "block.MakeCauldronsInfinite", + "block.MakeLanternsBlastResistant", + "block.NetherRejuvenationNyliumSpread", + "block.StopBubbleColumnsFromFlowing", + "block.betterlilypads.Collision", + "block.betterlilypads.Rendering", + "block.doubledoors.Doors", + "block.doubledoors.TrapDoors", + "block.easyharvest.CocoaBeans", + "block.easyharvest.Crops", + "block.easyharvest.NetherWarts", + "block.easyharvest.SugarCane", + "block.easyxp.Blocks", + "block.easyxp.FurnaceBlockEntityPlayerProvider", + "block.easyxp.PassPlayerToEntity", + "block.mossythings.MoistenAbstractBlock", + "block.mossythings.MoistenBlock", + "block.planthitboxes.FernBlocks", + "block.planthitboxes.TallPlants", + "block.rejuvenation.RejuvenateDeadBushes", + "block.rejuvenation.TallGrassSpread", + "dev.DepositGrindstoneXp", + "entity.AutoPlant", + "entity.BurnUsableEntities", + "entity.SoulFireDoesMoreDamage", + "entity.ai.brain.task.FarmerVillagersDepositSurplus", + "entity.betterlilypads.FallingParticles", + "entity.betterlilypads.SprintingParticles", + "entity.easyxp.AnimalEntityBreedXp", + "entity.easyxp.FishingXp", + "entity.easyxp.LivingEntityGiveXp", + "entity.easyxp.MateGoalXp", + "entity.easyxp.VillagerTradeXp", "entity.passive.ChickenEntityMixin", "entity.passive.CowEntityMixin", "entity.passive.HorseAndDonkeyMixin", @@ -29,14 +47,26 @@ "entity.passive.SheepEntityMixin", "entity.passive.WolfEntityMixin", "fluid.WaterFluidMixin", + "item.BucketItemMixin", + "item.CharcoalDoesntBurnMixin", "item.FlintAndSteelMixin", "item.HoeItemMixin", - "item.ShovelMixin" + "item.ShovelMixin", + "prod.DepositGrindstoneXp", + "prod.DepositGrindstoneXp$SlotMixin", + "world.SerializeChunkData", + "world.TrackBlockChanges", + "world.UpgradeChunk" ], "client": [ + "client.gui.hud.RenderSoulFire", + "client.gui.screen.ingame.PopulateSignEditScreen", + "client.particle.GetParticlesForEmptyBlocks", "client.render.CameraMixin", "client.render.entity.BoatEntityRendererMixin", "client.render.entity.PlayerEntityRendererMixin", + "client.render.entity.RenderSoulFire", + "client.render.entity.TippedArrowEntityRenderer", "dev.ChestBlockEntityRendererMixin", "dev.ShulkerBoxEntityRendererMixin", "prod.ChestBlockEntityRendererMixin",