Added config to change the armory cab size
This commit is contained in:
parent
0c0d08597b
commit
11d8ee407a
|
@ -12,7 +12,7 @@ buildscript {
|
|||
apply plugin: 'net.minecraftforge.gradle'
|
||||
|
||||
group = 'com.buuz135'
|
||||
version = '1.0.0'
|
||||
version = '0.0.1-pre'
|
||||
|
||||
java {
|
||||
archivesBaseName = 'functionalstorage'
|
||||
|
@ -86,7 +86,7 @@ repositories {
|
|||
dependencies {
|
||||
|
||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
|
||||
implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.0-21'))
|
||||
implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.0-23'))
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.46:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.46")
|
||||
runtimeOnly fg.deobf("curse.maven:refined-storage-243076:3569563")
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.buuz135.functionalstorage.block.config;
|
||||
|
||||
import com.hrznstudio.titanium.annotation.config.ConfigFile;
|
||||
import com.hrznstudio.titanium.annotation.config.ConfigVal;
|
||||
|
||||
@ConfigFile(value = "functionalstorage-common")
|
||||
public class FunctionalStorageConfig {
|
||||
|
||||
@ConfigVal(comment = "Armory slot amount")
|
||||
@ConfigVal.InRangeInt(min = 1)
|
||||
public static int ARMORY_CABINET_SIZE = 4096;
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.buuz135.functionalstorage.inventory;
|
||||
|
||||
import com.buuz135.functionalstorage.FunctionalStorage;
|
||||
import com.buuz135.functionalstorage.block.config.FunctionalStorageConfig;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.util.INBTSerializable;
|
||||
|
@ -13,9 +15,6 @@ import java.util.List;
|
|||
|
||||
public abstract class ArmoryCabinetInventoryHandler implements IItemHandler, INBTSerializable<CompoundTag> {
|
||||
|
||||
public static final int SLOTS = 8192;
|
||||
//TODO NERF AND POSSIBLY CONFIG
|
||||
|
||||
public List<ItemStack> stackList;
|
||||
|
||||
public ArmoryCabinetInventoryHandler() {
|
||||
|
@ -24,7 +23,7 @@ public abstract class ArmoryCabinetInventoryHandler implements IItemHandler, INB
|
|||
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return SLOTS;
|
||||
return FunctionalStorageConfig.ARMORY_CABINET_SIZE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -91,7 +90,7 @@ public abstract class ArmoryCabinetInventoryHandler implements IItemHandler, INB
|
|||
|
||||
private List<ItemStack> create(){
|
||||
List<ItemStack> stackList = new ArrayList<>();
|
||||
for (int i = 0; i < SLOTS; i++) {
|
||||
for (int i = 0; i < FunctionalStorageConfig.ARMORY_CABINET_SIZE; i++) {
|
||||
stackList.add(ItemStack.EMPTY);
|
||||
}
|
||||
return stackList;
|
||||
|
@ -101,7 +100,10 @@ public abstract class ArmoryCabinetInventoryHandler implements IItemHandler, INB
|
|||
public void deserializeNBT(CompoundTag nbt) {
|
||||
this.stackList = create();
|
||||
for (String allKey : nbt.getAllKeys()) {
|
||||
this.stackList.set(Integer.parseInt(allKey), ItemStack.of(nbt.getCompound(allKey)));
|
||||
int pos = Integer.parseInt(allKey);
|
||||
if (pos < this.stackList.size()){
|
||||
this.stackList.set(pos, ItemStack.of(nbt.getCompound(allKey)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user