Compare commits

..
Author SHA1 Message Date
Martin Robertz b1dff2ec2c Merge pull request #60 from asdflj/levelmaintainer
fix level maintainer bug
2023-01-16 16:22:43 +01:00
Martin Robertz 101f4de7ed Merge pull request #61 from GTNewHorizons/crafting-calc-v2-compat
Crafting calculator v2 compatibility
2023-01-15 21:54:47 +01:00
Martin Robertz 2679df71c4 Update dependencies.gradle 2023-01-15 15:56:05 +00:00
Raven Szewczyk 18630c9618 Add crafting calculator v2 compat for newer AE2-GTNH versions 2023-01-14 18:04:23 +00:00
Raven Szewczyk f203c24551 Update dependencies 2023-01-14 12:48:06 +00:00
Raven Szewczyk 7a1b507b08 Update buildscript 2023-01-14 11:28:25 +00:00
asdflj f07d996eb7 fix level maintainer if item can't be craft, it always requests item to crafting 2023-01-14 19:23:23 +08:00
Martin Robertz 36a9507c22 Merge pull request #59 from asdflj/levelmaintainer
fix fluid dupe
2023-01-13 09:35:28 +01:00
asdflj 5b5b11b330 fix fluid terminal bug
update zh-cn lang
2023-01-13 15:47:58 +08:00
11 changed files with 132 additions and 50 deletions

No files matched your search

