YOUR TAKING TOO LONG

This commit is contained in:
Boblet 2026-07-16 09:21:33 +02:00
parent 348505f3d2
commit cefcd7dee5
2 changed files with 43 additions and 42 deletions

View File

@ -13,14 +13,15 @@ import com.hbm.items.machine.ItemRBMKPellet;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.minecraftforge.client.ClientCommandHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.item.Item;
@ -28,63 +29,62 @@ 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
@SideOnly(Side.CLIENT) // make it clientside so bobcat would not come after me
public class CommandWikiRender extends CommandBase {
public static void register() {
if(FMLLaunchHandler.side() != Side.CLIENT) return;
ClientCommandHandler.instance.registerCommand(new CommandWikiRender());
}
@Override
public String getCommandName() {
return "ntmwikirender";
}
@Override
public String getCommandUsage(ICommandSender sender) {
return String.format(Locale.US,
"%s/%s <type> %s- Render screenshots of a selected item type (e.g ItemGunBaseNT). Intended for developers and wiki editors only.",
EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE
);
}
public String getCommandName() {
return "ntmwikirender";
}
@Override
public void processCommand(ICommandSender sender, String[] args) {
if(!(sender instanceof EntityPlayer)) {
throw new PlayerNotFoundException();
}
if(args.length == 0) {
@Override
public String getCommandUsage(ICommandSender sender) {
return String.format(Locale.US, "%s/%s <type> %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<Item> ignoredItems = Arrays.asList(
ModItems.achievement_icon,
Items.spawn_egg,
Item.getItemFromBlock(Blocks.mob_spawner)
);
MainRegistry.logger.info("Taking a screenshot of " + args[0]);
List<Class<? extends Item>> collapsedClasses = Arrays.asList(
ItemRBMKPellet.class,
ItemDepletedFuel.class,
ItemFluidDuct.class
);
List<Item> ignoredItems = Arrays.asList(ModItems.achievement_icon, Items.spawn_egg, Item.getItemFromBlock(Blocks.mob_spawner));
String prefix = args[0];
List<Class<? extends Item>> collapsedClasses = Arrays.asList(ItemRBMKPellet.class, ItemDepletedFuel.class, ItemFluidDuct.class);
String prefix = args[0];
int slotScale = 16;
boolean ignoreNonNTM = true;
List<ItemStack> stacks = new ArrayList<ItemStack>();
for (Object reg : Item.itemRegistry) {
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(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));
}
Minecraft.getMinecraft().thePlayer.closeScreen();
FMLCommonHandler.instance().showGuiScreen(new GUIScreenWikiRender(stacks.toArray(new ItemStack[0]), prefix, "wiki-block-renders-256", slotScale));
}
}

View File

@ -606,6 +606,7 @@ public class MainRegistry {
Compat.handleRailcraftNonsense();
SuicideThreadDump.register();
CommandReloadClient.register();
CommandWikiRender.register();
//ExplosionTests.runTest();
}