Skip to content

Commit

Permalink
Beta-1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Moulberry committed Apr 21, 2020
1 parent ae5bace commit 6360be8
Show file tree
Hide file tree
Showing 48 changed files with 3,412 additions and 436 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies {
//compile('org.spongepowered:mixin:0.7.11-SNAPSHOT')
compile('org.kohsuke:github-api:1.108')
compile('com.fasterxml.jackson.core:jackson-core:2.10.2')
compile('info.bliki.wiki:bliki-core:3.1.0')
}

/*mixin {
Expand All @@ -64,10 +65,14 @@ shadowJar {
include(dependency('com.fasterxml.jackson.core:jackson-databind:2.10.2'))
include(dependency('com.fasterxml.jackson.core:jackson-annotations:2.10.2'))
include(dependency('com.fasterxml.jackson.core:jackson-core:2.10.2'))
//exclude(dependency('com.fasterxml.jackson.core:jackson-annotations'))

include(dependency('info.bliki.wiki:bliki-core:3.1.0'))
include(dependency('org.slf4j:slf4j-api:1.7.18'))
include(dependency('org.luaj:luaj-jse:3.0.1'))
}

relocate 'com.fasterxml.jackson', 'neu.com.fasterxml.jackson'
relocate 'org.slf4j', 'neu.org.slf4j'

exclude 'module-info.class'
exclude 'dummyThing'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package io.github.moulberry.notenoughupdates;

import info.bliki.htmlcleaner.TagNode;
import info.bliki.wiki.filter.ITextConverter;
import info.bliki.wiki.model.IWikiModel;
import info.bliki.wiki.tags.HTMLTag;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public class AllowEmptyHTMLTag extends HTMLTag {
public AllowEmptyHTMLTag(String name) {
super(name);
}

public void renderHTML(ITextConverter converter, Appendable buf, IWikiModel model) throws IOException {
boolean newLinesAfterTag = false;
boolean newLinesAfterChildren = false;
TagNode node = this;
String name = node.getName();
List<Object> children = node.getChildren();

if (NEW_LINES) {
switch (name) {
case "div":
case "p":
case "li":
case "td":
buf.append('\n');
break;
case "table":
case "ul":
case "ol":
case "th":
case "tr":
buf.append('\n');
newLinesAfterTag = true;
newLinesAfterChildren = true;
break;
case "pre":
buf.append('\n');
newLinesAfterTag = false;
newLinesAfterChildren = true;
break;
case "blockquote":
newLinesAfterChildren = true;
break;
}
}
buf.append('<');
buf.append(name);

Map<String, String> tagAtttributes = node.getAttributes();

appendAttributes(buf, tagAtttributes);

if (children.size() == 0) {
buf.append(" />");
} else {
buf.append('>');
if (newLinesAfterTag) {
buf.append('\n');
}
converter.nodesToText(children, buf, model);
if (newLinesAfterChildren) {
buf.append('\n');
}
buf.append("</");
buf.append(node.getName());
buf.append('>');
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package io.github.moulberry.notenoughupdates;

import com.google.gson.JsonObject;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.client.resources.I18n;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class GuiItemRecipe extends GuiCrafting {

private ItemStack[] craftMatrix;
private String text;
private String craftText = "";
private NEUManager manager;

public GuiItemRecipe(ItemStack[] craftMatrix, JsonObject result, String text, NEUManager manager) {
super(Minecraft.getMinecraft().thePlayer.inventory, Minecraft.getMinecraft().theWorld);
this.craftMatrix = craftMatrix;
this.text = text;
this.manager = manager;

ContainerWorkbench cw = (ContainerWorkbench) this.inventorySlots;
for(int i=0; i<Math.min(craftMatrix.length, 9); i++) {
if(craftMatrix[i] == null) continue;
cw.craftMatrix.setInventorySlotContents(i, craftMatrix[i]);
}
if(result.has("crafttext")) {
craftText = result.get("crafttext").getAsString();
}
cw.craftResult.setInventorySlotContents(0, manager.jsonToStack(result));
}

protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String t = text.equals("") ? I18n.format("container.crafting", new Object[0]) : text;
int xPos = 28;
if(this.fontRendererObj.getStringWidth(t) > this.xSize - 40) {
xPos = 4;
}
if(t.contains("\u00a7")) {
this.fontRendererObj.drawStringWithShadow(t, xPos, 6, 4210752);
} else {
this.fontRendererObj.drawString(t, xPos, 6, 4210752);
}
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);

this.fontRendererObj.drawString(craftText, 88, 19, 4210752);
}

protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
}

protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
if(slotId >= 1 && slotId <= 9) {
ItemStack click = craftMatrix[slotId-1];
if(click != null) {
manager.displayGuiItemRecipe(manager.getInternalNameForItem(click), "");
}
}
}

/*public void handleMouseInput() throws IOException {
ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
int height = scaledresolution.getScaledHeight();
int mouseX = Mouse.getX() / scaledresolution.getScaleFactor();
int mouseY = height - Mouse.getY() / scaledresolution.getScaleFactor();
if(mouseY > this.guiTop + this.ySize - 94 || mouseY < this.guiTop ||
mouseX < this.guiLeft || mouseX > this.guiLeft+this.xSize) {
//Potentially allow mouse input in the future. For now this is still broken.
//super.handleMouseInput();
}
}*/

public void onCraftMatrixChanged(IInventory inventoryIn){}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public Map<String, String> getChangedItems(Map<String, String> oldShas) {
changedFiles.put(content.getName(), content.getSha());
}
}
} catch(IOException e) { }
} catch(IOException e) {
return null;
}
return changedFiles;
}

Expand Down
Loading

0 comments on commit 6360be8

Please sign in to comment.