mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
the glunch
This commit is contained in:
parent
219db7acdf
commit
5444f57cad
23
changelog
23
changelog
@ -1,23 +1,2 @@
|
||||
## Added
|
||||
* QMAW (quick manual and wiki)
|
||||
* It's a simple ingame manual that can be found by pressing F1 on items (like the WIAJ presentations)
|
||||
* Supports text and links and not much else
|
||||
* Easy to make entries for, the system scans `assets/manual` for valid `.json` format files
|
||||
* Should also work in resource packs (no recent tests for that, not going to make promises)
|
||||
* Still WIP, many new info pages are yet to be made
|
||||
* `/ntmlocate`
|
||||
* Finds structures
|
||||
* Only works on the new component structures, the old crusty ones like the factors and powerplant aren't supported
|
||||
|
||||
## Changed
|
||||
* Updated chinese and russian localization
|
||||
* All the never completed missile parts (20/20 fuselage, 20 warhead, 10 and 15 tec kerosene thrusters) have been removed
|
||||
* The electric arc furnace now scrapes the vanilla furnace recipe list on server start in addition to postinit, making sure recipes added during postinit after NTM loads (like Thermal's ingots) are covered too
|
||||
* The shredder's sound will now start immediately when processing instead of with random delay
|
||||
* The assembly machine can now make nuclear waste into barrels
|
||||
* Capacitors now have OpenComputers integration
|
||||
|
||||
## Fixed
|
||||
* Fixed GT6 compatibility watz pellets crashing due to misconfigured recipes
|
||||
* Removed failed attempt at fixing the gun desync dupe which made things worse
|
||||
* Fixed a potential crash regarding structure blocks
|
||||
* QMAW now has buttons for returning to previously viewed pages
|
||||
@ -1,14 +0,0 @@
|
||||
package com.hbm.calc;
|
||||
|
||||
public class EasyLocation {
|
||||
|
||||
public double posX;
|
||||
public double posY;
|
||||
public double posZ;
|
||||
|
||||
public EasyLocation(double x, double y, double z) {
|
||||
posX = x;
|
||||
posY = y;
|
||||
posZ = z;
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package com.hbm.calc;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Location {
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public World world;
|
||||
|
||||
public Location(World world, int x, int y, int z) {
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Location add(int xa, int ya, int za) {
|
||||
return new Location(world, x + xa, y + ya, z + za);
|
||||
}
|
||||
|
||||
public Location add(ForgeDirection dir) {
|
||||
return add(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity() {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,13 +3,16 @@ package com.hbm.qmaw;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.qmaw.components.*;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.LanguageManager;
|
||||
@ -22,8 +25,12 @@ public class GuiQMAW extends GuiScreen {
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_wiki.png");
|
||||
|
||||
public String title;
|
||||
public String qmawID;
|
||||
public ItemStack icon;
|
||||
public List<List<ManualElement>> lines = new ArrayList();
|
||||
/** History for returning via button */
|
||||
public List<String> back = new ArrayList();
|
||||
public List<String> forward = new ArrayList();
|
||||
|
||||
protected int xSize = 340;
|
||||
protected int ySize = 224;
|
||||
@ -38,6 +45,7 @@ public class GuiQMAW extends GuiScreen {
|
||||
public static final String EN_US = "en_US";
|
||||
|
||||
public GuiQMAW(QuickManualAndWiki qmaw) {
|
||||
qmawID = qmaw.name;
|
||||
parseQMAW(qmaw);
|
||||
}
|
||||
|
||||
@ -163,6 +171,43 @@ public class GuiQMAW extends GuiScreen {
|
||||
this.lastClickX = x;
|
||||
this.lastClickY = y;
|
||||
}
|
||||
|
||||
if(guiLeft + 3 <= x && guiLeft + 3 + 18 > x && guiTop + 3 < y && guiTop + 3 + 18 >= y) back();
|
||||
if(guiLeft + 21 <= x && guiLeft + 21 + 18 > x && guiTop + 3 < y && guiTop + 3 + 18 >= y) forward();
|
||||
}
|
||||
|
||||
public void back() {
|
||||
if(this.back.isEmpty()) return;
|
||||
|
||||
String prev = back.get(back.size() - 1);
|
||||
|
||||
QuickManualAndWiki qmaw = QMAWLoader.qmaw.get(prev);
|
||||
if(qmaw != null) {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
GuiQMAW screen = new GuiQMAW(qmaw);
|
||||
screen.back.addAll(back);
|
||||
screen.back.remove(screen.back.size() - 1);
|
||||
screen.forward.addAll(forward);
|
||||
screen.forward.add(qmawID);
|
||||
FMLCommonHandler.instance().showGuiScreen(screen);
|
||||
}
|
||||
}
|
||||
|
||||
public void forward() {
|
||||
if(this.forward.isEmpty()) return;
|
||||
|
||||
String next = forward.get(forward.size() - 1);
|
||||
|
||||
QuickManualAndWiki qmaw = QMAWLoader.qmaw.get(next);
|
||||
if(qmaw != null) {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
GuiQMAW screen = new GuiQMAW(qmaw);
|
||||
screen.back.addAll(back);
|
||||
screen.back.add(qmawID);
|
||||
screen.forward.addAll(forward);
|
||||
screen.forward.remove(screen.forward.size() - 1);
|
||||
FMLCommonHandler.instance().showGuiScreen(screen);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSliderPosition() {
|
||||
@ -213,7 +258,7 @@ public class GuiQMAW extends GuiScreen {
|
||||
|
||||
private void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
|
||||
int x = 7;
|
||||
int x = 43;
|
||||
int y = 4;
|
||||
|
||||
if(this.icon != null) {
|
||||
@ -242,7 +287,11 @@ public class GuiQMAW extends GuiScreen {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 170, ySize);
|
||||
drawTexturedModalRect(guiLeft + 170, guiTop, 22, 0, 170, ySize);
|
||||
drawTexturedModalRect(guiLeft + 170, guiTop, 52, 0, 30, ySize);
|
||||
drawTexturedModalRect(guiLeft + 200, guiTop, 52, 0, 140, ySize);
|
||||
|
||||
if(!back.isEmpty()) drawTexturedModalRect(guiLeft + 3, guiTop + 3, 204, 0, 18, 18);
|
||||
if(!forward.isEmpty()) drawTexturedModalRect(guiLeft + 21, guiTop + 3, 222, 0, 18, 18);
|
||||
|
||||
// scroll bar
|
||||
drawTexturedModalRect(guiLeft + xSize - 15, guiTop + getSliderPosition(), 192, 0, 12, 16);
|
||||
@ -273,7 +322,7 @@ public class GuiQMAW extends GuiScreen {
|
||||
boolean mouseOver = (elementX <= mouseX && elementX + element.getWidth() > mouseX && elementY < mouseY && elementY + element.getHeight() >= mouseY);
|
||||
element.render(mouseOver, elementX, elementY, mouseX, mouseY);
|
||||
if(elementX <= lastClickX && elementX + element.getWidth() > lastClickX && elementY < lastClickY && elementY + element.getHeight() >= lastClickY)
|
||||
element.onClick();
|
||||
element.onClick(this);
|
||||
inset += element.getWidth();
|
||||
}
|
||||
|
||||
@ -283,6 +332,9 @@ public class GuiQMAW extends GuiScreen {
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
|
||||
if(keyCode == Keyboard.KEY_LEFT) back();
|
||||
if(keyCode == Keyboard.KEY_RIGHT) forward();
|
||||
|
||||
if(keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
this.mc.displayGuiScreen((GuiScreen) null);
|
||||
|
||||
@ -5,5 +5,5 @@ public abstract class ManualElement {
|
||||
public abstract int getWidth();
|
||||
public abstract int getHeight();
|
||||
public abstract void render(boolean isMouseOver, int x, int y, int mouseX, int mouseY);
|
||||
public abstract void onClick();
|
||||
public abstract void onClick(GuiQMAW gui);
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ public class QMAWLoader implements IResourceManagerReloadListener {
|
||||
//no fucking null check, if this fails then the entire game will sink along with the ship
|
||||
String path = QMAWLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
||||
// exclude .class in the case of a dev env
|
||||
MainRegistry.logger.info("[QMAW] Current running file: " + path);
|
||||
if(!path.endsWith(".class")) registerModFileURL(new File(path)); // i am going to shit myself
|
||||
|
||||
qmaw.clear();
|
||||
@ -76,7 +77,10 @@ public class QMAWLoader implements IResourceManagerReloadListener {
|
||||
* */
|
||||
public static void agonyEngine() {
|
||||
|
||||
for(File modFile : registeredModFiles) dissectZip(modFile);
|
||||
for(File modFile : registeredModFiles) {
|
||||
logJarAttempt(modFile.getName());
|
||||
dissectZip(modFile);
|
||||
}
|
||||
|
||||
File devEnvManualFolder = new File(Minecraft.getMinecraft().mcDataDir.getAbsolutePath().replace("/eclipse/.".replace('/', File.separatorChar), "") + "/src/main/resources/assets/hbm/manual".replace('/', File.separatorChar));
|
||||
if(devEnvManualFolder.exists() && devEnvManualFolder.isDirectory()) {
|
||||
@ -102,6 +106,7 @@ public class QMAWLoader implements IResourceManagerReloadListener {
|
||||
}
|
||||
}
|
||||
|
||||
public static void logJarAttempt(String name) { MainRegistry.logger.info("[QMAW] Dissecting jar " + name); }
|
||||
public static void logPackAttempt(String name) { MainRegistry.logger.info("[QMAW] Dissecting resource " + name); }
|
||||
public static void logFoundManual(String name) { MainRegistry.logger.info("[QMAW] Found manual " + name); }
|
||||
|
||||
|
||||
@ -81,11 +81,14 @@ public class QComponentLink extends ManualElement {
|
||||
font.drawString(text, x, y, isMouseOver ? hoverColor : color);
|
||||
}
|
||||
|
||||
@Override public void onClick() {
|
||||
@Override public void onClick(GuiQMAW gui) {
|
||||
QuickManualAndWiki qmaw = QMAWLoader.qmaw.get(link);
|
||||
if(qmaw != null) {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
FMLCommonHandler.instance().showGuiScreen(new GuiQMAW(qmaw));
|
||||
GuiQMAW screen = new GuiQMAW(qmaw);
|
||||
screen.back.addAll(gui.back);
|
||||
screen.back.add(gui.qmawID);
|
||||
FMLCommonHandler.instance().showGuiScreen(screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.qmaw.components;
|
||||
|
||||
import com.hbm.qmaw.GuiQMAW;
|
||||
import com.hbm.qmaw.ManualElement;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -40,5 +41,5 @@ public class QComponentText extends ManualElement {
|
||||
font.drawString(text, x, y, color);
|
||||
}
|
||||
|
||||
@Override public void onClick() { }
|
||||
@Override public void onClick(GuiQMAW gui) { }
|
||||
}
|
||||
|
||||
@ -2,9 +2,10 @@ package com.hbm.tileentity.network;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.calc.Location;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
@ -41,8 +42,8 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
Location loc = new Location(worldObj, xCoord, yCoord, zCoord).add(dir);
|
||||
TileEntity entity = loc.getTileEntity();
|
||||
BlockPos loc = new BlockPos(xCoord, yCoord, zCoord).offset(dir);
|
||||
TileEntity entity = Compat.getTileStandard(worldObj, loc.getX(), loc.getY(), loc.getZ());
|
||||
|
||||
if (entity != null && entity instanceof IEnergyReceiver) {
|
||||
IEnergyReceiver receiver = (IEnergyReceiver) entity;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1017 B After Width: | Height: | Size: 1.2 KiB |
Loading…
x
Reference in New Issue
Block a user