Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public class GeneralConfig extends DummyConfig {
public static boolean terminalStorageDefaultToCraftingPlanTree = false;
@ConfigurableProperty(category = "core", comment = "The limit for the number of leaves in a tree-based crafting plan after which it won't be sent to the client anymore.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
public static int terminalStorageMaxTreePlanSize = 64;
@ConfigurableProperty(category = "core", comment = "If storage terminals can be ender-upgraded with an eye of ender to gain a tab with the player's ender chest contents.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
public static boolean terminalStorageTabEnderChestEnabled = true;
@ConfigurableProperty(category = "core", comment = "If ender-upgraded storage terminals should emit ender particles.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
public static boolean terminalStorageEnderParticles = false;

@ConfigurableProperty(category = "machine", comment = "The number of items that should be selected when clicking on an item in the storage terminal.", isCommandable = true)
public static int guiStorageItemInitialQuantity = 64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import org.cyclops.integratedterminals.api.terminalstorage.ITerminalStorageTabRegistry;
import org.cyclops.integratedterminals.api.terminalstorage.crafting.ITerminalStorageTabIngredientCraftingHandlerRegistry;
import org.cyclops.integratedterminals.api.terminalstorage.location.ITerminalStorageLocationRegistry;
import org.cyclops.integratedterminals.advancement.criterion.TerminalStorageEnderUpgradedTriggerConfig;
import org.cyclops.integratedterminals.block.BlockChorusGlassConfig;
import org.cyclops.integratedterminals.block.BlockMenrilGlassConfig;
import org.cyclops.integratedterminals.capability.ingredient.TerminalIngredientComponentCapabilities;
import org.cyclops.integratedterminals.component.DataComponentEnderUpgradedConfig;
import org.cyclops.integratedterminals.component.DataComponentTerminalStorageInventoriesConfig;
import org.cyclops.integratedterminals.component.DataComponentTerminalStorageStateConfig;
import org.cyclops.integratedterminals.core.terminalstorage.TerminalStorageTabRegistry;
Expand All @@ -36,6 +38,7 @@
import org.cyclops.integratedterminals.item.ItemTerminalStoragePortableConfig;
import org.cyclops.integratedterminals.modcompat.integratedcrafting.IntegratedCraftingModCompat;
import org.cyclops.integratedterminals.part.PartTypes;
import org.cyclops.integratedterminals.recipe.RecipeTerminalStoragePortableEnderUpgradeConfig;
import org.cyclops.integratedterminals.proxy.ClientProxy;
import org.cyclops.integratedterminals.proxy.CommonProxy;

Expand Down Expand Up @@ -122,6 +125,11 @@ public void onConfigsRegister(ConfigHandler configHandler) {

configHandler.addConfigurable(new DataComponentTerminalStorageInventoriesConfig());
configHandler.addConfigurable(new DataComponentTerminalStorageStateConfig());
configHandler.addConfigurable(new DataComponentEnderUpgradedConfig());

configHandler.addConfigurable(new RecipeTerminalStoragePortableEnderUpgradeConfig());

configHandler.addConfigurable(new TerminalStorageEnderUpgradedTriggerConfig());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.neoforged.neoforge.registries.DeferredHolder;
import org.cyclops.cyclopscore.recipe.type.RecipeCraftingShapelessCustomOutput;
import org.cyclops.integrateddynamics.core.item.ItemBlockEnergyContainer;
import org.cyclops.integratedterminals.inventory.container.ContainerTerminalCraftingJobs;
import org.cyclops.integratedterminals.inventory.container.ContainerTerminalCraftingJobsPlan;
Expand Down Expand Up @@ -38,5 +40,8 @@ public class RegistryEntries {

public static final DeferredHolder<DataComponentType<?>, DataComponentType<CompoundTag>> COMPONENT_TERMINAL_STORAGE_INVENTORIES = DeferredHolder.create(Registries.DATA_COMPONENT_TYPE, ResourceLocation.parse("integratedterminals:terminal_storage_inventories"));
public static final DeferredHolder<DataComponentType<?>, DataComponentType<CompoundTag>> COMPONENT_TERMINAL_STORAGE_STATE = DeferredHolder.create(Registries.DATA_COMPONENT_TYPE, ResourceLocation.parse("integratedterminals:terminal_storage_state"));
public static final DeferredHolder<DataComponentType<?>, DataComponentType<Boolean>> COMPONENT_ENDER_UPGRADED = DeferredHolder.create(Registries.DATA_COMPONENT_TYPE, ResourceLocation.parse("integratedterminals:ender_upgraded"));

public static final DeferredHolder<RecipeSerializer<?>, RecipeSerializer<RecipeCraftingShapelessCustomOutput>> RECIPESERIALIZER_TERMINAL_STORAGE_PORTABLE_ENDER_UPGRADE = DeferredHolder.create(Registries.RECIPE_SERIALIZER, ResourceLocation.parse("integratedterminals:crafting_special_terminal_storage_portable_ender_upgrade"));

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.cyclops.integratedterminals.advancement.criterion;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.server.level.ServerPlayer;

import javax.annotation.Nullable;
import java.util.Optional;

/**
* Triggers when a storage terminal is ender-upgraded.
* @author rubensworks
*/
public class TerminalStorageEnderUpgradedTrigger extends SimpleCriterionTrigger<TerminalStorageEnderUpgradedTrigger.Instance> {

@Nullable
private static TerminalStorageEnderUpgradedTrigger INSTANCE = null;

public static final Codec<TerminalStorageEnderUpgradedTrigger.Instance> CODEC = RecordCodecBuilder.create(
builder -> builder.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(TerminalStorageEnderUpgradedTrigger.Instance::player)
)
.apply(builder, TerminalStorageEnderUpgradedTrigger.Instance::new)
);

public TerminalStorageEnderUpgradedTrigger() {
INSTANCE = this;
}

@Override
public Codec<TerminalStorageEnderUpgradedTrigger.Instance> codec() {
return CODEC;
}

/**
* Trigger this criterion for the given player.
* @param player The player that ender-upgraded a storage terminal.
*/
public static void onEnderUpgraded(ServerPlayer player) {
if (INSTANCE != null) {
INSTANCE.trigger(player, instance -> true);
}
}

public static record Instance(
Optional<ContextAwarePredicate> player
) implements SimpleCriterionTrigger.SimpleInstance {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.cyclops.integratedterminals.advancement.criterion;

import org.cyclops.cyclopscore.config.extendedconfig.CriterionTriggerConfig;
import org.cyclops.integratedterminals.IntegratedTerminals;

/**
* Config for {@link TerminalStorageEnderUpgradedTrigger}.
* @author rubensworks
*/
public class TerminalStorageEnderUpgradedTriggerConfig extends CriterionTriggerConfig<TerminalStorageEnderUpgradedTrigger.Instance> {

public TerminalStorageEnderUpgradedTriggerConfig() {
super(
IntegratedTerminals._instance,
"terminal_storage_ender_upgraded",
new TerminalStorageEnderUpgradedTrigger()
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,34 @@ public boolean handleScroll(AbstractContainerMenu container, int channel, int ho
*/
public List<ITerminalButton<?, ?, ?>> getButtons();

/**
* @return If the search field should be shown for this tab.
*/
public default boolean hasSearchField() {
return true;
}

/**
* @return If the channel field should be shown for this tab.
*/
public default boolean hasChannelField() {
return true;
}

/**
* @return If the variable-based filter slots should be shown for this tab.
*/
public default boolean hasVariableFilterSlots() {
return true;
}

/**
* @return If the scrollbar next to the storage grid should be shown for this tab.
*/
public default boolean hasScrollbar() {
return true;
}

public default int getSlotOffsetX() {
return DEFAULT_SLOT_OFFSET_X;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.world.item.ItemStack;
import org.apache.commons.lang3.tuple.Pair;
import org.cyclops.integrateddynamics.api.evaluate.variable.ValueDeseralizationContext;
import org.cyclops.integratedterminals.inventory.container.ContainerTerminalStorageBase;

import javax.annotation.Nullable;
import java.util.Collections;
Expand Down Expand Up @@ -37,6 +38,22 @@ public default void onUpdate(AbstractContainerMenu container, Player player,

}

/**
* Handle a quick move (shift-click) on the given container slot.
*
* This is only called for the tab that is currently selected,
* and allows tabs with regular container slots to apply regular quick move semantics.
*
* @param container The active container.
* @param player The player that is quick moving.
* @param slotIndex The index of the slot that is being quick moved.
* @return The moved stack following {@link AbstractContainerMenu#quickMoveStack} semantics,
* or {@link Optional#empty()} if this tab does not handle quick moves.
*/
public default Optional<ItemStack> handleQuickMove(ContainerTerminalStorageBase<?> container, Player player, int slotIndex) {
return Optional.empty();
}

public static interface IVariableInventory {
public default void loadNamedInventory(String name, Container inventory, HolderLookup.Provider holderLookupProvider) {
NonNullList<ItemStack> tabItems = this.getNamedInventory(name, holderLookupProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ public interface ITerminalStorageTabRegistry extends IRegistry {
*/
public <T extends ITerminalStorageTab> T register(T tab);

/**
* Register a new tab, and make sure it is placed after all currently registered tabs.
*
* This is useful for tabs that are registered from an event that is fired multiple times,
* as those would otherwise end up in-between the tabs that are registered from later firings.
*
* @param tab The tab to register.
* @param <T> The tab type.
* @return The registered tab.
*/
public default <T extends ITerminalStorageTab> T registerLast(T tab) {
return register(tab);
}

/**
* Get a tab by unique name.
* @param name The tab name.
Expand Down
Loading
Loading