Kestrel Foerster

Make Minecraft harder by adding bark and inside logs and plant fiber and rope, things like that.

Kodari AI
KodariOct 31 at 8:50 pm 11
HarderSurvival
HarderSurvival enhances Minecraft's survival difficulty by introducing new resource mechanics. Players must strip bark from logs to obtain plant fiber, which can be crafted into rope. Bark serves as a crafting material, while logs require processing before use. The mod adds realistic survival elements, making resource gathering more challenging and rewarding. Key features include bark stripping mechanics, plant fiber collection from logs, rope crafting recipes, and integration with vanilla survival progression. This Fabric mod targets version 1.26.3, providing a fresh survival experience for players seeking increased difficulty and depth in resource management.
  1. Register four survival materials: bark, an inner-log core, plant fiber, and rope.

  2. Make trees and grass supply the new materials, with recipes that use them in progression.

  3. Add item textures, client item models, names, and crafting recipes.

Added a Fabric 26.3 mod with four survival materials and their textures:

  • Bark drops when logs are broken; craft it with any log to make an Inner Log.

  • Plant Fiber drops from short grass, tall grass, and ferns; craft 3 fibers into Rope.

  • Added item registration, crafting recipes, creative-tab entries, names, and item models.

Vanilla recipes are unchanged, so this adds the new material loop without yet restricting existing crafting.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
20 217
src/main/java/com/kodari/primitivesurvival/PrimitiveSurvival.java
package com.kodari.primitivesurvival;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks;

public class PrimitiveSurvival implements ModInitializer {
	public static final String MOD_ID = "primitive_survival";

	public static final Item BARK = registerItem("bark");
	public static final Item INNER_LOG = registerItem("inner_log");
	public static final Item PLANT_FIBER = registerItem("plant_fiber");
	public static final Item ROPE = registerItem("rope");

	private static final ResourceKey<CreativeModeTab> INGREDIENTS_TAB = ResourceKey.create(
			Registries.CREATIVE_MODE_TAB,
			Identifier.fromNamespaceAndPath("minecraft", "ingredients")
	);

	@Override
	public void onInitialize() {
		CreativeModeTabEvents.modifyOutputEvent(INGREDIENTS_TAB).register(output -> {
			output.accept(new ItemStack(BARK));
			output.accept(new ItemStack(INNER_LOG));
			output.accept(new ItemStack(PLANT_FIBER));
			output.accept(new ItemStack(ROPE));
		});

		PlayerBlockBreakEvents.AFTER.register((level, player, pos, state, blockEntity) -> {
			Item extraDrop = null;
			if (state.is(BlockTags.LOGS)) {
				extraDrop = BARK;
			} else if (state.getBlock() == Blocks.SHORT_GRASS
					|| state.getBlock() == Blocks.TALL_GRASS
					|| state.getBlock() == Blocks.FERN
					|| state.getBlock() == Blocks.LARGE_FERN) {
				extraDrop = PLANT_FIBER;
			}

			if (extraDrop != null && level instanceof ServerLevel serverLevel) {
				serverLevel.addFreshEntity(new ItemEntity(
						level,
						pos.getX() + 0.5,
						pos.getY() + 0.5,
						pos.getZ() + 0.5,
						new ItemStack(extraDrop)
				));
			}
		});
	}

	private static Item registerItem(String path) {
		Identifier id = Identifier.fromNamespaceAndPath(MOD_ID, path);
		ResourceKey<Item> key = ResourceKey.create(Registries.ITEM, id);
		return Registry.register(BuiltInRegistries.ITEM, key, new Item(new Item.Properties().setId(key)));
	}
}