Try Live
Add Docs
Rankings
Pricing
Docs
Install
Install
Docs
Pricing
More...
More...
Try Live
Rankings
Enterprise
Create API Key
Add Docs
MrCrayfish's Furniture Mod Refurbished
https://github.com/mrcrayfish/mrcrayfishfurnituremod-refurbished
Admin
A Minecraft mod that adds 440+ decorative and functional furniture blocks with an electricity
...
Tokens:
7,324
Snippets:
39
Trust Score:
8.6
Update:
1 month ago
Context
Skills
Chat
Benchmark
59.8
Suggestions
Latest
Show doc for...
Code
Info
Show Results
Context Summary (auto-generated)
Raw
Copy
Link
# MrCrayfish's Furniture Mod: Refurbished MrCrayfish's Furniture Mod: Refurbished is a comprehensive Minecraft mod that adds over 440 functional and decorative furniture blocks to the game. Built from the ground up for modern Minecraft versions, it introduces a unique electricity system to power appliances and electronics, a mail delivery system for sending items between players, a fully functional in-game computer with applications, and various cooking appliances with custom recipes. The mod supports Fabric, NeoForge, and includes extensive datapack support for customization. The mod is designed around several core systems: the Electricity System that connects power sources to modules via nodes, the Mail/Delivery Service for inter-player item transport, the Computer System with programmable applications, and the Processing/Recipe System for cooking appliances like grills, frying pans, microwaves, and toasters. All furniture blocks come in multiple wood types and dye colors, providing extensive customization options for players to decorate their Minecraft homes. ## Electricity System API The electricity system uses a node-based architecture where source nodes (like Electricity Generators) provide power to module nodes (like lamps, ceiling fans, computers) through connections. Nodes are connected using the Wrench item and form networks within a configurable radius. ### IElectricityNode Interface The base interface for all electricity nodes, providing methods for managing connections, power states, and network operations. ```java // Creating a custom electricity-powered block entity public class CustomPoweredBlockEntity extends BlockEntity implements IModuleNode { private boolean powered = false; private boolean receivingPower = false; private final Set<Connection> connections = new HashSet<>(); private final Set<BlockPos> powerSources = new HashSet<>(); @Override public BlockPos getNodePosition() { return this.worldPosition; } @Override public Level getNodeLevel() { return this.level; } @Override public BlockEntity getNodeOwner() { return this; } @Override public boolean isNodePowered() { return this.powered; } @Override public void setNodePowered(boolean powered) { this.powered = powered; // Update block state when power changes this.level.setBlock(this.worldPosition, this.getBlockState().setValue(POWERED, powered), Block.UPDATE_ALL); } @Override public Set<Connection> getNodeConnections() { return this.connections; } @Override public void setNodeReceivingPower(boolean state) { this.receivingPower = state; } @Override public boolean isNodeReceivingPower() { return this.receivingPower; } @Override public Set<BlockPos> getPowerSources() { return this.powerSources; } // Call in tick method to update power state public void tick(Level level) { if (!level.isClientSide()) { this.moduleTick(level); // From IModuleNode - handles power state updates } } } ``` ### ISourceNode Interface Extends IElectricityNode for power source blocks like the Electricity Generator. Source nodes provide power to connected module nodes within their network. ```java // Creating a custom electricity source block entity public class CustomGeneratorBlockEntity extends BlockEntity implements ISourceNode { private boolean powered = false; private boolean overloaded = false; private final Set<Connection> connections = new HashSet<>(); @Override public BlockPos getNodePosition() { return this.worldPosition; } @Override public Level getNodeLevel() { return this.level; } @Override public BlockEntity getNodeOwner() { return this; } @Override public boolean isNodePowered() { return this.powered; } @Override public void setNodePowered(boolean powered) { this.powered = powered; this.level.setBlock(this.worldPosition, this.getBlockState().setValue(POWERED, powered), Block.UPDATE_ALL); } @Override public Set<Connection> getNodeConnections() { return this.connections; } @Override public void setNodeOverloaded(boolean overloaded) { this.overloaded = overloaded; } @Override public boolean isNodeOverloaded() { return this.overloaded; } @Override public int getMaxPowerableNodes() { // Configure via Config.SERVER.electricity.maximumNodesInNetwork return 64; } // Override to customize network search behavior @Override public void onNodeOverloaded() { // Handle overload - e.g., turn off generator this.setNodePowered(false); } } ``` ### Connection Class Represents a link between two electricity nodes, used internally by the electricity system. ```java // Working with connections programmatically public void createConnection(IElectricityNode nodeA, IElectricityNode nodeB) { // Connection is automatically created when connecting nodes boolean success = nodeA.connectToNode(nodeB); if (success) { // Connection established - synced to clients automatically System.out.println("Nodes connected successfully"); } } public void removeConnection(IElectricityNode node) { // Remove all connections from a node node.removeAllNodeConnections(); // Or remove a specific connection Set<Connection> connections = node.getNodeConnections(); for (Connection connection : new HashSet<>(connections)) { node.removeNodeConnection(connection); } } // Searching for nodes in a network (from a source node) public void findNetworkNodes(ISourceNode source) { List<IElectricityNode> nodes = IElectricityNode.searchNodes( source, 64, // max nodes to find false, // don't cancel at limit node -> !node.isSourceNode() && node.canPowerTraverseNode(), // search predicate node -> !node.isSourceNode() // match predicate ); System.out.println("Found " + nodes.size() + " nodes in network"); } ``` ## Mail/Delivery Service API The mail system allows players to send items between mailboxes. The DeliveryService is a server-side saved data that manages all registered mailboxes and handles item delivery queues. ### DeliveryService Class The central service for managing mailboxes and delivering items between players. ```java // Accessing the delivery service public void sendItemToPlayer(MinecraftServer server, UUID targetMailboxId, ItemStack item) { Optional<DeliveryService> optService = DeliveryService.get(server); optService.ifPresent(service -> { // Check if item is allowed to be sent if (DeliveryService.isBannedItem(item)) { System.out.println("This item cannot be sent through mail"); return; } // Send the item DeliveryResult result = service.sendMail(targetMailboxId, item); if (result.isSuccess()) { System.out.println("Package sent: " + result.getMessage()); } else { System.out.println("Failed to send: " + result.getMessage()); } }); } // Creating/registering a mailbox public void registerMailbox(DeliveryService service, MailboxBlockEntity entity, Player owner) { // Check if player can create more mailboxes if (!service.canCreateMailbox(owner)) { System.out.println("Max mailboxes reached for player"); return; } // Get or create the mailbox record Mailbox mailbox = service.getOrCreateMailBox(entity); if (mailbox != null) { // Mark for renaming (only works once when placed) service.markMailboxAsPendingName(owner, entity.getLevel(), entity.getBlockPos()); } } // Renaming a mailbox public void renameMailbox(DeliveryService service, Player owner, Level level, BlockPos pos, String newName) { boolean success = service.renameMailbox(owner, level, pos, newName); // Name max 32 characters, only works if mailbox is pending name } // Get all mailboxes for display public void listAllMailboxes(DeliveryService service) { Collection<IMailbox> mailboxes = service.getMailboxes(); for (IMailbox mailbox : mailboxes) { Optional<String> customName = mailbox.getCustomName(); System.out.println("Mailbox: " + mailbox.getId() + " - " + customName.orElse("Unnamed")); } } ``` ### IMailbox Interface Interface for mailbox data, providing access to mailbox identity and ownership information. ```java // IMailbox interface implementation public interface IMailbox { // Get the unique identifier of this mailbox UUID getId(); // Get the owner's profile (name and UUID) Optional<NameAndId> getOwner(@Nullable MinecraftServer server); // Get custom display name Optional<String> getCustomName(); } // Example: Finding a mailbox by owner public Optional<IMailbox> findMailboxByOwner(DeliveryService service, MinecraftServer server, UUID ownerUuid) { return service.getMailboxes().stream() .filter(mailbox -> { Optional<NameAndId> owner = mailbox.getOwner(server); return owner.map(nameAndId -> nameAndId.id().equals(ownerUuid)) .orElse(false); }) .findFirst(); } ``` ## Recipe System API The mod provides custom recipe types for various cooking appliances. All recipes extend ProcessingRecipe and use datapacks for definition. ### ProcessingRecipe Class Base class for all furniture mod processing recipes (cooking, freezing, toasting, etc.). ```java // Datapack recipe JSON format for Frying Pan cooking // File: data/refurbished_furniture/recipe/fried_egg.json { "type": "refurbished_furniture:frying_pan_cooking", "category": "food", "ingredient": { "item": "minecraft:egg" }, "result": { "id": "minecraft:cooked_chicken", "count": 1 }, "time": 200 } // Grill cooking recipe // File: data/refurbished_furniture/recipe/grilled_steak.json { "type": "refurbished_furniture:grill_cooking", "category": "food", "ingredient": { "item": "minecraft:beef" }, "result": { "id": "minecraft:cooked_beef" }, "time": 200 } // Microwave heating recipe { "type": "refurbished_furniture:microwave_heating", "category": "food", "ingredient": { "tag": "c:foods/raw" }, "result": { "id": "refurbished_furniture:cooked_food" }, "time": 100 } // Freezer solidifying recipe { "type": "refurbished_furniture:freezer_solidifying", "category": "misc", "ingredient": { "item": "minecraft:water_bucket" }, "result": { "id": "minecraft:ice" }, "time": 400 } // Toaster heating recipe { "type": "refurbished_furniture:toaster_toasting", "category": "food", "ingredient": { "item": "refurbished_furniture:bread_slice" }, "result": { "id": "refurbished_furniture:toast" }, "time": 100 } // Oven baking recipe { "type": "refurbished_furniture:oven_baking", "category": "food", "ingredient": { "item": "refurbished_furniture:raw_vegetable_pizza" }, "result": { "id": "refurbished_furniture:cooked_vegetable_pizza" }, "time": 400 } ``` ### Cutting Board Recipes The cutting board supports two recipe types: slicing (splitting items) and combining (merging items). ```java // Cutting Board Slicing recipe (splits items) // File: data/refurbished_furniture/recipe/bread_slicing.json { "type": "refurbished_furniture:cutting_board_slicing", "category": "food", "ingredient": { "item": "minecraft:bread" }, "result": { "id": "refurbished_furniture:bread_slice", "count": 4 } } // Cutting Board Combining recipe (combines items) // File: data/refurbished_furniture/recipe/cheese_sandwich.json { "type": "refurbished_furniture:cutting_board_combining", "category": "food", "ingredients": [ { "ingredient": { "item": "refurbished_furniture:bread_slice" }, "count": 2 }, { "ingredient": { "item": "refurbished_furniture:cheese" }, "count": 1 } ], "result": { "id": "refurbished_furniture:cheese_sandwich" } } // Pizza slicing recipe { "type": "refurbished_furniture:cutting_board_slicing", "category": "food", "ingredient": { "item": "refurbished_furniture:cooked_vegetable_pizza" }, "result": { "id": "refurbished_furniture:vegetable_pizza_slice", "count": 8 } } ``` ## Computer System API The mod includes a fully functional computer block with programmable applications. Programs run on both client and server sides with synchronized state. ### Program Class Base class for creating computer applications. Programs have client-side graphics and server-side logic. ```java // Creating a custom computer program public class CustomProgram extends Program { private int counter = 0; public CustomProgram(Identifier id, IComputer computer) { super(id, computer); // id format: new Identifier("yourmod", "program_name") // Title auto-translates from: computer_program.yourmod.program_name } @Override public void tick() { // Called every tick while program is running counter++; // Access computer methods IComputer computer = this.getComputer(); BlockPos pos = computer.getComputerPos(); Level level = computer.getComputerLevel(); } @Override public void onClose(boolean remote) { // Called when program closes // remote = true if closed by server/external event // remote = false if closed by user } } // Client-side graphics for the program @OnlyIn(Dist.CLIENT) public class CustomProgramGraphics extends DisplayableProgram<CustomProgram> { public CustomProgramGraphics(CustomProgram program, Display display) { super(program, display); } @Override protected void init() { // Initialize widgets and UI components int windowWidth = this.getWindowWidth(); int windowHeight = this.getWindowHeight(); // Add custom widgets } @Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { super.render(graphics, mouseX, mouseY, partialTick); // Custom rendering } @Override public void tick() { // Client-side tick for animations } } ``` ## Configuration API The mod uses MrCrayfish's Framework for configuration. Both client and server configs are available. ### Server Configuration Server-side configuration that syncs to clients. ```java // Accessing server configuration values public class ConfigExamples { public void electricityConfig() { // Maximum nodes in a power network int maxNodes = Config.SERVER.electricity.maximumNodesInNetwork.get(); // Powerable area radius from source node int radius = Config.SERVER.electricity.powerableAreaRadius.get(); // Max links per node int maxLinks = Config.SERVER.electricity.maximumLinksPerElectricityNode.get(); // Fuel to power conversion ratio int fuelRatio = Config.SERVER.electricity.fuelToPowerRatio.get(); // Cheat modes boolean freePower = Config.SERVER.electricity.cheats.freeGeneratorPower.get(); boolean alwaysPowered = Config.SERVER.electricity.cheats.everythingIsPowered.get(); } public void mailingConfig() { // Max mailboxes per player int maxMailboxes = Config.SERVER.mailing.maxMailboxesPerPlayer.get(); // Mailbox inventory size (rows) int rows = Config.SERVER.mailing.mailboxInventoryRows.get(); // Delivery queue size int queueSize = Config.SERVER.mailing.deliveryQueueSize.get(); // Check banned items list List<String> bannedItems = Config.SERVER.mailing.bannedItems.get(); // Allowed dimensions for mailboxes List<String> dimensions = Config.SERVER.mailing.allowedDimensions.get(); } public void recipeConfig() { // Inherit campfire recipes for frying pan/grill boolean inheritCampfire = Config.SERVER.recipes.inheritCampfireRecipes.get(); } public void otherConfig() { // Trampoline bounce height double bounceHeight = Config.SERVER.trampoline.maxBounceHeight.get(); // Recycle bin settings int recycleTime = Config.SERVER.recycleBin.processingTime.get(); double xpPerItem = Config.SERVER.recycleBin.experiencePerItem.get(); // Fluid storage capacities (varies by loader) long sinkCapacity = Config.SERVER.kitchenSink.fluidCapacity.get(); long bathCapacity = Config.SERVER.bath.fluidCapacity.get(); boolean freeWater = Config.SERVER.kitchenSink.dispenseWater.get(); } } ``` ### Client Configuration Client-side visual and notification settings. ```java // Accessing client configuration public void clientConfig() { // Doorbell notification toast boolean showDoorbell = Config.CLIENT.doorbellNotification.get(); // Electricity visualization distance int viewDistance = Config.CLIENT.electricityViewDistance.get(); // Cutting board helper overlay boolean showHelper = Config.CLIENT.showCuttingBoardHelper.get(); // Ceiling fan animation speed double fanSpeed = Config.CLIENT.ceilingFanMaxSpeed.get(); // Shader compatibility fix boolean shaderFix = Config.CLIENT.experimental.electricityShadersFix.get(); } ``` ## Block Registration Reference The mod registers blocks using MrCrayfish's Framework registry system. All blocks are available in the ModBlocks class. ```java // Accessing registered blocks import com.mrcrayfish.furniture.refurbished.core.ModBlocks; // Furniture blocks by wood type Block oakChair = ModBlocks.CHAIR_OAK.get(); Block spruceTable = ModBlocks.TABLE_SPRUCE.get(); Block birchDesk = ModBlocks.DESK_BIRCH.get(); Block jungleDrawer = ModBlocks.DRAWER_JUNGLE.get(); // Kitchen blocks by wood type or color Block oakKitchenCabinetry = ModBlocks.KITCHEN_CABINETRY_OAK.get(); Block whiteKitchenDrawer = ModBlocks.KITCHEN_DRAWER_WHITE.get(); Block redKitchenSink = ModBlocks.KITCHEN_SINK_RED.get(); // Appliances (light/dark metal variants) Block lightFridge = ModBlocks.FRIDGE_LIGHT.get(); Block darkStove = ModBlocks.STOVE_DARK.get(); Block lightMicrowave = ModBlocks.MICROWAVE_LIGHT.get(); Block darkToaster = ModBlocks.TOASTER_DARK.get(); // Electricity blocks Block lightGenerator = ModBlocks.ELECTRICITY_GENERATOR_LIGHT.get(); Block darkLightswitch = ModBlocks.LIGHTSWITCH_DARK.get(); Block lightCeilingLight = ModBlocks.CEILING_LIGHT_LIGHT.get(); // Colored furniture (16 dye colors) Block whiteSofa = ModBlocks.SOFA_WHITE.get(); Block blueLamp = ModBlocks.LAMP_BLUE.get(); Block greenGrill = ModBlocks.GRILL_GREEN.get(); Block redCooler = ModBlocks.COOLER_RED.get(); Block blackStool = ModBlocks.STOOL_BLACK.get(); // Bathroom fixtures Block oakToilet = ModBlocks.TOILET_OAK.get(); Block whiteBasin = ModBlocks.BASIN_WHITE.get(); Block cherryBath = ModBlocks.BATH_CHERRY.get(); // Outdoor/garden Block oakMailbox = ModBlocks.MAIL_BOX_OAK.get(); Block postBox = ModBlocks.POST_BOX.get(); Block oakHedge = ModBlocks.HEDGE_OAK.get(); Block stoneSteppingStones = ModBlocks.STEPPING_STONES_STONE.get(); // Electronics Block television = ModBlocks.TELEVISION.get(); Block computer = ModBlocks.COMPUTER.get(); // Miscellaneous Block workbench = ModBlocks.WORKBENCH.get(); Block doorMat = ModBlocks.DOOR_MAT.get(); Block fryingPan = ModBlocks.FRYING_PAN.get(); Block plate = ModBlocks.PLATE.get(); ``` ## Summary MrCrayfish's Furniture Mod: Refurbished provides a comprehensive furniture and home decoration system for Minecraft, with deep integration capabilities for mod developers. The electricity system enables complex powered networks where appliances like fridges, microwaves, ceiling fans, and computers require connection to electricity generators. The mail system offers a unique item transport mechanism between players through registered mailboxes, complete with queue management and dimension restrictions. For developers looking to integrate with or extend this mod, the key extension points are: implementing IModuleNode or ISourceNode for custom electricity-powered blocks, utilizing the DeliveryService for mail system interactions, creating custom ProcessingRecipe subclasses for new cooking/crafting mechanics, and extending the Program class for computer applications. All systems are highly configurable through the Config class, allowing server operators to fine-tune electricity network sizes, mailing restrictions, recipe behavior, and various block properties to suit their gameplay preferences.