From 981d49dffc938b6cf89eff658052635fa2b929ab Mon Sep 17 00:00:00 2001 From: NotMega Date: Wed, 15 Jul 2026 10:24:45 +0300 Subject: [PATCH] now were thinking with wiki --- .../com/hbm/commands/CommandWikiRender.java | 87 +++++++++++++++++++ src/main/java/com/hbm/main/MainRegistry.java | 1 + 2 files changed, 88 insertions(+) create mode 100644 src/main/java/com/hbm/commands/CommandWikiRender.java diff --git a/src/main/java/com/hbm/commands/CommandWikiRender.java b/src/main/java/com/hbm/commands/CommandWikiRender.java new file mode 100644 index 000000000..6833d3cab --- /dev/null +++ b/src/main/java/com/hbm/commands/CommandWikiRender.java @@ -0,0 +1,87 @@ +package com.hbm.commands; + +import java.util.ArrayList; +import java.util.Locale; +import java.util.List; +import java.util.Arrays; + +import com.hbm.inventory.gui.GUIScreenWikiRender; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemDepletedFuel; +import com.hbm.items.machine.ItemFluidDuct; +import com.hbm.items.machine.ItemRBMKPellet; +import com.hbm.main.MainRegistry; + +import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraft.command.WrongUsageException; +import net.minecraft.command.PlayerNotFoundException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.item.Item; +import net.minecraft.init.Items; +import net.minecraft.init.Blocks; + +// horribly written command so you can render more than fucking guns without having to decompile the JAR +public class CommandWikiRender extends CommandBase { + @Override + public String getCommandName() { + return "ntmwikirender"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return String.format(Locale.US, + "%s/%s %s- Render screenshots of a selected item type (e.g ItemGunBaseNT). Intended for developers and wiki editors only.", + EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE + ); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(!(sender instanceof EntityPlayer)) { + throw new PlayerNotFoundException(); + } + + if(args.length == 0) { + throw new WrongUsageException(getCommandUsage(sender), new Object[0]); + } + + MainRegistry.logger.info("Taking a screenshot of " + args[0]); + + List ignoredItems = Arrays.asList( + ModItems.achievement_icon, + Items.spawn_egg, + Item.getItemFromBlock(Blocks.mob_spawner) + ); + + List> collapsedClasses = Arrays.asList( + ItemRBMKPellet.class, + ItemDepletedFuel.class, + ItemFluidDuct.class + ); + + String prefix = args[0]; + int slotScale = 16; + boolean ignoreNonNTM = true; + + List stacks = new ArrayList(); + for (Object reg : Item.itemRegistry) { + Item item = (Item) reg; + if(ignoreNonNTM && !Item.itemRegistry.getNameForObject(item).startsWith("hbm:")) continue; + if(ignoredItems.contains(item)) continue; + if(!item.getClass().getSimpleName().equalsIgnoreCase(args[0]) && (net.minecraft.block.Block.getBlockFromItem(item) == null || !net.minecraft.block.Block.getBlockFromItem(item).getClass().getSimpleName().equalsIgnoreCase(args[0]))) continue; + if(collapsedClasses.contains(item.getClass())) { + stacks.add(new ItemStack(item)); + } else { + item.getSubItems(item, null, stacks); + } + } + + Minecraft.getMinecraft().thePlayer.closeScreen(); + FMLCommonHandler.instance().showGuiScreen(new GUIScreenWikiRender(stacks.toArray(new ItemStack[0]), prefix, "wiki-block-renders-256", slotScale)); + } + } \ No newline at end of file diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index f28893151..8520a82d7 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -666,6 +666,7 @@ public class MainRegistry { event.registerServerCommand(new CommandPacketInfo()); event.registerServerCommand(new CommandReloadServer()); event.registerServerCommand(new CommandLocate()); + event.registerServerCommand(new CommandWikiRender()); event.registerServerCommand(new CommandCustomize()); event.registerServerCommand(new CommandReapNetworks()); ArcFurnaceRecipes.registerFurnaceSmeltables(); // because we have to wait for other mods to take their merry ass time to register recipes