Post-merge fixes and item generator fix.

This commit is contained in:
Sebastian Hartte
2020-09-16 20:12:38 +02:00
parent c0575e11b0
commit 483f93f977
4 changed files with 97 additions and 81 deletions
+50 -56
View File
@@ -48,21 +48,42 @@ repositories {
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}:api"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
// Runtime, Mods
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}")
modImplementation "alexiil.mc.lib:libblockattributes-core:${libblockattributes_version}"
modImplementation "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
modImplementation "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-core:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
// Energy API
modApi "teamreborn:energy:${tr_energy_version}"
include "teamreborn:energy:${tr_energy_version}"
modCompileOnly("me.shedaniel:RoughlyEnoughItems:${rei_version}") {
exclude group: "net.fabricmc.fabric-api"
}
modCompileOnly("mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75") {
exclude group: "net.fabricmc.fabric-api"
}
modRuntime("me.shedaniel:RoughlyEnoughItems:${rei_version}") {
exclude group: "net.fabricmc.fabric-api"
}
modRuntime("TechReborn:TechReborn-1.16:3.5.1+build.101") {
exclude group: "net.fabricmc.fabric-api"
}
// modRuntimeOnly "mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75"
implementation 'com.google.code.findbugs:jsr305:3.0.2'
// unit test dependencies
testCompile "junit:junit:4.13"
// Annotation Processors
annotationProcessor 'org.spongepowered:mixin:0.8:processor'
}
group = artifact_group
archivesBaseName = artifact_basename
@@ -81,7 +102,6 @@ tasks.withType(JavaCompile) {
///////////////////
// Version Number
version = version_major + "." + version_minor + "." + version_patch
ext.pr = System.getenv('PR_NUMBER') ?: ""
if (ext.pr) {
@@ -147,45 +167,6 @@ minecraft {
accessWidener "src/main/resources/appliedenergistics2.accesswidener"
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
modImplementation "alexiil.mc.lib:libblockattributes-core:${libblockattributes_version}"
modImplementation "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
modImplementation "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-core:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
// Energy API
modApi "teamreborn:energy:${tr_energy_version}"
include "teamreborn:energy:${tr_energy_version}"
modCompileOnly("me.shedaniel:RoughlyEnoughItems:${rei_version}") {
exclude group: "net.fabricmc.fabric-api"
}
modCompileOnly("mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75") {
exclude group: "net.fabricmc.fabric-api"
}
modRuntime("me.shedaniel:RoughlyEnoughItems:${rei_version}") {
exclude group: "net.fabricmc.fabric-api"
}
modRuntime("TechReborn:TechReborn-1.16:3.5.1+build.101") {
exclude group: "net.fabricmc.fabric-api"
}
// modRuntimeOnly "mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75"
implementation 'com.google.code.findbugs:jsr305:3.0.2'
// unit test dependencies
testCompile "junit:junit:4.13"
}
processResources {
inputs.property "version", project.version
@@ -206,8 +187,7 @@ processResources {
}
jar {
finalizedBy 'reobfJar'
finalizedBy 'signJar'
finalizedBy 'remapJar'
from sourceSets.main.output.classesDirs
from sourceSets.api.output.classesDirs
@@ -242,10 +222,13 @@ task javadocJar(type: Jar, dependsOn: javadocs) {
classifier = "javadoc"
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allJava
from sourceSets.api.allJava
from sourceSets.main.allSource
from sourceSets.api.allSource
}
task apiJar(type: Jar) {
@@ -345,7 +328,7 @@ spotless {
////////////////
// Curse Forge
if (System.getenv("CURSEFORGE")) {
if (System.getenv("CURSEFORGE") && !version.endsWith("-SNAPSHOT")) {
def cfReleaseType = "release"
if (ext.isAlpha) {
cfReleaseType = "alpha"
@@ -360,6 +343,17 @@ if (System.getenv("CURSEFORGE")) {
changelogType = "markdown"
changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases) for a changelog"
releaseType = cfReleaseType
addGameVersion project.minecraft_version
addGameVersion "Fabric"
mainArtifact(remapJar.archiveFile) {
displayName = "${project.version} [FABRIC]"
}
}
options {
forgeGradleIntegration = false
}
afterEvaluate {
tasks.getByName("curseforge${project.curseforge_project}").dependsOn remapJar
}
}
}
@@ -314,7 +314,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
public boolean mouseReleased(double mouseX, double mouseY, int button) {
// Forward left mouse button up events to the scrollbar
if (button == 0 && this.getScrollBar() != null) {
if (this.getScrollBar().mouseUp(mouseX - this.guiLeft, mouseY - this.guiTop)) {
if (this.getScrollBar().mouseUp(mouseX - this.x, mouseY - this.y)) {
return true;
}
}
@@ -21,11 +21,9 @@ package appeng.client.gui.widgets;
import java.time.Duration;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.Rect2i;
import net.minecraft.client.util.math.MatrixStack;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Rectangle2d;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import appeng.client.gui.AEBaseScreen;
@@ -55,20 +53,20 @@ public class Scrollbar extends DrawableHelper implements IScrollSource {
/**
* Texture containing the scrollbar handle sprites.
*/
private static final ResourceLocation TEXTURE = new ResourceLocation("minecraft",
private static final Identifier TEXTURE = new Identifier("minecraft",
"textures/gui/container/creative_inventory/tabs.png");
/**
* Rectangle in the source texture that contains the sprite for an enabled
* handle.
*/
private static final Rectangle2d ENABLED = new Rectangle2d(232, 0, HANDLE_WIDTH, HANDLE_HEIGHT);
private static final Rect2i ENABLED = new Rect2i(232, 0, HANDLE_WIDTH, HANDLE_HEIGHT);
/**
* Rectangle in the source texture that contains the sprite for a disabled
* handle.
*/
private static final Rectangle2d DISABLED = new Rectangle2d(232 + HANDLE_WIDTH, 0, HANDLE_WIDTH, HANDLE_HEIGHT);
private static final Rect2i DISABLED = new Rect2i(232 + HANDLE_WIDTH, 0, HANDLE_WIDTH, HANDLE_HEIGHT);
/**
* The screen x-coordinate of the scrollbar's inner track.
@@ -115,7 +113,7 @@ public class Scrollbar extends DrawableHelper implements IScrollSource {
* background.
*/
public void draw(MatrixStack matrices, final AEBaseScreen<?> g) {
setBlitOffset(g.getBlitOffset());
setZOffset(g.getZOffset());
// Draw the track (nice for debugging)
// fill(matrices, displayX, displayY, this.displayX + width, this.displayY +
@@ -124,7 +122,7 @@ public class Scrollbar extends DrawableHelper implements IScrollSource {
g.bindTexture(TEXTURE);
int yOffset;
Rectangle2d sourceRect;
Rect2i sourceRect;
if (this.getRange() == 0) {
yOffset = 0;
sourceRect = DISABLED;
@@ -133,7 +131,7 @@ public class Scrollbar extends DrawableHelper implements IScrollSource {
sourceRect = ENABLED;
}
blit(matrices, this.displayX, this.displayY + yOffset, sourceRect.getX(), sourceRect.getY(),
drawTexture(matrices, this.displayX, this.displayY + yOffset, sourceRect.getX(), sourceRect.getY(),
sourceRect.getWidth(), sourceRect.getHeight());
}
@@ -33,6 +33,7 @@ import net.minecraft.world.World;
import alexiil.mc.lib.attributes.AttributeList;
import alexiil.mc.lib.attributes.Simulation;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import alexiil.mc.lib.attributes.item.ItemExtractable;
import alexiil.mc.lib.attributes.item.filter.ExactItemStackFilter;
import alexiil.mc.lib.attributes.item.filter.ItemFilter;
@@ -43,7 +44,7 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
private static final Queue<ItemStack> POSSIBLE_ITEMS = new ArrayDeque<>();
private final ItemExtractable handler = new QueuedItemHandler();
private final QueuedItemHandler handler = new QueuedItemHandler();
public ItemGenBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
@@ -77,22 +78,24 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
to.offer(handler);
}
class QueuedItemHandler implements ItemExtractable {
static class QueuedItemHandler implements FixedItemInv {
@Override
public ItemStack attemptExtraction(ItemFilter itemFilter, int maxAmount, Simulation simulation) {
// When item filter asks for a specific item, just return that
if (itemFilter instanceof ExactItemStackFilter) {
return ((ExactItemStackFilter) itemFilter).stack.copy();
}
public ItemExtractable getExtractable() {
return (itemFilter, i, simulation) -> {
// When item filter asks for a specific item, just return that
if (itemFilter instanceof ExactItemStackFilter) {
return ((ExactItemStackFilter) itemFilter).stack.copy();
}
final ItemStack is = POSSIBLE_ITEMS.peek();
final ItemStack is = POSSIBLE_ITEMS.peek();
if (is == null || !itemFilter.matches(is)) {
return ItemStack.EMPTY;
}
if (is == null || !itemFilter.matches(is)) {
return ItemStack.EMPTY;
}
return simulation == Simulation.SIMULATE ? is.copy() : this.getNextItem();
return simulation == Simulation.SIMULATE ? is.copy() : getNextItem();
};
}
private ItemStack getNextItem() {
@@ -101,7 +104,28 @@ public class ItemGenBlockEntity extends AEBaseBlockEntity {
POSSIBLE_ITEMS.add(is);
return is.copy();
}
}
;
@Override
public int getSlotCount() {
return 1;
}
@Override
public ItemStack getInvStack(int i) {
return POSSIBLE_ITEMS.peek().copy();
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
return false;
}
@Override
public boolean setInvStack(int i, ItemStack itemStack, Simulation simulation) {
if (itemStack.isEmpty()) {
getNextItem(); // Go to next item
}
return itemStack.isEmpty();
}
}
}