Compare commits
12 Commits
5f72290510
...
296d8a1d1f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
296d8a1d1f | ||
|
|
cefcd7dee5 | ||
|
|
348505f3d2 | ||
|
|
3af3d8d39c | ||
|
|
425e317640 | ||
|
|
8b3a17b60c | ||
|
|
17ed5e4b6d | ||
|
|
f533005bd6 | ||
|
|
981d49dffc | ||
|
|
747c827486 | ||
|
|
f11c95e444 | ||
|
|
33a416a011 |
90
src/main/java/com/hbm/commands/CommandWikiRender.java
Normal file
@ -0,0 +1,90 @@
|
||||
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 cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
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;
|
||||
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 {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@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));
|
||||
|
||||
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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class GUICrystallizer extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.acidomatic.hasCustomInventoryName() ? this.acidomatic.getInventoryName() : I18n.format(this.acidomatic.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ public class GUIMachineCyclotron extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.cyclotron.hasCustomInventoryName() ? this.cyclotron.getInventoryName() : I18n.format(this.cyclotron.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 79 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 15, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineEPress extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_epress.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electric_press.png");
|
||||
private TileEntityMachineEPress press;
|
||||
|
||||
public GUIMachineEPress(InventoryPlayer invPlayer, TileEntityMachineEPress tedf) {
|
||||
@ -34,7 +34,7 @@ public class GUIMachineEPress extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.press.hasCustomInventoryName() ? this.press.getInventoryName() : I18n.format(this.press.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 89 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
public class GUIMachineElectricFurnace extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/GUIElectricFurnace.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electric_furnace.png");
|
||||
private TileEntityMachineElectricFurnace furnace;
|
||||
|
||||
public GUIMachineElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace furnace) {
|
||||
@ -43,7 +43,7 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.furnace.hasCustomInventoryName() ? this.furnace.getInventoryName() : I18n.format(this.furnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer {
|
||||
int p = furnace.getProgressScaled(28);
|
||||
drawTexturedModalRect(guiLeft + 43, guiTop + 36, 176, 0, p, 12);
|
||||
|
||||
this.drawInfoPanel(guiLeft + 116, guiTop + 20, 8, 8, 8);
|
||||
this.drawInfoPanel(guiLeft + 115, guiTop + 19, 8, 8, 8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachinePress extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_press.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_press.png");
|
||||
private TileEntityMachinePress press;
|
||||
|
||||
public GUIMachinePress(InventoryPlayer invPlayer, TileEntityMachinePress tedf) {
|
||||
@ -48,7 +48,7 @@ public class GUIMachinePress extends GuiInfoContainer {
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(press.burnTime >= 20) {
|
||||
this.drawTexturedModalRect(guiLeft + 27, guiTop + 36, 0, 214, 14, 14);
|
||||
this.drawTexturedModalRect(guiLeft + 26, guiTop + 36, 0, 214, 14, 14);
|
||||
}
|
||||
|
||||
int k = (int) (press.renderPress * 16 / press.maxPress);
|
||||
|
||||
@ -52,7 +52,7 @@ public class GUIMachineRTG extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.rtg.hasCustomInventoryName() ? this.rtg.getInventoryName() : I18n.format(this.rtg.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 13 ,7, 10925486);
|
||||
this.fontRendererObj.drawString(name, 60 - this.fontRendererObj.getStringWidth(name) / 2, 7, 10925486);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineShredder extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_shredder.png");
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_shredder.png");
|
||||
private TileEntityMachineShredder diFurnace;
|
||||
|
||||
public GUIMachineShredder(InventoryPlayer invPlayer, TileEntityMachineShredder tedf) {
|
||||
@ -45,7 +45,7 @@ public class GUIMachineShredder extends GuiInfoContainer {
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(name, 106 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@ -606,6 +606,7 @@ public class MainRegistry {
|
||||
Compat.handleRailcraftNonsense();
|
||||
SuicideThreadDump.register();
|
||||
CommandReloadClient.register();
|
||||
CommandWikiRender.register();
|
||||
|
||||
//ExplosionTests.runTest();
|
||||
}
|
||||
@ -667,6 +668,7 @@ public class MainRegistry {
|
||||
event.registerServerCommand(new CommandReloadServer());
|
||||
event.registerServerCommand(new CommandLocate());
|
||||
event.registerServerCommand(new CommandCustomize());
|
||||
event.registerServerCommand(new CommandWikiRender()); // TODO: make this shitfuck be clientside
|
||||
event.registerServerCommand(new CommandReapNetworks());
|
||||
ArcFurnaceRecipes.registerFurnaceSmeltables(); // because we have to wait for other mods to take their merry ass time to register recipes
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 24 KiB |