+28 -10
View File
@@ -1,4 +1,4 @@
//version: 1669411416
//version: 1673027205
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -31,7 +31,7 @@ buildscript {
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH ForgeGradle Fork
// GTNH ForgeGradle and ASM Fork
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
@@ -45,7 +45,9 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.11'
//Overwrite the current ASM version to fix shading newer than java 8 applicatations.
classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.13'
}
}
plugins {
@@ -278,7 +280,9 @@ minecraft {
runDir = 'run'
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
for (f in replaceGradleTokenInFile.split(',')) {
replaceIn f
}
if (gradleTokenModId) {
replace gradleTokenModId, modId
}
@@ -315,9 +319,13 @@ if (file('addon.gradle').exists()) {
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
// TODO: remove Compile after all uses are refactored to Implementation
for (config in [shadowImplementation, shadowCompile, shadeCompile]) {
compileClasspath.extendsFrom(config)
runtimeClasspath.extendsFrom(config)
testCompileClasspath.extendsFrom(config)
testRuntimeClasspath.extendsFrom(config)
}
}
repositories {
@@ -330,6 +338,12 @@ repositories {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
if (usesMixinDebug.toBoolean()) {
maven {
name = "Fabric Maven"
url = "https://maven.fabricmc.net/"
}
}
}
}
@@ -338,10 +352,14 @@ dependencies {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.1:processor')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor')
if (usesMixinDebug.toBoolean()) {
runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
compile('com.gtnewhorizon:gtnhmixins:2.1.1')
compile('com.gtnewhorizon:gtnhmixins:2.1.3')
}
}
@@ -694,7 +712,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
}
}
if (usesMixins.toBoolean()) {
addModrinthDep("required", "version", "gtnhmixins")
addModrinthDep("required", "project", "gtnhmixins")
}
tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth)
+12 -13
View File
@@ -1,28 +1,27 @@
// Add your dependencies here
dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.10-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-133-GTNH:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.20-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-138-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')
compile('com.github.GTNewHorizons:waila:1.5.22:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.25:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.2:dev")
compileOnly('com.github.GTNewHorizons:ForestryMC:4.4.7:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.48:dev')
compileOnly('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.49:dev')
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.11:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.41:dev')
compileOnly('com.github.GTNewHorizons:StructureLib:1.0.15:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.216:dev')
compileOnly('com.github.GTNewHorizons:StructureLib:1.2.0-beta.2:dev')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:AppleCore:3.2.5:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.28:dev') { transitive = false }
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.23-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.19-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.29:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.49:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.8.0.5-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.27-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.191:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:KekzTech:0.6.22:dev')
compileOnly('com.github.GTNewHorizons:KekzTech:0.6.25:dev')
runtime('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
}
Vendored Regular → Executable
View File
File mode changed.
@@ -7,6 +7,7 @@ import com.glodblock.github.common.storage.FluidCellHandler;
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
import com.glodblock.github.crossmod.waila.WailaInit;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.loader.CalculatorV2PluginLoader;
import com.glodblock.github.loader.ChannelLoader;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.loader.RecipeLoader;
@@ -90,6 +91,16 @@ public class FluidCraft {
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 1);
}
try {
Class<?> calculatorV2 = Class.forName("appeng.crafting.v2.CraftingCalculations");
if (calculatorV2 != null) {
// Only run this if GTNH AE2 is installed
CalculatorV2PluginLoader.installCalculatorV2Plugins();
}
} catch (ClassNotFoundException e) {
// no-op
}
proxy.postInit(event);
}
@@ -1,5 +1,6 @@
package com.glodblock.github.client.gui;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.ITooltip;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
@@ -55,6 +56,27 @@ public class FCGuiTextField extends GuiTextField {
}
}
public void handleTooltip(int mouseX, int mouseY, AEBaseGui gui) {
this.handleTooltip(mouseX, mouseY, gui, 0);
}
public void handleTooltip(int mouseX, int mouseY, AEBaseGui gui, int offsetY) {
if (isMouseIn(mouseX, mouseY) && this.tooltip != null && !"".equals(this.tooltip)) {
int length = 0;
for (String s : this.getMessage().split("\n")) {
length = Math.max(this._fontRender.getStringWidth(s), length);
}
if (mouseY < 15) {
mouseY = 15;
}
if (mouseX + length + 20 >= gui.width) {
gui.drawTooltip(mouseX - length - 20, mouseY + 4 + offsetY, 0, this.getMessage());
} else {
gui.drawTooltip(mouseX, mouseY + 4 + offsetY, 0, this.getMessage());
}
}
}
public int getBorder() {
return this._border;
}
@@ -106,9 +106,9 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
super.drawScreen(mouseX, mouseY, btn);
for (Component com : this.component) {
handleTooltip(mouseX, mouseY, com.getQty().textField.new TooltipProvider());
handleTooltip(mouseX, mouseY, com.getBatch().textField.new TooltipProvider());
handleTooltip(mouseX, mouseY, com.getLine().new TooltipProvider());
com.getQty().textField.handleTooltip(mouseX, mouseY, this);
com.getBatch().textField.handleTooltip(mouseX, mouseY, this);
com.getLine().handleTooltip(mouseX, mouseY, this);
}
}
@@ -398,7 +398,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK_DESC) + "\n");
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT_DESC) + "\n");
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT_DESC));
} else {
message.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
@@ -342,7 +342,7 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer
}
private void dropItem(ItemStack is) {
if (is.stackSize <= 0) return;
if (is == null || is.stackSize <= 0) return;
ItemStack itemStack = is.copy();
int i = itemStack.getMaxStackSize();
while (itemStack.stackSize > 0) {
@@ -363,7 +363,7 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer
}
private void dropItem(ItemStack itemStack, int stackSize) {
if (itemStack.stackSize <= 0) return;
if (itemStack == null || itemStack.stackSize <= 0) return;
ItemStack is = itemStack.copy();
is.stackSize = stackSize;
this.dropItem(is);
@@ -376,7 +376,7 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer
ItemStack out = fluidContainer.copy();
out.stackSize = 1;
if (Util.FluidUtil.isEmpty(fluidContainer) && fluid != null) {
// add fluid to tanks
// add fluid to tanks
if (nfluid.getStackSize() <= 0) continue;
final IAEFluidStack toExtract = nfluid.copy();
MutablePair<Integer, ItemStack> fillStack = Util.FluidUtil.fillStack(out, toExtract.getFluidStack());
@@ -390,26 +390,20 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer
this.dropItem(fillStack.right);
out.stackSize = fillStack.right.stackSize;
if (fillStack.right.getItem() instanceof IFluidContainerItem) {
if (fillStack.right.stackSize == 0) {
if ((int) (tmp.getStackSize() % fillStack.left) > 0) {
((IFluidContainerItem) fillStack.right.getItem())
.drain(
fillStack.right,
fillStack.left - (int) (tmp.getStackSize() % fillStack.left),
true);
this.dropItem(fillStack.right, 1);
out.stackSize++;
}
} else {
toExtract.setStackSize((long) fillStack.right.stackSize * fillStack.left);
}
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
if ((int) (tmp.getStackSize() % fillStack.left) > 0) {
this.dropItem(
Util.FluidUtil.setFluidContainerAmount(
fillStack.right, (int) (tmp.getStackSize() % fillStack.left)),
1);
out.stackSize++;
}
} else if (FluidContainerRegistry.isContainer(fillStack.right)) {
toExtract.setStackSize((long) fillStack.right.stackSize * fillStack.left);
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
}
} else if (!Util.FluidUtil.isEmpty(fluidContainer)) {
// add fluid to ae network
// add fluid to ae network
AEFluidStack fluidStack = Util.getAEFluidFromItem(fluidContainer);
final IAEFluidStack aeFluidStack = fluidStack.copy();
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
@@ -149,8 +149,9 @@ public class TileLevelMaintainer extends AENetworkTile
if (this.requests.isDone(i)) this.requests.setState(i, State.Idling);
if (cg.canEmitFor(craftItem)
|| cg.isRequesting(craftItem)
|| (inv.findPrecise(is) != null
&& inv.findPrecise(is).getStackSize() >= is.getStackSize())
|| inv.findPrecise(is) == null
|| !inv.findPrecise(is).isCraftable()
|| inv.findPrecise(is).getStackSize() >= is.getStackSize()
|| !this.requests.isDone(i)) continue;
// do crafting
Future<ICraftingJob> jobTask = requests.getJobs()[i];
@@ -0,0 +1,21 @@
package com.glodblock.github.loader;
import appeng.api.storage.data.IAEItemStack;
import appeng.crafting.v2.CraftingCalculations;
import appeng.crafting.v2.CraftingRequest;
import appeng.util.Platform;
import com.glodblock.github.common.item.ItemFluidDrop;
public class CalculatorV2PluginLoader {
private static long adjustByteCost(CraftingRequest<IAEItemStack> request, Long originalAmount) {
if (request.stack.getItem() instanceof ItemFluidDrop) {
return Platform.ceilDiv(originalAmount, 1000L);
} else {
return originalAmount;
}
}
public static void installCalculatorV2Plugins() {
CraftingCalculations.registerByteAmountAdjuster(CalculatorV2PluginLoader::adjustByteCost, IAEItemStack.class);
}
}
@@ -279,6 +279,22 @@ public final class Util {
return null;
}
public static ItemStack setFluidContainerAmount(ItemStack itemStack, int amount) {
FluidStack fs = getFluidFromContainer(itemStack);
if (fs == null) return null;
fs.amount = amount;
ItemStack is = itemStack.copy();
is.stackSize = 1;
ItemStack emptyContainer = clearFluid(is);
if (emptyContainer == null) return null;
MutablePair<Integer, ItemStack> result = fillStack(emptyContainer, fs);
if (result != null) {
result.right.stackSize = itemStack.stackSize;
return result.right;
}
return null;
}
public static MutablePair<Integer, ItemStack> drainStack(ItemStack itemStack, FluidStack fluid) {
if (itemStack == null) return null;
Item item = itemStack.getItem();
@@ -312,7 +328,7 @@ public final class Util {
// get the filled fluidstack.
FluidStack filled = FluidContainerRegistry.getFluidForFilledItem(filledContainer);
// Return filled container and fill amount.
return new MutablePair<>(filled != null ? filled.amount : 0, filledContainer);
return new MutablePair<Integer, ItemStack>(filled != null ? filled.amount : 0, filledContainer);
}
return null;
}
@@ -51,9 +51,9 @@ ae2fc.tooltip.level_maintainer.link=§e合成中§r
ae2fc.tooltip.level_maintainer.link_desc=系统当前正在制作请求的物品或流体。
ae2fc.tooltip.level_maintainer.export=§5输出中§r
ae2fc.tooltip.level_maintainer.export_desc=请求器正在尝试将制作结果导出到ME系统。如果请求器长期处于此状态,则说明没有可用的存储空间。
ae2fc.tooltip.level_maintainer.batch_size=§6请求次数§r
ae2fc.tooltip.level_maintainer.batch_size.hint=当发出合成请求时,请求器发送合成请求次数的多少。更多的请求次数将提高储存物品的速度,但需要更多的合成存储空间。
ae2fc.tooltip.level_maintainer.request_size=§6请求数量§r
ae2fc.tooltip.level_maintainer.batch_size=§6单次合成数量§r
ae2fc.tooltip.level_maintainer.batch_size.hint=当发出合成请求时,请求器发送单次合成数量的多少。更多的单次合成数量将提高储存物品的速度,但需要更多的合成存储空间。
ae2fc.tooltip.level_maintainer.request_size=§6缓存量§r
ae2fc.tooltip.level_maintainer.request_size.hint=数量定义了在请求器开始请求新合成之前应该保留多少物品。
ae2fc.tooltip.cell_contents=内含流体: