Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Add your dependencies here

dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.11.0:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.7.3:dev')
api('com.github.GTNewHorizons:ForestryMC:4.11.4:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.9.13:dev')

devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.26-GTNH:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.63-GTNH:dev')

compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.45:api')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.55:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
}
26 changes: 23 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,34 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel

# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1

# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8

# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25

# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.6'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.19'
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,29 @@
public class ComponentInventorySlots extends ComponentInventory implements IInventoryMachine, IInventorySlots {

private final Map<Integer, InventorySlot> inventory = new LinkedHashMap<>();
private int cachedSize = 0;
private int[] cachedAccessibleSlots = null;

public ComponentInventorySlots(IMachine machine) {
super(machine);
}

@Override
public int getSizeInventory() {
int size = 0;
for (Integer index : inventory.keySet()) {
size = Math.max(size, index + 1);
}
return size;
return cachedSize;
}

@Override
public ItemStack getStackInSlot(int index) {
if (inventory.containsKey(index)) {
return inventory.get(index).getContent();
}
return null;
InventorySlot slot = inventory.get(index);
return slot != null ? slot.getContent() : null;
}

@Override
public ItemStack decrStackSize(int index, int amount) {
if (inventory.containsKey(index)) {
ItemStack stack = inventory.get(index).decrStackSize(amount);
InventorySlot slot = inventory.get(index);
if (slot != null) {
ItemStack stack = slot.decrStackSize(amount);
markDirty();
return stack;
}
Expand All @@ -59,8 +56,9 @@ public ItemStack getStackInSlotOnClosing(int var1) {

@Override
public void setInventorySlotContents(int index, ItemStack itemStack) {
if (inventory.containsKey(index) && (itemStack == null || inventory.get(index).isValid(itemStack))) {
inventory.get(index).setContent(itemStack);
InventorySlot slot = inventory.get(index);
if (slot != null && (itemStack == null || slot.isValid(itemStack))) {
slot.setContent(itemStack);
}
markDirty();
}
Expand Down Expand Up @@ -125,6 +123,8 @@ public void writeToNBT(NBTTagCompound nbttagcompound) {
@Override
public InventorySlot addSlot(int index, String unlocalizedName) {
inventory.put(index, new InventorySlot(index, unlocalizedName));
cachedSize = Math.max(cachedSize, index + 1);
cachedAccessibleSlots = null;
return getSlot(index);
}

Expand All @@ -138,10 +138,7 @@ public InventorySlot[] addSlotArray(int[] indexes, String unlocalizedName) {

@Override
public InventorySlot getSlot(int index) {
if (inventory.containsKey(index)) {
return inventory.get(index);
}
return null;
return inventory.get(index);
}

@Override
Expand Down Expand Up @@ -213,18 +210,20 @@ public void onDestruction() {

@Override
public int[] getAccessibleSlotsFromSide(int var1) {
List<Integer> slots = new ArrayList<>();
for (InventorySlot slot : inventory.values()) {
if (slot.canInsert() || slot.canExtract()) {
slots.add(slot.getIndex());
if (cachedAccessibleSlots == null) {
List<Integer> slots = new ArrayList<>();
for (InventorySlot slot : inventory.values()) {
if (slot.canInsert() || slot.canExtract()) {
slots.add(slot.getIndex());
}
}
}

int[] ids = new int[slots.size()];
for (int i = 0; i < slots.size(); ++i) {
ids[i] = slots.get(i);
cachedAccessibleSlots = new int[slots.size()];
for (int i = 0; i < slots.size(); ++i) {
cachedAccessibleSlots[i] = slots.get(i);
}
}
return ids;
return cachedAccessibleSlots;
}

@Override
Expand Down