CPU_SELECTION_MODE = register("crafting_scheduling_mode",
- CpuSelectionMode.class);
public static Setting> getOrThrow(String name) {
var setting = SETTINGS.get(name);
diff --git a/src/main/java/appeng/api/config/ShowPatternProviders.java b/src/main/java/appeng/api/config/ShowPatternProviders.java
deleted file mode 100644
index 7a4833eb0b4..00000000000
--- a/src/main/java/appeng/api/config/ShowPatternProviders.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package appeng.api.config;
-
-public enum ShowPatternProviders {
- /**
- * Show pattern providers that are not hidden in pattern access terminal.
- */
- VISIBLE,
- /**
- * Show pattern providers that are not hidden in pattern access terminal, and that were not full when the terminal
- * was opened / the setting was set.
- */
- NOT_FULL,
- /**
- * Show all pattern providers.
- */
- ALL
-}
diff --git a/src/main/java/appeng/api/config/TypeFilter.java b/src/main/java/appeng/api/config/TypeFilter.java
deleted file mode 100644
index 188ccd1af04..00000000000
--- a/src/main/java/appeng/api/config/TypeFilter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package appeng.api.config;
-
-import appeng.api.stacks.AEKeyType;
-import appeng.api.storage.AEKeyFilter;
-
-/**
- * Configures a type-based filter for terminals and other views.
- */
-public enum TypeFilter {
- ALL(AEKeyFilter.none()),
- ITEMS(AEKeyType.items().filter()),
- FLUIDS(AEKeyType.fluids().filter());
-
- private final AEKeyFilter filter;
-
- TypeFilter(AEKeyFilter filter) {
- this.filter = filter;
- }
-
- public AEKeyFilter getFilter() {
- return filter;
- }
-}
diff --git a/src/main/java/appeng/api/config/ViewItems.java b/src/main/java/appeng/api/config/ViewItems.java
deleted file mode 100644
index 160543652d6..00000000000
--- a/src/main/java/appeng/api/config/ViewItems.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.config;
-
-public enum ViewItems {
- ALL, STORED, CRAFTABLE
-}
diff --git a/src/main/java/appeng/api/crafting/IPatternDetails.java b/src/main/java/appeng/api/crafting/IPatternDetails.java
deleted file mode 100644
index 781639f67cf..00000000000
--- a/src/main/java/appeng/api/crafting/IPatternDetails.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.crafting;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.world.item.crafting.Recipe;
-import net.minecraft.world.level.Level;
-
-import appeng.api.stacks.AEItemKey;
-import appeng.api.stacks.AEKey;
-import appeng.api.stacks.GenericStack;
-
-/**
- * Information about a pattern for use by the autocrafting system.
- *
- * Implementing classes need to properly implement equals/hashCode for crafting jobs to resume properly after
- * world or chunk reloads.
- */
-public interface IPatternDetails {
- /**
- * Return the type of the encoded item of this pattern, containing all the data to retrieve the pattern later from
- * {@link PatternDetailsHelper#decodePattern}.
- */
- AEItemKey getDefinition();
-
- /**
- * The inputs of this pattern. The return array must never be edited.
- */
- IInput[] getInputs();
-
- /**
- * The primary output of this pattern. The pattern will only be used to craft the primary output; the others are
- * just byproducts.
- */
- default GenericStack getPrimaryOutput() {
- return getOutputs()[0];
- }
-
- /**
- * The outputs of this pattern. The return array or any of its stacks must never be edited.
- */
- GenericStack[] getOutputs();
-
- interface IInput {
- /**
- * A list of possible inputs for this pattern: the first input is the primary input, others are just substitutes
- * that will be used if available but won't be autocrafted. For example you can return [1000 mb of water fluid,
- * 1 bucket of water item] to use water if possible, but use stored buckets otherwise.
- *
- * The return array or any of its stacks must never be edited.
- */
- GenericStack[] getPossibleInputs();
-
- /**
- * Multiplier for the inputs: how many possible inputs are necessary to craft this pattern.
- */
- long getMultiplier();
-
- /**
- * Check if the passed stack is a valid input.
- */
- boolean isValid(AEKey input, Level level);
-
- /**
- * Optionally return a remaining key. This will generally be null for processing patterns, and return the
- * corresponding slot of {@link Recipe#getRemainingItems} for crafting patterns.
- */
- @Nullable
- AEKey getRemainingKey(AEKey template);
- }
-}
diff --git a/src/main/java/appeng/api/crafting/IPatternDetailsDecoder.java b/src/main/java/appeng/api/crafting/IPatternDetailsDecoder.java
deleted file mode 100644
index 0daf6d78d6e..00000000000
--- a/src/main/java/appeng/api/crafting/IPatternDetailsDecoder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.crafting;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-
-import appeng.api.stacks.AEItemKey;
-
-/**
- * Allows mod to decode their {@link IPatternDetails} from their item stacks. This is required for custom patterns,
- * otherwise the crafting CPU can't properly persist them. Register a single instance to {@link PatternDetailsHelper}.
- */
-public interface IPatternDetailsDecoder {
- boolean isEncodedPattern(ItemStack stack);
-
- @Nullable
- IPatternDetails decodePattern(AEItemKey what, Level level);
-
- /**
- * Decodes a pattern stored in a stack. Can attempt to recover a pattern hat has broken by recipe IDs being changed
- * by other mods. Recovery will modify the given item stack.
- */
- @Nullable
- IPatternDetails decodePattern(ItemStack what, Level level, boolean tryRecovery);
-}
diff --git a/src/main/java/appeng/api/crafting/PatternDetailsHelper.java b/src/main/java/appeng/api/crafting/PatternDetailsHelper.java
deleted file mode 100644
index 62f61a282e7..00000000000
--- a/src/main/java/appeng/api/crafting/PatternDetailsHelper.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.crafting;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.annotation.Nullable;
-
-import com.google.common.base.Preconditions;
-
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.crafting.CraftingRecipe;
-import net.minecraft.world.item.crafting.StonecutterRecipe;
-import net.minecraft.world.item.crafting.UpgradeRecipe;
-import net.minecraft.world.level.Level;
-
-import appeng.api.stacks.AEItemKey;
-import appeng.api.stacks.GenericStack;
-import appeng.core.definitions.AEItems;
-import appeng.crafting.pattern.AEPatternDecoder;
-
-public final class PatternDetailsHelper {
- private static final List DECODERS = new CopyOnWriteArrayList<>();
-
- static {
- // Register support for our own stacks.
- registerDecoder(AEPatternDecoder.INSTANCE);
- }
-
- public static void registerDecoder(IPatternDetailsDecoder decoder) {
- Objects.requireNonNull(decoder);
- DECODERS.add(decoder);
- }
-
- public static boolean isEncodedPattern(ItemStack stack) {
- for (var decoder : DECODERS) {
- if (decoder.isEncodedPattern(stack)) {
- return true;
- }
- }
- return false;
- }
-
- @Nullable
- public static IPatternDetails decodePattern(ItemStack stack, Level level) {
- return decodePattern(stack, level, false);
- }
-
- @Nullable
- public static IPatternDetails decodePattern(AEItemKey what, Level level) {
- for (var decoder : DECODERS) {
- var decoded = decoder.decodePattern(what, level);
- if (decoded != null) {
- return decoded;
- }
- }
- return null;
- }
-
- @Nullable
- public static IPatternDetails decodePattern(ItemStack stack, Level level, boolean autoRecovery) {
- for (var decoder : DECODERS) {
- var decoded = decoder.decodePattern(stack, level, autoRecovery);
- if (decoded != null) {
- return decoded;
- }
- }
- return null;
- }
-
- /**
- * Encodes a processing pattern which represents the ability to convert the given inputs into the given outputs
- * using some process external to the ME system.
- *
- * @param out The first element is considered the primary output and must be present
- * @return A new encoded pattern.
- * @throws IllegalArgumentException If either in or out contain only empty ItemStacks, or no primary output
- */
- public static ItemStack encodeProcessingPattern(GenericStack[] in, GenericStack[] out) {
- return AEItems.PROCESSING_PATTERN.asItem().encode(in, out);
- }
-
- /**
- * Encodes a crafting pattern which represents a Vanilla crafting recipe.
- *
- * @param recipe The Vanilla crafting recipe to be encoded.
- * @param in The items in the crafting grid, which are used to determine what items are supplied
- * from the ME system to craft using this pattern.
- * @param out What is to be expected as the result of this crafting operation by the ME system.
- * @param allowSubstitutes Controls whether the ME system will allow the use of equivalent items to craft this
- * recipe.
- * @param allowFluidSubstitutes Controls whether the ME system will allow the use of equivalent fluids.
- * @throws IllegalArgumentException If either in or out contain only empty ItemStacks.
- */
- public static ItemStack encodeCraftingPattern(CraftingRecipe recipe, ItemStack[] in,
- ItemStack out, boolean allowSubstitutes, boolean allowFluidSubstitutes) {
- return AEItems.CRAFTING_PATTERN.asItem().encode(recipe, in, out, allowSubstitutes, allowFluidSubstitutes);
- }
-
- /**
- * Encodes a stonecutting pattern which represents a Vanilla Stonecutter recipe.
- *
- * @param recipe The Vanilla stonecutter recipe to be encoded.
- * @param in The input item for the stonecutter, which is used to determine which item is supplied
- * from the ME system to craft using this pattern.
- * @param out The selected output item from the stonecutter recipe. Used to restore the recipe if it is
- * renamed later.
- * @param allowSubstitutes Controls whether the ME system will allow the use of equivalent items to craft this
- * recipe.
- */
- public static ItemStack encodeStonecuttingPattern(StonecutterRecipe recipe, AEItemKey in, AEItemKey out,
- boolean allowSubstitutes) {
- Preconditions.checkNotNull(recipe, "recipe");
- Preconditions.checkNotNull(in, "in");
- Preconditions.checkNotNull(out, "out");
- return AEItems.STONECUTTING_PATTERN.asItem().encode(recipe, in, out, allowSubstitutes);
- }
-
- /**
- * Encodes a smithing table pattern which represents a Vanilla Smithing Table recipe.
- *
- * @param recipe The Vanilla smithing table recipe to be encoded.
- * @param base The base item for the smithing table, which is used to determine which item is supplied
- * from the ME system to craft using this pattern.
- * @param addition The additional item for the smithing table, which is used to determine which item is
- * supplied from the ME system to craft using this pattern.
- * @param out The selected output item from the smithing table recipe. Used to restore the recipe if it
- * is renamed later.
- * @param allowSubstitutes Controls whether the ME system will allow the use of equivalent items to craft this
- * recipe.
- */
- public static ItemStack encodeSmithingTablePattern(UpgradeRecipe recipe, AEItemKey base, AEItemKey addition,
- AEItemKey out,
- boolean allowSubstitutes) {
- Preconditions.checkNotNull(recipe, "recipe");
- Preconditions.checkNotNull(base, "base");
- Preconditions.checkNotNull(addition, "addition");
- Preconditions.checkNotNull(out, "out");
- return AEItems.SMITHING_TABLE_PATTERN.asItem().encode(recipe, base, addition, out, allowSubstitutes);
- }
-}
diff --git a/src/main/java/appeng/api/features/P2PTunnelAttunement.java b/src/main/java/appeng/api/features/P2PTunnelAttunement.java
deleted file mode 100644
index 07817c8af13..00000000000
--- a/src/main/java/appeng/api/features/P2PTunnelAttunement.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.features;
-
-import java.util.ArrayList;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.function.Function;
-
-import javax.annotation.concurrent.ThreadSafe;
-
-import net.fabricmc.fabric.api.lookup.v1.item.ItemApiLookup;
-import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext;
-import net.fabricmc.fabric.api.transfer.v1.item.base.SingleStackStorage;
-import net.minecraft.core.Registry;
-import net.minecraft.network.chat.Component;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.tags.TagKey;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.ItemLike;
-
-import appeng.core.definitions.AEParts;
-import appeng.items.parts.PartItem;
-import appeng.parts.p2p.P2PTunnelPart;
-
-/**
- * A Registry for how p2p Tunnels are attuned
- */
-@ThreadSafe
-public final class P2PTunnelAttunement {
- private static final int INITIAL_CAPACITY = 40;
-
- static final Map, Item> tagTunnels = new IdentityHashMap<>(INITIAL_CAPACITY);
- static final List> apiAttunements = new ArrayList<>(INITIAL_CAPACITY);
-
- /**
- * The default tunnel part for ME tunnels. Use this to register additional attunement options.
- */
- public static final ItemLike ME_TUNNEL = AEParts.ME_P2P_TUNNEL;
-
- /**
- * The default tunnel part for energy (i.e. Forge Energy) tunnels. Use this to register additional attunement
- * options.
- */
- public static final ItemLike ENERGY_TUNNEL = AEParts.FE_P2P_TUNNEL;
-
- /**
- * The default tunnel part for redstone tunnels. Use this to register additional attunement options.
- */
- public static final ItemLike REDSTONE_TUNNEL = AEParts.REDSTONE_P2P_TUNNEL;
-
- /**
- * The default tunnel part for fluid tunnels. Use this to register additional attunement options.
- */
- public static final ItemLike FLUID_TUNNEL = AEParts.FLUID_P2P_TUNNEL;
-
- /**
- * The default tunnel part for item tunnels. Use this to register additional attunement options.
- */
- public static final ItemLike ITEM_TUNNEL = AEParts.ITEM_P2P_TUNNEL;
-
- /**
- * The default tunnel part for light tunnels. Use this to register additional attunement options.
- */
- public static final ItemLike LIGHT_TUNNEL = AEParts.LIGHT_P2P_TUNNEL;
-
- private P2PTunnelAttunement() {
- }
-
- public static TagKey- getAttunementTag(ItemLike tunnel) {
- Objects.requireNonNull(tunnel.asItem(), "tunnel.asItem()");
- var itemKey = Registry.ITEM.getKey(tunnel.asItem());
- if (itemKey.equals(Registry.ITEM.getDefaultKey())) {
- throw new IllegalArgumentException("Tunnel item must be registered first.");
- }
- return TagKey.create(Registry.ITEM_REGISTRY,
- new ResourceLocation(itemKey.getNamespace(), "p2p_attunements/" + itemKey.getPath()));
- }
-
- /**
- * Attunement based on the standard item tag: {@code :p2p_attunements/}
- */
- public synchronized static void registerAttunementTag(ItemLike tunnel) {
- Objects.requireNonNull(tunnel.asItem(), "tunnel.asItem()");
- tagTunnels.put(getAttunementTag(tunnel), validateTunnelPartItem(tunnel));
- }
-
- /**
- * Attunement based on the ability of getting an API via Fabric API Lookup from the item.
- *
- * @param tunnelPart The P2P-tunnel part item.
- * @param description Description for display in REI/JEI.
- */
- public synchronized static void registerAttunementApi(ItemLike tunnelPart, ItemApiLookup, T> api,
- Function contextProvider, Component description) {
- Objects.requireNonNull(api, "api");
- Objects.requireNonNull(contextProvider, "contextProvider");
- apiAttunements.add(new ApiAttunement<>(api, contextProvider, validateTunnelPartItem(tunnelPart), description));
- }
-
- /**
- * Attunement based on the ability of getting a storage container API via Fabric API Lookup from the item.
- *
- * @param tunnelPart The P2P-tunnel part item.
- * @param description Description for display in REI/JEI.
- */
- public synchronized static void registerAttunementApi(ItemLike tunnelPart,
- ItemApiLookup, ContainerItemContext> api, Component description) {
- registerAttunementApi(tunnelPart, api, stack -> ContainerItemContext.ofSingleSlot(new SingleStackStorage() {
- ItemStack buffer = stack;
-
- @Override
- protected ItemStack getStack() {
- return buffer;
- }
-
- @Override
- protected void setStack(ItemStack stack) {
- buffer = stack;
- }
- }), description);
- }
-
- /**
- * @param trigger attunement trigger
- * @return The part item for a P2P-Tunnel that should handle the given attunement, or an empty item stack.
- */
- public synchronized static ItemStack getTunnelPartByTriggerItem(ItemStack trigger) {
- if (trigger.isEmpty()) {
- return ItemStack.EMPTY;
- }
-
- // Tags first
- for (var tag : trigger.getTags().toList()) {
- var tagTunnelItem = tagTunnels.get(tag);
- if (tagTunnelItem != null) {
- return new ItemStack(tagTunnelItem);
- }
- }
-
- // Check provided APIs
- for (var apiAttunement : apiAttunements) {
- if (apiAttunement.hasApi(trigger)) {
- return new ItemStack(apiAttunement.tunnelType());
- }
- }
-
- return ItemStack.EMPTY;
- }
-
- private static Item validateTunnelPartItem(ItemLike itemLike) {
- Objects.requireNonNull(itemLike, "item");
- var item = itemLike.asItem();
- Objects.requireNonNull(item, "item");
- if (!(item instanceof PartItem>partItem)) {
- throw new IllegalArgumentException("Given tunnel part item is not a part");
- }
-
- if (!P2PTunnelPart.class.isAssignableFrom((partItem.getPartClass()))) {
- throw new IllegalArgumentException("Given tunnel part item results in a part that is not a P2P tunnel: "
- + partItem);
- }
-
- return item;
- }
-
- record ApiAttunement (
- ItemApiLookup, T> api,
- Function contextProvider,
- Item tunnelType,
- Component component) {
- public boolean hasApi(ItemStack stack) {
- return api.find(stack, contextProvider.apply(stack)) != null;
- }
- }
-}
diff --git a/src/main/java/appeng/api/features/P2PTunnelAttunementInternal.java b/src/main/java/appeng/api/features/P2PTunnelAttunementInternal.java
deleted file mode 100644
index 86b3d73fac3..00000000000
--- a/src/main/java/appeng/api/features/P2PTunnelAttunementInternal.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.api.features;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Predicate;
-
-import net.fabricmc.fabric.api.lookup.v1.item.ItemApiLookup;
-import net.minecraft.network.chat.Component;
-import net.minecraft.tags.TagKey;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.ItemLike;
-
-/**
- * Internal methods that complement {@link P2PTunnelAttunement} and which are not part of the public API.
- */
-public final class P2PTunnelAttunementInternal {
-
- private P2PTunnelAttunementInternal() {
- }
-
- /**
- * Gets a report which sources of attunement exist for a given tunnel type.
- */
- public static AttunementInfo getAttunementInfo(ItemLike tunnelType) {
- var tunnelItem = tunnelType.asItem();
-
- Set> apis = new HashSet<>();
-
- for (var entry : P2PTunnelAttunement.apiAttunements) {
- if (entry.tunnelType() == tunnelItem) {
- apis.add(entry.api());
- }
- }
-
- return new AttunementInfo(apis);
- }
-
- public static List getApiTunnels() {
- return P2PTunnelAttunement.apiAttunements.stream()
- .map(info -> new Resultant(info.component(), info.tunnelType(), info::hasApi)).toList();
- }
-
- public static Map, Item> getTagTunnels() {
- return P2PTunnelAttunement.tagTunnels;
- }
-
- public record AttunementInfo(Set> apis) {
- }
-
- public record Resultant(Component description, Item tunnelType, Predicate stackPredicate) {
- }
-}
diff --git a/src/main/java/appeng/api/features/PlayerRegistryInternal.java b/src/main/java/appeng/api/features/PlayerRegistryInternal.java
index 864cd59b95e..f082c868999 100644
--- a/src/main/java/appeng/api/features/PlayerRegistryInternal.java
+++ b/src/main/java/appeng/api/features/PlayerRegistryInternal.java
@@ -30,10 +30,10 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.level.saveddata.SavedData;
import appeng.core.AELog;
import appeng.core.AppEng;
-import appeng.core.worlddata.AESavedData;
/**
* Handles the matching between UUIDs and internal IDs for security systems. This whole system could be replaced by
@@ -43,7 +43,7 @@
* @version rv3 - 30.05.2015
* @since rv3 30.05.2015
*/
-final class PlayerRegistryInternal extends AESavedData implements IPlayerRegistry {
+final class PlayerRegistryInternal extends SavedData implements IPlayerRegistry {
private static final String NAME = AppEng.MOD_ID + "_players";
private static final String TAG_PLAYER_IDS = "playerIds";
diff --git a/src/main/java/appeng/api/ids/AEBlockIds.java b/src/main/java/appeng/api/ids/AEBlockIds.java
index 1d6262a7aa9..7fcfe9001bb 100644
--- a/src/main/java/appeng/api/ids/AEBlockIds.java
+++ b/src/main/java/appeng/api/ids/AEBlockIds.java
@@ -31,141 +31,11 @@
*/
@SuppressWarnings("unused")
public final class AEBlockIds {
-
- ///
- /// WORLDGEN/MISC
- ///
- // Budding certus quartz
- public static final ResourceLocation FLAWLESS_BUDDING_QUARTZ = id("flawless_budding_quartz");
- public static final ResourceLocation FLAWED_BUDDING_QUARTZ = id("flawed_budding_quartz");
- public static final ResourceLocation CHIPPED_BUDDING_QUARTZ = id("chipped_budding_quartz");
- public static final ResourceLocation DAMAGED_BUDDING_QUARTZ = id("damaged_budding_quartz");
- // Certus quartz clusters
- public static final ResourceLocation SMALL_QUARTZ_BUD = id("small_quartz_bud");
- public static final ResourceLocation MEDIUM_QUARTZ_BUD = id("medium_quartz_bud");
- public static final ResourceLocation LARGE_QUARTZ_BUD = id("large_quartz_bud");
- public static final ResourceLocation QUARTZ_CLUSTER = id("quartz_cluster");
-
- public static final ResourceLocation MYSTERIOUS_CUBE = id("mysterious_cube");
- public static final ResourceLocation NOT_SO_MYSTERIOUS_CUBE = id("not_so_mysterious_cube");
- public static final ResourceLocation QUARTZ_FIXTURE = id("quartz_fixture");
- public static final ResourceLocation SKY_STONE_CHEST = id("sky_stone_chest");
- public static final ResourceLocation SMOOTH_SKY_STONE_CHEST = id("smooth_sky_stone_chest");
- public static final ResourceLocation SKY_STONE_TANK = id("sky_stone_tank");
- public static final ResourceLocation LIGHT_DETECTOR = id("light_detector");
- public static final ResourceLocation PAINT = id("paint");
-
- ///
- /// ME NETWORK
- ///
- public static final ResourceLocation INSCRIBER = id("inscriber");
public static final ResourceLocation WIRELESS_ACCESS_POINT = id("wireless_access_point");
- public static final ResourceLocation CHARGER = id("charger");
public static final ResourceLocation SECURITY_STATION = id("security_station");
- public static final ResourceLocation QUANTUM_RING = id("quantum_ring");
- public static final ResourceLocation QUANTUM_LINK = id("quantum_link");
public static final ResourceLocation CONTROLLER = id("controller");
- public static final ResourceLocation DRIVE = id("drive");
- public static final ResourceLocation CHEST = id("chest");
- public static final ResourceLocation INTERFACE = id("interface");
- public static final ResourceLocation CELL_WORKBENCH = id("cell_workbench");
- public static final ResourceLocation IO_PORT = id("io_port");
- public static final ResourceLocation CONDENSER = id("condenser");
- public static final ResourceLocation ENERGY_ACCEPTOR = id("energy_acceptor");
- public static final ResourceLocation VIBRATION_CHAMBER = id("vibration_chamber");
- public static final ResourceLocation QUARTZ_GROWTH_ACCELERATOR = id("quartz_growth_accelerator");
- public static final ResourceLocation ENERGY_CELL = id("energy_cell");
- public static final ResourceLocation DENSE_ENERGY_CELL = id("dense_energy_cell");
public static final ResourceLocation CABLE_BUS = id("cable_bus");
- ///
- /// SPATIAL
- ///
- public static final ResourceLocation MATRIX_FRAME = id("matrix_frame");
- public static final ResourceLocation TINY_TNT = id("tiny_tnt");
- public static final ResourceLocation SPATIAL_PYLON = id("spatial_pylon");
- public static final ResourceLocation SPATIAL_IO_PORT = id("spatial_io_port");
- public static final ResourceLocation SPATIAL_ANCHOR = id("spatial_anchor");
-
- ///
- /// AUTO CRAFTING
- ///
- public static final ResourceLocation CREATIVE_ENERGY_CELL = id("creative_energy_cell");
- public static final ResourceLocation CRAFTING_UNIT = id("crafting_unit");
- public static final ResourceLocation CRAFTING_ACCELERATOR = id("crafting_accelerator");
- public static final ResourceLocation CRAFTING_STORAGE_1K = id("1k_crafting_storage");
- public static final ResourceLocation CRAFTING_STORAGE_4K = id("4k_crafting_storage");
- public static final ResourceLocation CRAFTING_STORAGE_16K = id("16k_crafting_storage");
- public static final ResourceLocation CRAFTING_STORAGE_64K = id("64k_crafting_storage");
- public static final ResourceLocation CRAFTING_STORAGE_256K = id("256k_crafting_storage");
- public static final ResourceLocation CRAFTING_MONITOR = id("crafting_monitor");
- public static final ResourceLocation PATTERN_PROVIDER = id("pattern_provider");
- public static final ResourceLocation MOLECULAR_ASSEMBLER = id("molecular_assembler");
-
- ///
- /// DECORATIVE BLOCKS
- ///
- public static final ResourceLocation QUARTZ_BLOCK = id("quartz_block");
- public static final ResourceLocation CUT_QUARTZ_BLOCK = id("cut_quartz_block");
- public static final ResourceLocation SMOOTH_QUARTZ_BLOCK = id("smooth_quartz_block");
- public static final ResourceLocation QUARTZ_BRICKS = id("quartz_bricks");
- public static final ResourceLocation QUARTZ_PILLAR = id("quartz_pillar");
- public static final ResourceLocation CHISELED_QUARTZ_BLOCK = id("chiseled_quartz_block");
- public static final ResourceLocation FLUIX_BLOCK = id("fluix_block");
- public static final ResourceLocation SKY_STONE_BLOCK = id("sky_stone_block");
- public static final ResourceLocation SMOOTH_SKY_STONE_BLOCK = id("smooth_sky_stone_block");
- public static final ResourceLocation SKY_STONE_BRICK = id("sky_stone_brick");
- public static final ResourceLocation SKY_STONE_SMALL_BRICK = id("sky_stone_small_brick");
- public static final ResourceLocation QUARTZ_GLASS = id("quartz_glass");
- public static final ResourceLocation QUARTZ_VIBRANT_GLASS = id("quartz_vibrant_glass");
-
- ///
- /// STAIRS
- ///
- public static final ResourceLocation SKY_STONE_STAIRS = id("sky_stone_stairs");
- public static final ResourceLocation SMOOTH_SKY_STONE_STAIRS = id("smooth_sky_stone_stairs");
- public static final ResourceLocation SKY_STONE_BRICK_STAIRS = id("sky_stone_brick_stairs");
- public static final ResourceLocation SKY_STONE_SMALL_BRICK_STAIRS = id("sky_stone_small_brick_stairs");
- public static final ResourceLocation FLUIX_STAIRS = id("fluix_stairs");
- public static final ResourceLocation QUARTZ_STAIRS = id("quartz_stairs");
- public static final ResourceLocation CUT_QUARTZ_STAIRS = id("cut_quartz_stairs");
- public static final ResourceLocation SMOOTH_QUARTZ_STAIRS = id("smooth_quartz_stairs");
- public static final ResourceLocation QUARTZ_BRICK_STAIRS = id("quartz_brick_stairs");
- public static final ResourceLocation CHISELED_QUARTZ_STAIRS = id("chiseled_quartz_stairs");
- public static final ResourceLocation QUARTZ_PILLAR_STAIRS = id("quartz_pillar_stairs");
-
- ///
- /// WALLS
- ///
- public static final ResourceLocation SKY_STONE_WALL = id("sky_stone_wall");
- public static final ResourceLocation SMOOTH_SKY_STONE_WALL = id("smooth_sky_stone_wall");
- public static final ResourceLocation SKY_STONE_BRICK_WALL = id("sky_stone_brick_wall");
- public static final ResourceLocation SKY_STONE_SMALL_BRICK_WALL = id("sky_stone_small_brick_wall");
- public static final ResourceLocation FLUIX_WALL = id("fluix_wall");
- public static final ResourceLocation QUARTZ_WALL = id("quartz_wall");
- public static final ResourceLocation CUT_QUARTZ_WALL = id("cut_quartz_wall");
- public static final ResourceLocation SMOOTH_QUARTZ_WALL = id("smooth_quartz_wall");
- public static final ResourceLocation QUARTZ_BRICK_WALL = id("quartz_brick_wall");
- public static final ResourceLocation CHISELED_QUARTZ_WALL = id("chiseled_quartz_wall");
- public static final ResourceLocation QUARTZ_PILLAR_WALL = id("quartz_pillar_wall");
-
- ///
- /// SLABS
- ///
- public static final ResourceLocation SKY_STONE_SLAB = id("sky_stone_slab");
- public static final ResourceLocation SMOOTH_SKY_STONE_SLAB = id("smooth_sky_stone_slab");
- public static final ResourceLocation SKY_STONE_BRICK_SLAB = id("sky_stone_brick_slab");
- public static final ResourceLocation SKY_STONE_SMALL_BRICK_SLAB = id("sky_stone_small_brick_slab");
- public static final ResourceLocation FLUIX_SLAB = id("fluix_slab");
- public static final ResourceLocation QUARTZ_SLAB = id("quartz_slab");
- public static final ResourceLocation CUT_QUARTZ_SLAB = id("cut_quartz_slab");
- public static final ResourceLocation SMOOTH_QUARTZ_SLAB = id("smooth_quartz_slab");
- public static final ResourceLocation QUARTZ_BRICK_SLAB = id("quartz_brick_slab");
- public static final ResourceLocation CHISELED_QUARTZ_SLAB = id("chiseled_quartz_slab");
- public static final ResourceLocation QUARTZ_PILLAR_SLAB = id("quartz_pillar_slab");
-
- public static final ResourceLocation CRANK = id("crank");
-
private static ResourceLocation id(String id) {
return new ResourceLocation(AEConstants.MOD_ID, id);
}
diff --git a/src/main/java/appeng/api/ids/AEItemIds.java b/src/main/java/appeng/api/ids/AEItemIds.java
index e527c8e0a5d..7fe4d81c029 100644
--- a/src/main/java/appeng/api/ids/AEItemIds.java
+++ b/src/main/java/appeng/api/ids/AEItemIds.java
@@ -36,252 +36,15 @@
*/
@SuppressWarnings("unused")
public final class AEItemIds {
- public static final ResourceLocation NETWORK_TOOL = id("network_tool");
- public static final ResourceLocation VIEW_CELL = id("view_cell");
- public static final ResourceLocation MEMORY_CARD = id("memory_card");
-
- public static final ResourceLocation MEMORY_CARD_WHITE = id("memory_card_white");
- public static final ResourceLocation MEMORY_CARD_ORANGE = id("memory_card_orange");
- public static final ResourceLocation MEMORY_CARD_MAGENTA = id("memory_card_magenta");
- public static final ResourceLocation MEMORY_CARD_LIGHT_BLUE = id("memory_card_light_blue");
- public static final ResourceLocation MEMORY_CARD_YELLOW = id("memory_card_yellow");
- public static final ResourceLocation MEMORY_CARD_LIME = id("memory_card_lime");
- public static final ResourceLocation MEMORY_CARD_PINK = id("memory_card_pink");
- public static final ResourceLocation MEMORY_CARD_GRAY = id("memory_card_gray");
- public static final ResourceLocation MEMORY_CARD_LIGHT_GRAY = id("memory_card_light_gray");
- public static final ResourceLocation MEMORY_CARD_CYAN = id("memory_card_cyan");
- public static final ResourceLocation MEMORY_CARD_PURPLE = id("memory_card_purple");
- public static final ResourceLocation MEMORY_CARD_BLUE = id("memory_card_blue");
- public static final ResourceLocation MEMORY_CARD_BROWN = id("memory_card_brown");
- public static final ResourceLocation MEMORY_CARD_GREEN = id("memory_card_green");
- public static final ResourceLocation MEMORY_CARD_RED = id("memory_card_red");
- public static final ResourceLocation MEMORY_CARD_BLACK = id("memory_card_black");
-
- public static final Map MEMORY_CARDS = ImmutableMap
- .builder().put(AEColor.WHITE, MEMORY_CARD_WHITE)
- .put(AEColor.ORANGE, MEMORY_CARD_ORANGE)
- .put(AEColor.MAGENTA, MEMORY_CARD_MAGENTA)
- .put(AEColor.LIGHT_BLUE, MEMORY_CARD_LIGHT_BLUE)
- .put(AEColor.YELLOW, MEMORY_CARD_YELLOW)
- .put(AEColor.LIME, MEMORY_CARD_LIME)
- .put(AEColor.PINK, MEMORY_CARD_PINK)
- .put(AEColor.GRAY, MEMORY_CARD_GRAY)
- .put(AEColor.LIGHT_GRAY, MEMORY_CARD_LIGHT_GRAY)
- .put(AEColor.CYAN, MEMORY_CARD_CYAN)
- .put(AEColor.PURPLE, MEMORY_CARD_PURPLE)
- .put(AEColor.BLUE, MEMORY_CARD_BLUE)
- .put(AEColor.BROWN, MEMORY_CARD_BROWN)
- .put(AEColor.GREEN, MEMORY_CARD_GREEN)
- .put(AEColor.RED, MEMORY_CARD_RED)
- .put(AEColor.BLACK, MEMORY_CARD_BLACK)
- .put(AEColor.TRANSPARENT, MEMORY_CARD)
- .build();
-
- public static final ResourceLocation BLANK_PATTERN = id("blank_pattern");
- public static final ResourceLocation CRAFTING_PATTERN = id("crafting_pattern");
- public static final ResourceLocation PROCESSING_PATTERN = id("processing_pattern");
- public static final ResourceLocation SMITHING_TABLE_PATTERN = id("smithing_table_pattern");
- public static final ResourceLocation STONECUTTING_PATTERN = id("stonecutting_pattern");
public static final ResourceLocation BIOMETRIC_CARD = id("biometric_card");
- public static final ResourceLocation ENTROPY_MANIPULATOR = id("entropy_manipulator");
- public static final ResourceLocation MATTER_CANNON = id("matter_cannon");
- public static final ResourceLocation CHARGED_STAFF = id("charged_staff");
- public static final ResourceLocation COLOR_APPLICATOR = id("color_applicator");
public static final ResourceLocation WIRELESS_TERMINAL = id("wireless_terminal");
public static final ResourceLocation WIRELESS_CRAFTING_TERMINAL = id("wireless_crafting_terminal");
public static final ResourceLocation WRAPPED_GENERIC_STACK = id("wrapped_generic_stack");
- public static final ResourceLocation FACADE = id("facade");
-
- ///
- /// STORAGE CELLS
- ///
- public static final ResourceLocation STORAGE_CELL_1K = id("storage_cell_1k");
- public static final ResourceLocation STORAGE_CELL_4K = id("storage_cell_4k");
- public static final ResourceLocation STORAGE_CELL_16K = id("storage_cell_16k");
- public static final ResourceLocation STORAGE_CELL_64K = id("storage_cell_64k");
- public static final ResourceLocation STORAGE_CELL_256K = id("storage_cell_256k");
- public static final ResourceLocation ITEM_CELL_1K = id("item_storage_cell_1k");
- public static final ResourceLocation ITEM_CELL_4K = id("item_storage_cell_4k");
- public static final ResourceLocation ITEM_CELL_16K = id("item_storage_cell_16k");
- public static final ResourceLocation ITEM_CELL_64K = id("item_storage_cell_64k");
- public static final ResourceLocation ITEM_CELL_256K = id("item_storage_cell_256k");
- public static final ResourceLocation FLUID_CELL_1K = id("fluid_storage_cell_1k");
- public static final ResourceLocation FLUID_CELL_4K = id("fluid_storage_cell_4k");
- public static final ResourceLocation FLUID_CELL_16K = id("fluid_storage_cell_16k");
- public static final ResourceLocation FLUID_CELL_64K = id("fluid_storage_cell_64k");
- public static final ResourceLocation FLUID_CELL_256K = id("fluid_storage_cell_256k");
- public static final ResourceLocation SPATIAL_CELL_2 = id("spatial_storage_cell_2");
- public static final ResourceLocation SPATIAL_CELL_16 = id("spatial_storage_cell_16");
- public static final ResourceLocation SPATIAL_CELL_128 = id("spatial_storage_cell_128");
- public static final ResourceLocation ITEM_CELL_CREATIVE = id("creative_item_cell");
- public static final ResourceLocation FLUID_CELL_CREATIVE = id("creative_fluid_cell");
- public static final ResourceLocation PORTABLE_ITEM_CELL1K = id("portable_item_cell_1k");
- public static final ResourceLocation PORTABLE_ITEM_CELL4K = id("portable_item_cell_4k");
- public static final ResourceLocation PORTABLE_ITEM_CELL16K = id("portable_item_cell_16k");
- public static final ResourceLocation PORTABLE_ITEM_CELL64K = id("portable_item_cell_64k");
- public static final ResourceLocation PORTABLE_ITEM_CELL256K = id("portable_item_cell_256k");
- public static final ResourceLocation PORTABLE_FLUID_CELL1K = id("portable_fluid_cell_1k");
- public static final ResourceLocation PORTABLE_FLUID_CELL4K = id("portable_fluid_cell_4k");
- public static final ResourceLocation PORTABLE_FLUID_CELL16K = id("portable_fluid_cell_16k");
- public static final ResourceLocation PORTABLE_FLUID_CELL64K = id("portable_fluid_cell_64k");
- public static final ResourceLocation PORTABLE_FLUID_CELL256K = id("portable_fluid_cell_256k");
-
- ///
- /// PAINT BALLS
- ///
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_WHITE = id("white_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_ORANGE = id("orange_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_MAGENTA = id("magenta_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_LIGHT_BLUE = id("light_blue_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_YELLOW = id("yellow_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_LIME = id("lime_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_PINK = id("pink_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_GRAY = id("gray_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_LIGHT_GRAY = id("light_gray_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_CYAN = id("cyan_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_PURPLE = id("purple_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_BLUE = id("blue_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_BROWN = id("brown_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_GREEN = id("green_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_RED = id("red_lumen_paint_ball");
- public static final ResourceLocation COLORED_LUMEN_PAINT_BALL_BLACK = id("black_lumen_paint_ball");
- public static final Map COLORED_LUMEN_PAINT_BALL = ImmutableMap
- .builder().put(AEColor.WHITE, COLORED_LUMEN_PAINT_BALL_WHITE)
- .put(AEColor.ORANGE, COLORED_LUMEN_PAINT_BALL_ORANGE)
- .put(AEColor.MAGENTA, COLORED_LUMEN_PAINT_BALL_MAGENTA)
- .put(AEColor.LIGHT_BLUE, COLORED_LUMEN_PAINT_BALL_LIGHT_BLUE)
- .put(AEColor.YELLOW, COLORED_LUMEN_PAINT_BALL_YELLOW)
- .put(AEColor.LIME, COLORED_LUMEN_PAINT_BALL_LIME)
- .put(AEColor.PINK, COLORED_LUMEN_PAINT_BALL_PINK)
- .put(AEColor.GRAY, COLORED_LUMEN_PAINT_BALL_GRAY)
- .put(AEColor.LIGHT_GRAY, COLORED_LUMEN_PAINT_BALL_LIGHT_GRAY)
- .put(AEColor.CYAN, COLORED_LUMEN_PAINT_BALL_CYAN)
- .put(AEColor.PURPLE, COLORED_LUMEN_PAINT_BALL_PURPLE)
- .put(AEColor.BLUE, COLORED_LUMEN_PAINT_BALL_BLUE)
- .put(AEColor.BROWN, COLORED_LUMEN_PAINT_BALL_BROWN)
- .put(AEColor.GREEN, COLORED_LUMEN_PAINT_BALL_GREEN)
- .put(AEColor.RED, COLORED_LUMEN_PAINT_BALL_RED)
- .put(AEColor.BLACK, COLORED_LUMEN_PAINT_BALL_BLACK)
- .build();
-
- public static final ResourceLocation COLORED_PAINT_BALL_WHITE = id("white_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_ORANGE = id("orange_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_MAGENTA = id("magenta_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_LIGHT_BLUE = id("light_blue_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_YELLOW = id("yellow_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_LIME = id("lime_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_PINK = id("pink_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_GRAY = id("gray_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_LIGHT_GRAY = id("light_gray_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_CYAN = id("cyan_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_PURPLE = id("purple_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_BLUE = id("blue_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_BROWN = id("brown_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_GREEN = id("green_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_RED = id("red_paint_ball");
- public static final ResourceLocation COLORED_PAINT_BALL_BLACK = id("black_paint_ball");
- public static final Map COLORED_PAINT_BALL = ImmutableMap
- .builder().put(AEColor.WHITE, COLORED_PAINT_BALL_WHITE)
- .put(AEColor.ORANGE, COLORED_PAINT_BALL_ORANGE)
- .put(AEColor.MAGENTA, COLORED_PAINT_BALL_MAGENTA)
- .put(AEColor.LIGHT_BLUE, COLORED_PAINT_BALL_LIGHT_BLUE)
- .put(AEColor.YELLOW, COLORED_PAINT_BALL_YELLOW)
- .put(AEColor.LIME, COLORED_PAINT_BALL_LIME)
- .put(AEColor.PINK, COLORED_PAINT_BALL_PINK)
- .put(AEColor.GRAY, COLORED_PAINT_BALL_GRAY)
- .put(AEColor.LIGHT_GRAY, COLORED_PAINT_BALL_LIGHT_GRAY)
- .put(AEColor.CYAN, COLORED_PAINT_BALL_CYAN)
- .put(AEColor.PURPLE, COLORED_PAINT_BALL_PURPLE)
- .put(AEColor.BLUE, COLORED_PAINT_BALL_BLUE)
- .put(AEColor.BROWN, COLORED_PAINT_BALL_BROWN)
- .put(AEColor.GREEN, COLORED_PAINT_BALL_GREEN)
- .put(AEColor.RED, COLORED_PAINT_BALL_RED)
- .put(AEColor.BLACK, COLORED_PAINT_BALL_BLACK)
- .build();
-
- ///
- /// TOOLS
- ///
- public static final ResourceLocation CERTUS_QUARTZ_AXE = id("certus_quartz_axe");
- public static final ResourceLocation CERTUS_QUARTZ_HOE = id("certus_quartz_hoe");
- public static final ResourceLocation CERTUS_QUARTZ_SHOVEL = id("certus_quartz_shovel");
- public static final ResourceLocation CERTUS_QUARTZ_PICK = id("certus_quartz_pickaxe");
- public static final ResourceLocation CERTUS_QUARTZ_SWORD = id("certus_quartz_sword");
- public static final ResourceLocation CERTUS_QUARTZ_WRENCH = id("certus_quartz_wrench");
- public static final ResourceLocation CERTUS_QUARTZ_KNIFE = id("certus_quartz_cutting_knife");
-
- public static final ResourceLocation NETHER_QUARTZ_AXE = id("nether_quartz_axe");
- public static final ResourceLocation NETHER_QUARTZ_HOE = id("nether_quartz_hoe");
- public static final ResourceLocation NETHER_QUARTZ_SHOVEL = id("nether_quartz_shovel");
- public static final ResourceLocation NETHER_QUARTZ_PICK = id("nether_quartz_pickaxe");
- public static final ResourceLocation NETHER_QUARTZ_SWORD = id("nether_quartz_sword");
public static final ResourceLocation NETHER_QUARTZ_WRENCH = id("nether_quartz_wrench");
- public static final ResourceLocation NETHER_QUARTZ_KNIFE = id("nether_quartz_cutting_knife");
-
- public static final ResourceLocation FLUIX_AXE = id("fluix_axe");
- public static final ResourceLocation FLUIX_HOE = id("fluix_hoe");
- public static final ResourceLocation FLUIX_SHOVEL = id("fluix_shovel");
- public static final ResourceLocation FLUIX_PICK = id("fluix_pickaxe");
- public static final ResourceLocation FLUIX_SWORD = id("fluix_sword");
- public static final ResourceLocation METEORITE_COMPASS = id("meteorite_compass");
-
- ///
- /// The following items were previously part of ApiItems
- ///
- public static final ResourceLocation CERTUS_QUARTZ_CRYSTAL = id("certus_quartz_crystal");
- public static final ResourceLocation CERTUS_QUARTZ_CRYSTAL_CHARGED = id("charged_certus_quartz_crystal");
- public static final ResourceLocation CERTUS_QUARTZ_DUST = id("certus_quartz_dust");
- public static final ResourceLocation SILICON = id("silicon");
- public static final ResourceLocation MATTER_BALL = id("matter_ball");
- public static final ResourceLocation FLUIX_CRYSTAL = id("fluix_crystal");
- public static final ResourceLocation FLUIX_DUST = id("fluix_dust");
- public static final ResourceLocation FLUIX_PEARL = id("fluix_pearl");
- public static final ResourceLocation PURIFIED_CERTUS_QUARTZ_CRYSTAL = id("purified_certus_quartz_crystal");
- public static final ResourceLocation PURIFIED_NETHER_QUARTZ_CRYSTAL = id("purified_nether_quartz_crystal");
- public static final ResourceLocation PURIFIED_FLUIX_CRYSTAL = id("purified_fluix_crystal");
- public static final ResourceLocation CALCULATION_PROCESSOR_PRESS = id("calculation_processor_press");
- public static final ResourceLocation ENGINEERING_PROCESSOR_PRESS = id("engineering_processor_press");
- public static final ResourceLocation LOGIC_PROCESSOR_PRESS = id("logic_processor_press");
- public static final ResourceLocation CALCULATION_PROCESSOR_PRINT = id("printed_calculation_processor");
- public static final ResourceLocation ENGINEERING_PROCESSOR_PRINT = id("printed_engineering_processor");
- public static final ResourceLocation LOGIC_PROCESSOR_PRINT = id("printed_logic_processor");
- public static final ResourceLocation SILICON_PRESS = id("silicon_press");
- public static final ResourceLocation SILICON_PRINT = id("printed_silicon");
- public static final ResourceLocation NAME_PRESS = id("name_press");
- public static final ResourceLocation LOGIC_PROCESSOR = id("logic_processor");
- public static final ResourceLocation CALCULATION_PROCESSOR = id("calculation_processor");
- public static final ResourceLocation ENGINEERING_PROCESSOR = id("engineering_processor");
- public static final ResourceLocation BASIC_CARD = id("basic_card");
- public static final ResourceLocation REDSTONE_CARD = id("redstone_card");
+ public static final ResourceLocation INVERTER_CARD = id("inverter_card");
public static final ResourceLocation CAPACITY_CARD = id("capacity_card");
- public static final ResourceLocation VOID_CARD = id("void_card");
- public static final ResourceLocation ADVANCED_CARD = id("advanced_card");
public static final ResourceLocation FUZZY_CARD = id("fuzzy_card");
- public static final ResourceLocation SPEED_CARD = id("speed_card");
- public static final ResourceLocation INVERTER_CARD = id("inverter_card");
- public static final ResourceLocation CRAFTING_CARD = id("crafting_card");
- public static final ResourceLocation ENERGY_CARD = id("energy_card");
- public static final ResourceLocation EQUAL_DISTRIBUTION_CARD = id("equal_distribution_card");
- public static final ResourceLocation SPATIAL_2_CELL_COMPONENT = id("spatial_cell_component_2");
- public static final ResourceLocation SPATIAL_16_CELL_COMPONENT = id("spatial_cell_component_16");
- public static final ResourceLocation SPATIAL_128_CELL_COMPONENT = id("spatial_cell_component_128");
- public static final ResourceLocation CELL_COMPONENT_1K = id("cell_component_1k");
- public static final ResourceLocation CELL_COMPONENT_4K = id("cell_component_4k");
- public static final ResourceLocation CELL_COMPONENT_16K = id("cell_component_16k");
- public static final ResourceLocation CELL_COMPONENT_64K = id("cell_component_64k");
- public static final ResourceLocation CELL_COMPONENT_256K = id("cell_component_256k");
- public static final ResourceLocation ITEM_CELL_HOUSING = id("item_cell_housing");
- public static final ResourceLocation FLUID_CELL_HOUSING = id("fluid_cell_housing");
- public static final ResourceLocation WIRELESS_RECEIVER = id("wireless_receiver");
- public static final ResourceLocation WIRELESS_BOOSTER = id("wireless_booster");
- public static final ResourceLocation FORMATION_CORE = id("formation_core");
- public static final ResourceLocation ANNIHILATION_CORE = id("annihilation_core");
- public static final ResourceLocation SKY_DUST = id("sky_dust");
- public static final ResourceLocation GUIDE = id("guide");
- public static final ResourceLocation ENDER_DUST = id("ender_dust");
- public static final ResourceLocation SINGULARITY = id("singularity");
- public static final ResourceLocation QUANTUM_ENTANGLED_SINGULARITY = id("quantum_entangled_singularity");
private static ResourceLocation id(String id) {
return new ResourceLocation(AEConstants.MOD_ID, id);
diff --git a/src/main/java/appeng/api/ids/AEPartIds.java b/src/main/java/appeng/api/ids/AEPartIds.java
index a59ac6f5bd9..3b84d88052d 100644
--- a/src/main/java/appeng/api/ids/AEPartIds.java
+++ b/src/main/java/appeng/api/ids/AEPartIds.java
@@ -77,199 +77,9 @@ public final class AEPartIds {
.put(AEColor.BLACK, CABLE_GLASS_BLACK)
.put(AEColor.TRANSPARENT, CABLE_GLASS_TRANSPARENT)
.build();
-
- public static final ResourceLocation CABLE_COVERED_WHITE = id("white_covered_cable");
- public static final ResourceLocation CABLE_COVERED_ORANGE = id("orange_covered_cable");
- public static final ResourceLocation CABLE_COVERED_MAGENTA = id("magenta_covered_cable");
- public static final ResourceLocation CABLE_COVERED_LIGHT_BLUE = id("light_blue_covered_cable");
- public static final ResourceLocation CABLE_COVERED_YELLOW = id("yellow_covered_cable");
- public static final ResourceLocation CABLE_COVERED_LIME = id("lime_covered_cable");
- public static final ResourceLocation CABLE_COVERED_PINK = id("pink_covered_cable");
- public static final ResourceLocation CABLE_COVERED_GRAY = id("gray_covered_cable");
- public static final ResourceLocation CABLE_COVERED_LIGHT_GRAY = id("light_gray_covered_cable");
- public static final ResourceLocation CABLE_COVERED_CYAN = id("cyan_covered_cable");
- public static final ResourceLocation CABLE_COVERED_PURPLE = id("purple_covered_cable");
- public static final ResourceLocation CABLE_COVERED_BLUE = id("blue_covered_cable");
- public static final ResourceLocation CABLE_COVERED_BROWN = id("brown_covered_cable");
- public static final ResourceLocation CABLE_COVERED_GREEN = id("green_covered_cable");
- public static final ResourceLocation CABLE_COVERED_RED = id("red_covered_cable");
- public static final ResourceLocation CABLE_COVERED_BLACK = id("black_covered_cable");
- public static final ResourceLocation CABLE_COVERED_TRANSPARENT = id("fluix_covered_cable");
- public static final Map CABLE_COVERED = ImmutableMap.builder()
- .put(AEColor.WHITE, CABLE_COVERED_WHITE)
- .put(AEColor.ORANGE, CABLE_COVERED_ORANGE)
- .put(AEColor.MAGENTA, CABLE_COVERED_MAGENTA)
- .put(AEColor.LIGHT_BLUE, CABLE_COVERED_LIGHT_BLUE)
- .put(AEColor.YELLOW, CABLE_COVERED_YELLOW)
- .put(AEColor.LIME, CABLE_COVERED_LIME)
- .put(AEColor.PINK, CABLE_COVERED_PINK)
- .put(AEColor.GRAY, CABLE_COVERED_GRAY)
- .put(AEColor.LIGHT_GRAY, CABLE_COVERED_LIGHT_GRAY)
- .put(AEColor.CYAN, CABLE_COVERED_CYAN)
- .put(AEColor.PURPLE, CABLE_COVERED_PURPLE)
- .put(AEColor.BLUE, CABLE_COVERED_BLUE)
- .put(AEColor.BROWN, CABLE_COVERED_BROWN)
- .put(AEColor.GREEN, CABLE_COVERED_GREEN)
- .put(AEColor.RED, CABLE_COVERED_RED)
- .put(AEColor.BLACK, CABLE_COVERED_BLACK)
- .put(AEColor.TRANSPARENT, CABLE_COVERED_TRANSPARENT)
- .build();
-
- public static final ResourceLocation CABLE_SMART_WHITE = id("white_smart_cable");
- public static final ResourceLocation CABLE_SMART_ORANGE = id("orange_smart_cable");
- public static final ResourceLocation CABLE_SMART_MAGENTA = id("magenta_smart_cable");
- public static final ResourceLocation CABLE_SMART_LIGHT_BLUE = id("light_blue_smart_cable");
- public static final ResourceLocation CABLE_SMART_YELLOW = id("yellow_smart_cable");
- public static final ResourceLocation CABLE_SMART_LIME = id("lime_smart_cable");
- public static final ResourceLocation CABLE_SMART_PINK = id("pink_smart_cable");
- public static final ResourceLocation CABLE_SMART_GRAY = id("gray_smart_cable");
- public static final ResourceLocation CABLE_SMART_LIGHT_GRAY = id("light_gray_smart_cable");
- public static final ResourceLocation CABLE_SMART_CYAN = id("cyan_smart_cable");
- public static final ResourceLocation CABLE_SMART_PURPLE = id("purple_smart_cable");
- public static final ResourceLocation CABLE_SMART_BLUE = id("blue_smart_cable");
- public static final ResourceLocation CABLE_SMART_BROWN = id("brown_smart_cable");
- public static final ResourceLocation CABLE_SMART_GREEN = id("green_smart_cable");
- public static final ResourceLocation CABLE_SMART_RED = id("red_smart_cable");
- public static final ResourceLocation CABLE_SMART_BLACK = id("black_smart_cable");
- public static final ResourceLocation CABLE_SMART_TRANSPARENT = id("fluix_smart_cable");
- public static final Map CABLE_SMART = ImmutableMap.builder()
- .put(AEColor.WHITE, CABLE_SMART_WHITE)
- .put(AEColor.ORANGE, CABLE_SMART_ORANGE)
- .put(AEColor.MAGENTA, CABLE_SMART_MAGENTA)
- .put(AEColor.LIGHT_BLUE, CABLE_SMART_LIGHT_BLUE)
- .put(AEColor.YELLOW, CABLE_SMART_YELLOW)
- .put(AEColor.LIME, CABLE_SMART_LIME)
- .put(AEColor.PINK, CABLE_SMART_PINK)
- .put(AEColor.GRAY, CABLE_SMART_GRAY)
- .put(AEColor.LIGHT_GRAY, CABLE_SMART_LIGHT_GRAY)
- .put(AEColor.CYAN, CABLE_SMART_CYAN)
- .put(AEColor.PURPLE, CABLE_SMART_PURPLE)
- .put(AEColor.BLUE, CABLE_SMART_BLUE)
- .put(AEColor.BROWN, CABLE_SMART_BROWN)
- .put(AEColor.GREEN, CABLE_SMART_GREEN)
- .put(AEColor.RED, CABLE_SMART_RED)
- .put(AEColor.BLACK, CABLE_SMART_BLACK)
- .put(AEColor.TRANSPARENT, CABLE_SMART_TRANSPARENT)
- .build();
-
- public static final ResourceLocation CABLE_DENSE_COVERED_WHITE = id("white_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_ORANGE = id("orange_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_MAGENTA = id("magenta_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_LIGHT_BLUE = id("light_blue_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_YELLOW = id("yellow_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_LIME = id("lime_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_PINK = id("pink_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_GRAY = id("gray_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_LIGHT_GRAY = id("light_gray_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_CYAN = id("cyan_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_PURPLE = id("purple_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_BLUE = id("blue_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_BROWN = id("brown_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_GREEN = id("green_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_RED = id("red_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_BLACK = id("black_covered_dense_cable");
- public static final ResourceLocation CABLE_DENSE_COVERED_TRANSPARENT = id("fluix_covered_dense_cable");
- public static final Map CABLE_DENSE_COVERED = ImmutableMap
- .builder().put(AEColor.WHITE, CABLE_DENSE_COVERED_WHITE)
- .put(AEColor.ORANGE, CABLE_DENSE_COVERED_ORANGE)
- .put(AEColor.MAGENTA, CABLE_DENSE_COVERED_MAGENTA)
- .put(AEColor.LIGHT_BLUE, CABLE_DENSE_COVERED_LIGHT_BLUE)
- .put(AEColor.YELLOW, CABLE_DENSE_COVERED_YELLOW)
- .put(AEColor.LIME, CABLE_DENSE_COVERED_LIME)
- .put(AEColor.PINK, CABLE_DENSE_COVERED_PINK)
- .put(AEColor.GRAY, CABLE_DENSE_COVERED_GRAY)
- .put(AEColor.LIGHT_GRAY, CABLE_DENSE_COVERED_LIGHT_GRAY)
- .put(AEColor.CYAN, CABLE_DENSE_COVERED_CYAN)
- .put(AEColor.PURPLE, CABLE_DENSE_COVERED_PURPLE)
- .put(AEColor.BLUE, CABLE_DENSE_COVERED_BLUE)
- .put(AEColor.BROWN, CABLE_DENSE_COVERED_BROWN)
- .put(AEColor.GREEN, CABLE_DENSE_COVERED_GREEN)
- .put(AEColor.RED, CABLE_DENSE_COVERED_RED)
- .put(AEColor.BLACK, CABLE_DENSE_COVERED_BLACK)
- .put(AEColor.TRANSPARENT, CABLE_DENSE_COVERED_TRANSPARENT)
- .build();
-
- public static final ResourceLocation CABLE_DENSE_SMART_WHITE = id("white_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_ORANGE = id("orange_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_MAGENTA = id("magenta_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_LIGHT_BLUE = id("light_blue_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_YELLOW = id("yellow_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_LIME = id("lime_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_PINK = id("pink_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_GRAY = id("gray_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_LIGHT_GRAY = id("light_gray_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_CYAN = id("cyan_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_PURPLE = id("purple_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_BLUE = id("blue_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_BROWN = id("brown_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_GREEN = id("green_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_RED = id("red_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_BLACK = id("black_smart_dense_cable");
- public static final ResourceLocation CABLE_DENSE_SMART_TRANSPARENT = id("fluix_smart_dense_cable");
- public static final Map CABLE_DENSE_SMART = ImmutableMap
- .builder().put(AEColor.WHITE, CABLE_DENSE_SMART_WHITE)
- .put(AEColor.ORANGE, CABLE_DENSE_SMART_ORANGE)
- .put(AEColor.MAGENTA, CABLE_DENSE_SMART_MAGENTA)
- .put(AEColor.LIGHT_BLUE, CABLE_DENSE_SMART_LIGHT_BLUE)
- .put(AEColor.YELLOW, CABLE_DENSE_SMART_YELLOW)
- .put(AEColor.LIME, CABLE_DENSE_SMART_LIME)
- .put(AEColor.PINK, CABLE_DENSE_SMART_PINK)
- .put(AEColor.GRAY, CABLE_DENSE_SMART_GRAY)
- .put(AEColor.LIGHT_GRAY, CABLE_DENSE_SMART_LIGHT_GRAY)
- .put(AEColor.CYAN, CABLE_DENSE_SMART_CYAN)
- .put(AEColor.PURPLE, CABLE_DENSE_SMART_PURPLE)
- .put(AEColor.BLUE, CABLE_DENSE_SMART_BLUE)
- .put(AEColor.BROWN, CABLE_DENSE_SMART_BROWN)
- .put(AEColor.GREEN, CABLE_DENSE_SMART_GREEN)
- .put(AEColor.RED, CABLE_DENSE_SMART_RED)
- .put(AEColor.BLACK, CABLE_DENSE_SMART_BLACK)
- .put(AEColor.TRANSPARENT, CABLE_DENSE_SMART_TRANSPARENT)
- .build();
-
- ///
- /// Buses
- ///
- public static final ResourceLocation QUARTZ_FIBER = id("quartz_fiber");
- public static final ResourceLocation TOGGLE_BUS = id("toggle_bus");
- public static final ResourceLocation INVERTED_TOGGLE_BUS = id("inverted_toggle_bus");
- public static final ResourceLocation CABLE_ANCHOR = id("cable_anchor");
public static final ResourceLocation STORAGE_BUS = id("storage_bus");
- public static final ResourceLocation IMPORT_BUS = id("import_bus");
- public static final ResourceLocation EXPORT_BUS = id("export_bus");
- public static final ResourceLocation LEVEL_EMITTER = id("level_emitter");
- public static final ResourceLocation ENERGY_LEVEL_EMITTER = id("energy_level_emitter");
- public static final ResourceLocation PATTERN_PROVIDER = id("cable_pattern_provider");
- public static final ResourceLocation INTERFACE = id("cable_interface");
- public static final ResourceLocation CONVERSION_MONITOR = id("conversion_monitor");
- public static final ResourceLocation ENERGY_ACCEPTOR = id("cable_energy_acceptor");
-
- ///
- /// Monitors and terminals
- ///
- public static final ResourceLocation MONITOR = id("monitor");
- public static final ResourceLocation SEMI_DARK_MONITOR = id("semi_dark_monitor");
- public static final ResourceLocation DARK_MONITOR = id("dark_monitor");
public static final ResourceLocation TERMINAL = id("terminal");
public static final ResourceLocation CRAFTING_TERMINAL = id("crafting_terminal");
- public static final ResourceLocation PATTERN_ENCODING_TERMINAL = id("pattern_encoding_terminal");
- public static final ResourceLocation PATTERN_ACCESS_TERMINAL = id("pattern_access_terminal");
- public static final ResourceLocation STORAGE_MONITOR = id("storage_monitor");
-
- ///
- /// Planes
- ///
- public static final ResourceLocation FORMATION_PLANE = id("formation_plane");
- public static final ResourceLocation ANNIHILATION_PLANE = id("annihilation_plane");
-
- ///
- /// P2P
- ///
- public static final ResourceLocation ME_P2P_TUNNEL = id("me_p2p_tunnel");
- public static final ResourceLocation REDSTONE_P2P_TUNNEL = id("redstone_p2p_tunnel");
- public static final ResourceLocation ITEM_P2P_TUNNEL = id("item_p2p_tunnel");
- public static final ResourceLocation FLUID_P2P_TUNNEL = id("fluid_p2p_tunnel");
- public static final ResourceLocation FE_P2P_TUNNEL = id("fe_p2p_tunnel");
- public static final ResourceLocation LIGHT_P2P_TUNNEL = id("light_p2p_tunnel");
private static ResourceLocation id(String id) {
return new ResourceLocation(AEConstants.MOD_ID, id);
diff --git a/src/main/java/appeng/api/ids/AETags.java b/src/main/java/appeng/api/ids/AETags.java
deleted file mode 100644
index 7f381a5c6e1..00000000000
--- a/src/main/java/appeng/api/ids/AETags.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.ids;
-
-import net.minecraft.core.Registry;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.tags.TagKey;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.material.Fluid;
-
-/**
- * Tags that AE uses for functional purposes. For recipe tags that you may use in your recipe data generation, please
- * see the non-api class ConventionTags.
- */
-public final class AETags {
-
- private AETags() {
- }
-
- /**
- * Contains blocks that are blacklisted from being moved in and out of spatial storage.
- *
- * To blacklist block entities from being moved, you need to add the hosting block to this tag.
- */
- public static final TagKey SPATIAL_BLACKLIST = blockTag("ae2:blacklisted/spatial");
-
- /**
- * Contains blocks that are blacklisted from being picked up by an item annihilation plane.
- */
- public static final TagKey ANNIHILATION_PLANE_BLOCK_BLACKLIST = blockTag(
- "ae2:blacklisted/annihilation_plane");
-
- /**
- * Contains items that are blacklisted from being picked up by an item annihilation plane.
- */
- public static final TagKey
- ANNIHILATION_PLANE_ITEM_BLACKLIST = itemTag(
- "ae2:blacklisted/annihilation_plane");
-
- /**
- * Contains items that are blacklisted from being picked up by a fluid annihilation plane.
- */
- public static final TagKey ANNIHILATION_PLANE_FLUID_BLACKLIST = fluidTag(
- "ae2:blacklisted/annihilation_plane");
-
- /**
- * Used by the quartz knife to decide which ingots can be crafted into nameplates, as well as the crafting recipe
- * for cable anchors.
- */
- public static TagKey
- METAL_INGOTS = itemTag("ae2:metal_ingots");
-
- /**
- * Block tag used to explicitly whitelist blocks for use in facades, even if they don't meet the general criteria
- * for being used in facades.
- */
- public static final TagKey FACADE_BLOCK_WHITELIST = blockTag("ae2:whitelisted/facades");
-
- /**
- * Crystal growth accelerators will trigger additional random ticks for blocks in that tag, regardless of what the
- * blocks are. By default, includes {@code c:budding_blocks} / {@code forge:budding} which includes budding amethyst
- * and the various budding certus quartz blocks.
- */
- public static final TagKey GROWTH_ACCELERATABLE = blockTag("ae2:growth_acceleratable");
-
- private static TagKey
- itemTag(String name) {
- return TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(name));
- }
-
- private static TagKey fluidTag(String name) {
- return TagKey.create(Registry.FLUID_REGISTRY, new ResourceLocation(name));
- }
-
- private static TagKey blockTag(String name) {
- return TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(name));
- }
-
-}
diff --git a/src/main/java/appeng/api/implementations/IPowerChannelState.java b/src/main/java/appeng/api/implementations/IChannelState.java
similarity index 91%
rename from src/main/java/appeng/api/implementations/IPowerChannelState.java
rename to src/main/java/appeng/api/implementations/IChannelState.java
index fc08ffcdc14..22214618110 100644
--- a/src/main/java/appeng/api/implementations/IPowerChannelState.java
+++ b/src/main/java/appeng/api/implementations/IChannelState.java
@@ -26,13 +26,7 @@
/**
* This is intended for use on the client side to provide details to WAILA.
*/
-public interface IPowerChannelState {
-
- /**
- * @return true if the part/block is powered.
- */
- boolean isPowered();
-
+public interface IChannelState {
/**
* @return true if the part/block isActive
*/
diff --git a/src/main/java/appeng/api/implementations/blockentities/IChestOrDrive.java b/src/main/java/appeng/api/implementations/blockentities/IChestOrDrive.java
deleted file mode 100644
index 54265801850..00000000000
--- a/src/main/java/appeng/api/implementations/blockentities/IChestOrDrive.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.blockentities;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.world.item.Item;
-
-import appeng.api.networking.security.IActionHost;
-import appeng.api.storage.cells.CellState;
-import appeng.api.util.IOrientable;
-
-public interface IChestOrDrive extends IOrientable, IActionHost {
-
- /**
- * @return how many slots are available. Chest has 1, Drive has 10.
- */
- int getCellCount();
-
- /**
- * @param slot slot index
- *
- * @return status of the slot, one of the above indices.
- */
- CellState getCellStatus(int slot);
-
- /**
- * @return if the device is online you should check this before providing any other information.
- */
- boolean isPowered();
-
- /**
- * @param slot slot index
- *
- * @return is the cell currently blinking to show activity.
- */
- boolean isCellBlinking(int slot);
-
- /**
- * Returns the item of the cell in the given slot or null.
- */
- @Nullable
- Item getCellItem(int slot);
-
-}
diff --git a/src/main/java/appeng/api/implementations/blockentities/ICraftingMachine.java b/src/main/java/appeng/api/implementations/blockentities/ICraftingMachine.java
deleted file mode 100644
index 9150c018549..00000000000
--- a/src/main/java/appeng/api/implementations/blockentities/ICraftingMachine.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.blockentities;
-
-import java.util.Optional;
-
-import javax.annotation.Nullable;
-
-import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.network.chat.Component;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.entity.BlockEntity;
-
-import appeng.api.crafting.IPatternDetails;
-import appeng.api.ids.AEConstants;
-import appeng.api.stacks.KeyCounter;
-
-/**
- * Provides crafting services to adjacent pattern providers for automatic crafting. Can be provided via capability on
- * your block entity.
- */
-public interface ICraftingMachine {
-
- BlockApiLookup SIDED = BlockApiLookup.get(
- new ResourceLocation(AEConstants.MOD_ID, "icraftingmachine"), ICraftingMachine.class, Direction.class);
-
- @Nullable
- static ICraftingMachine of(@Nullable BlockEntity blockEntity, Direction side) {
- if (blockEntity == null) {
- return null;
- }
-
- return of(blockEntity.getLevel(), blockEntity.getBlockPos(), side, blockEntity);
- }
-
- @Nullable
- static ICraftingMachine of(Level level, BlockPos pos, Direction side,
- @org.jetbrains.annotations.Nullable BlockEntity blockEntity) {
- return SIDED.find(level, pos, null, blockEntity, side);
- }
-
- // TODO: 1.19.3+ Remove the default implementation.
- @Nullable
- default PatternContainerGroup getCraftingMachineInfo() {
- return null;
- }
-
- /**
- * @return An optional name for this crafting machine, which can be shown in the pattern provider terminal for
- * adjacent pattern providers that point to this crafting machine.
- */
- @Deprecated(forRemoval = true)
- default Optional getDisplayName() {
- return Optional.empty();
- }
-
- /**
- * inserts a crafting plan, and the necessary items into the crafting machine.
- *
- * @param inputs The crafting ingredients. The array layout corresponds to {@link IPatternDetails#getInputs()} of
- *
patternDetails
.
- * @return if it was accepted, all or nothing.
- */
- boolean pushPattern(IPatternDetails patternDetails, KeyCounter[] inputs, Direction ejectionDirection);
-
- /**
- * check if the crafting machine is accepting pushes via pushPattern, if this is false, all calls to push will fail,
- * you can try inserting into the inventory instead.
- *
- * @return true, if pushPattern can complete, if its false push will always be false.
- */
- boolean acceptsPlans();
-}
diff --git a/src/main/java/appeng/api/implementations/blockentities/IMEChest.java b/src/main/java/appeng/api/implementations/blockentities/IMEChest.java
deleted file mode 100644
index 0a9b4e13f46..00000000000
--- a/src/main/java/appeng/api/implementations/blockentities/IMEChest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.blockentities;
-
-import appeng.api.networking.energy.IEnergySource;
-
-public interface IMEChest extends IChestOrDrive, IEnergySource {
-
-}
diff --git a/src/main/java/appeng/api/implementations/blockentities/IViewCellStorage.java b/src/main/java/appeng/api/implementations/blockentities/IViewCellStorage.java
deleted file mode 100644
index 1c42066e67d..00000000000
--- a/src/main/java/appeng/api/implementations/blockentities/IViewCellStorage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.blockentities;
-
-import appeng.api.inventories.InternalInventory;
-
-public interface IViewCellStorage {
-
- /**
- * should contains at least 5 slot, the first 5
- *
- * @return inventory with at least 5 slot
- */
- InternalInventory getViewCellStorage();
-}
diff --git a/src/main/java/appeng/api/implementations/blockentities/IWirelessAccessPoint.java b/src/main/java/appeng/api/implementations/blockentities/IWirelessAccessPoint.java
index 04450312a7e..feeb0e676bc 100644
--- a/src/main/java/appeng/api/implementations/blockentities/IWirelessAccessPoint.java
+++ b/src/main/java/appeng/api/implementations/blockentities/IWirelessAccessPoint.java
@@ -36,11 +36,6 @@ public interface IWirelessAccessPoint extends IActionHost {
*/
DimensionalBlockPos getLocation();
- /**
- * @return max range for this WAP
- */
- double getRange();
-
/**
* @return can you use this WAP?
*/
diff --git a/src/main/java/appeng/api/implementations/blockentities/PatternContainerGroup.java b/src/main/java/appeng/api/implementations/blockentities/PatternContainerGroup.java
deleted file mode 100644
index 313f0b814c5..00000000000
--- a/src/main/java/appeng/api/implementations/blockentities/PatternContainerGroup.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package appeng.api.implementations.blockentities;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jetbrains.annotations.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.network.chat.Component;
-import net.minecraft.world.Nameable;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.Items;
-import net.minecraft.world.level.Level;
-
-import appeng.api.inventories.InternalInventory;
-import appeng.api.parts.IPartHost;
-import appeng.api.stacks.AEItemKey;
-import appeng.core.localization.GuiText;
-
-/**
- * Provides both a key for grouping pattern providers, and displaying the group in the pattern access terminal.
- *
- * The group can be the crafting container itself, for example if it is given a custom name by the player. It might
- * default to the crafting machine it is adjacent otherwise.
- *
- * @param icon The icon to display when referring to the grouped containers. This stack will NEVER be modified. It
- * will be used to show an icon, as well as compared to group similar containers. It may be
- * {@link ItemStack#EMPTY}
- * @param name The name to use to refer to the group.
- * @param tooltip Additional tooltip lines to describe the group (i.e. installed upgrades).
- */
-public record PatternContainerGroup(
- @Nullable AEItemKey icon,
- Component name,
- List tooltip) {
-
- private static final PatternContainerGroup NOTHING = new PatternContainerGroup(AEItemKey.of(Items.AIR),
- GuiText.Nothing.text(), List.of());
-
- public static PatternContainerGroup nothing() {
- return NOTHING;
- }
-
- public void writeToPacket(FriendlyByteBuf buffer) {
- buffer.writeBoolean(icon != null);
- if (icon != null) {
- icon.writeToPacket(buffer);
- }
- buffer.writeComponent(name);
- buffer.writeVarInt(tooltip.size());
- for (var component : tooltip) {
- buffer.writeComponent(component);
- }
- }
-
- public static PatternContainerGroup readFromPacket(FriendlyByteBuf buffer) {
- var icon = buffer.readBoolean() ? AEItemKey.fromPacket(buffer) : null;
- var name = buffer.readComponent();
- var lineCount = buffer.readVarInt();
- var lines = new ArrayList(lineCount);
- for (int i = 0; i < lineCount; i++) {
- lines.add(buffer.readComponent());
- }
- return new PatternContainerGroup(icon, name, lines);
- }
-
- @Nullable
- public static PatternContainerGroup fromMachine(Level level, BlockPos pos, Direction side) {
- var target = level.getBlockEntity(pos);
-
- // Check for first-class support
- var craftingMachine = ICraftingMachine.of(level, pos, side, target);
- if (craftingMachine != null) {
- var info = craftingMachine.getCraftingMachineInfo();
- if (info != null) {
- return info;
- }
- }
-
- // Anything else requires a block entity
- if (target == null) {
- return null;
- }
-
- // Heuristic: If it doesn't allow any transfers, ignore it
- var adaptor = InternalInventory.wrapExternal(target, side);
- if (adaptor == null || !adaptor.mayAllowInsertion()) {
- return null;
- }
-
- AEItemKey icon;
- Component name;
- List tooltip = List.of();
-
- // For scenarios like pattern providers against cable bus
- if (target instanceof IPartHost partHost) {
- var part = partHost.getPart(side);
- if (part == null) {
- // No part at side -> ignore, we don't interface with the cable
- return null;
- }
-
- icon = AEItemKey.of(part.getPartItem());
- if (part instanceof Nameable nameable && nameable.hasCustomName()) {
- name = nameable.getCustomName();
- } else {
- name = icon.getDisplayName();
- }
- } else {
- // Try to wrestle an item from the adjacent block entity
- // TODO On Forge we can use pick block here
- var targetBlock = target.getBlockState().getBlock();
- var targetItem = new ItemStack(targetBlock);
- icon = AEItemKey.of(targetItem);
-
- if (target instanceof Nameable nameable && nameable.hasCustomName()) {
- name = nameable.getCustomName();
- } else {
- if (targetItem.isEmpty()) {
- // If the object isn't named, and we didn't get an item from it,
- // we can't show either icon nor name!
- return null;
- }
- name = targetItem.getHoverName();
- }
- }
-
- return new PatternContainerGroup(icon, name, tooltip);
- }
-}
diff --git a/src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java b/src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java
deleted file mode 100644
index 9233f1c4c6c..00000000000
--- a/src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.items;
-
-import net.minecraft.world.item.ItemStack;
-
-import appeng.api.config.AccessRestriction;
-import appeng.api.config.Actionable;
-import appeng.api.networking.energy.IAEPowerStorage;
-
-/**
- * Basically the same as {@link IAEPowerStorage}, but for items.
- */
-public interface IAEItemPowerStorage {
- /**
- * Inject amt, power into the device, it will store what it can, and return the amount unable to be stored.
- *
- * @return amount unable to be stored
- */
- double injectAEPower(ItemStack stack, double amount, Actionable mode);
-
- /**
- * Attempt to extract power from the device, it will extract what it can and return it.
- *
- * @param amount to be extracted power from device
- * @return what it could extract
- */
- double extractAEPower(ItemStack stack, double amount, Actionable mode);
-
- /**
- * @return the current maximum power ( this can change :P )
- */
- double getAEMaxPower(ItemStack stack);
-
- /**
- * @return the current AE Power Level, this may exceed getMEMaxPower()
- */
- double getAECurrentPower(ItemStack stack);
-
- /**
- * Control the power flow by telling what the network can do, either add? or subtract? or both!
- *
- * @return access restriction of network
- */
- AccessRestriction getPowerFlow(ItemStack stack);
-
- /**
- * @return The amount of AE per tick that the AE charger will charge this item at.
- */
- double getChargeRate(ItemStack stack);
-}
diff --git a/src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java b/src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java
deleted file mode 100644
index c5ee58f1646..00000000000
--- a/src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.items;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.server.level.ServerLevel;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-
-/**
- * Implemented on a {@link Item}
- */
-public interface ISpatialStorageCell {
-
- /**
- * @param is spatial storage cell
- *
- * @return true if this item is a spatial storage cell
- */
- boolean isSpatialStorage(ItemStack is);
-
- /**
- * @param is spatial storage cell
- *
- * @return the maximum size of the spatial storage cell along any given axis
- */
- int getMaxStoredDim(ItemStack is);
-
- /**
- * get the currently stored spatial storage plot id.
- *
- * @param is spatial storage cell
- *
- * @return plot id or -1
- */
- int getAllocatedPlotId(ItemStack is);
-
- /**
- * Perform a spatial swap with the contents of the cell, and the level.
- *
- * @param is spatial storage cell
- * @param level level of spatial
- * @param min min coord
- * @param max max coord
- * @param playerId owner of current grid or -1
- *
- * @return success of transition
- */
- boolean doSpatialTransition(ItemStack is, ServerLevel level, BlockPos min, BlockPos max, int playerId);
-}
diff --git a/src/main/java/appeng/api/implementations/menuobjects/IPortableTerminal.java b/src/main/java/appeng/api/implementations/menuobjects/IPortableTerminal.java
index 3c96d5afd3c..b4290564b0b 100644
--- a/src/main/java/appeng/api/implementations/menuobjects/IPortableTerminal.java
+++ b/src/main/java/appeng/api/implementations/menuobjects/IPortableTerminal.java
@@ -23,12 +23,11 @@
package appeng.api.implementations.menuobjects;
-import appeng.api.networking.energy.IEnergySource;
import appeng.api.storage.ITerminalHost;
/**
* Obtained via {@link IMenuItem} getMenuHost
*/
-public interface IPortableTerminal extends ITerminalHost, IEnergySource {
+public interface IPortableTerminal extends ITerminalHost {
}
diff --git a/src/main/java/appeng/api/implementations/menuobjects/ItemMenuHost.java b/src/main/java/appeng/api/implementations/menuobjects/ItemMenuHost.java
index 2adeb9cee55..9814648d5a0 100644
--- a/src/main/java/appeng/api/implementations/menuobjects/ItemMenuHost.java
+++ b/src/main/java/appeng/api/implementations/menuobjects/ItemMenuHost.java
@@ -24,10 +24,6 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
-
-import appeng.api.config.Actionable;
-import appeng.api.config.PowerMultiplier;
-import appeng.api.networking.energy.IEnergySource;
import appeng.api.upgrades.IUpgradeInventory;
import appeng.api.upgrades.IUpgradeableItem;
import appeng.api.upgrades.IUpgradeableObject;
@@ -43,8 +39,6 @@ public class ItemMenuHost implements IUpgradeableObject {
private final Integer slot;
private final ItemStack itemStack;
private final IUpgradeInventory upgrades;
- private int powerTicks = 0;
- private double powerDrainPerTick = 0.5;
public ItemMenuHost(Player player, @Nullable Integer slot, ItemStack itemStack) {
this.player = player;
@@ -125,28 +119,6 @@ protected boolean ensureItemStillInSlot() {
return false;
}
- /**
- * Can only be used with a host that implements {@link IEnergySource} only call once per broadcastChanges()
- */
- public boolean drainPower() {
- if (this instanceof IEnergySource energySource) {
- this.powerTicks++;
- if (this.powerTicks > 10) {
- var amt = this.powerTicks * this.powerDrainPerTick;
- this.powerTicks = 0;
- return energySource.extractAEPower(amt, Actionable.MODULATE, PowerMultiplier.CONFIG) > 0;
- }
- }
- return true;
- }
-
- /**
- * Sets how much AE is drained per tick.
- */
- protected void setPowerDrainPerTick(double powerDrainPerTick) {
- this.powerDrainPerTick = powerDrainPerTick;
- }
-
@Override
public final IUpgradeInventory getUpgrades() {
return upgrades;
diff --git a/src/main/java/appeng/api/implementations/parts/IMonitorPart.java b/src/main/java/appeng/api/implementations/parts/IMonitorPart.java
deleted file mode 100644
index 7223160a74f..00000000000
--- a/src/main/java/appeng/api/implementations/parts/IMonitorPart.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.implementations.parts;
-
-import appeng.api.parts.IPart;
-
-/**
- * Implemented by all screen like parts provided by AE.
- */
-public interface IMonitorPart extends IPart {
-
- /**
- * @return if the device is online you should check this before providing any other information.
- */
- boolean isPowered();
-}
diff --git a/src/main/java/appeng/api/implementations/parts/IStorageMonitorPart.java b/src/main/java/appeng/api/implementations/parts/IStorageMonitorPart.java
index 25b929ce5b1..6a061d27fe4 100644
--- a/src/main/java/appeng/api/implementations/parts/IStorageMonitorPart.java
+++ b/src/main/java/appeng/api/implementations/parts/IStorageMonitorPart.java
@@ -32,7 +32,7 @@
/**
* The Storage monitor is a {@link IPart} located on the sides of a IPartHost
*/
-public interface IStorageMonitorPart extends IMonitorPart, IPart, INetworkToolAware {
+public interface IStorageMonitorPart extends IPart, INetworkToolAware {
/**
* @return what is being shown on the storage monitor
diff --git a/src/main/java/appeng/api/networking/IGrid.java b/src/main/java/appeng/api/networking/IGrid.java
index c1f7cd2e9e4..f157c365dd5 100644
--- a/src/main/java/appeng/api/networking/IGrid.java
+++ b/src/main/java/appeng/api/networking/IGrid.java
@@ -25,12 +25,9 @@
import java.util.Set;
-import appeng.api.networking.crafting.ICraftingService;
-import appeng.api.networking.energy.IEnergyService;
import appeng.api.networking.events.GridEvent;
import appeng.api.networking.pathing.IPathingService;
import appeng.api.networking.security.ISecurityService;
-import appeng.api.networking.spatial.ISpatialService;
import appeng.api.networking.storage.IStorageService;
import appeng.api.networking.ticking.ITickManager;
@@ -139,26 +136,6 @@ default IStorageService getStorageService() {
return getService(IStorageService.class);
}
- /**
- * Get this grids {@link IEnergyService}.
- *
- * @see #getService(Class)
- */
-
- default IEnergyService getEnergyService() {
- return getService(IEnergyService.class);
- }
-
- /**
- * Get this grids {@link ICraftingService}.
- *
- * @see #getService(Class)
- */
-
- default ICraftingService getCraftingService() {
- return getService(ICraftingService.class);
- }
-
/**
* Get this grids {@link ISecurityService}.
*
@@ -178,14 +155,4 @@ default ISecurityService getSecurityService() {
default IPathingService getPathingService() {
return getService(IPathingService.class);
}
-
- /**
- * Get this grids {@link ISpatialService}.
- *
- * @see #getService(Class)
- */
-
- default ISpatialService getSpatialService() {
- return getService(ISpatialService.class);
- }
}
diff --git a/src/main/java/appeng/api/networking/IGridNode.java b/src/main/java/appeng/api/networking/IGridNode.java
index e93b019b24c..31396e9bb99 100644
--- a/src/main/java/appeng/api/networking/IGridNode.java
+++ b/src/main/java/appeng/api/networking/IGridNode.java
@@ -35,7 +35,6 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.entity.BlockEntity;
-import appeng.api.networking.crafting.ICraftingService;
import appeng.api.networking.pathing.IPathingService;
import appeng.api.stacks.AEItemKey;
import appeng.api.util.AEColor;
@@ -115,7 +114,7 @@ public interface IGridNode {
* visual state display to avoid the device looking disabled while the grid is booting.
*/
default boolean isActive() {
- return isPowered() && hasGridBooted() && meetsChannelRequirements();
+ return hasGridBooted() && meetsChannelRequirements();
}
/**
@@ -126,7 +125,7 @@ default boolean isActive() {
* as the channels might still be outdated.
*/
default boolean isOnline() {
- return isPowered() && meetsChannelRequirements();
+ return meetsChannelRequirements();
}
/**
@@ -135,13 +134,6 @@ default boolean isOnline() {
*/
boolean hasGridBooted();
- /**
- * @return True if the node has power from it's connected grid. Can be used to show a machine being powered, even if
- * the machine doesn't have it's required channel or the network is still booting.
- * @see #isActive()
- */
- boolean isPowered();
-
/**
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
* status.
@@ -162,12 +154,6 @@ default boolean isOnline() {
*/
int getOwningPlayerId();
- /**
- * @return The power in AE/t that will be drained by this node.
- */
- @Nonnegative
- double getIdlePowerUsage();
-
/**
* @return True if the grid node is accessible on the given side of the host.
*/
diff --git a/src/main/java/appeng/api/networking/IGridNodeListener.java b/src/main/java/appeng/api/networking/IGridNodeListener.java
index 09cc3898ed5..12f8db17ef9 100644
--- a/src/main/java/appeng/api/networking/IGridNodeListener.java
+++ b/src/main/java/appeng/api/networking/IGridNodeListener.java
@@ -73,10 +73,6 @@ default void onStateChanged(T nodeOwner, IGridNode node, State state) {
* Gives a reason for why the active state of the node might have changed.
*/
enum State {
- /**
- * The node's power status has changed (it either became powered or unpowered).
- */
- POWER,
/**
* The node's assigned channels have changed. This might only be relevant for nodes that require channels.
*/
diff --git a/src/main/java/appeng/api/networking/IManagedGridNode.java b/src/main/java/appeng/api/networking/IManagedGridNode.java
index 89fae6538e0..c6adb066abe 100644
--- a/src/main/java/appeng/api/networking/IManagedGridNode.java
+++ b/src/main/java/appeng/api/networking/IManagedGridNode.java
@@ -125,11 +125,6 @@ default IGrid getGrid() {
*/
IManagedGridNode setExposedOnSides(Set directions);
- /**
- * @param usagePerTick The power in AE/t that will be drained by this node.
- */
- IManagedGridNode setIdlePowerUsage(@Nonnegative double usagePerTick);
-
/**
* Sets an itemstack that will only be used to represent this grid node in user interfaces. Can be set to
* null
to hide the node from UIs.
diff --git a/src/main/java/appeng/api/networking/IStackWatcher.java b/src/main/java/appeng/api/networking/IStackWatcher.java
index 6e78543a512..9c3938395c5 100644
--- a/src/main/java/appeng/api/networking/IStackWatcher.java
+++ b/src/main/java/appeng/api/networking/IStackWatcher.java
@@ -2,7 +2,6 @@
import org.jetbrains.annotations.ApiStatus;
-import appeng.api.networking.crafting.ICraftingWatcherNode;
import appeng.api.networking.storage.IStorageWatcherNode;
import appeng.api.stacks.AEKey;
diff --git a/src/main/java/appeng/api/networking/crafting/CalculationStrategy.java b/src/main/java/appeng/api/networking/crafting/CalculationStrategy.java
deleted file mode 100644
index f2805762e3d..00000000000
--- a/src/main/java/appeng/api/networking/crafting/CalculationStrategy.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package appeng.api.networking.crafting;
-
-public enum CalculationStrategy {
- /**
- * If the exact requested amount cannot be crafted, create a {@link ICraftingPlan} containing the missing items.
- */
- REPORT_MISSING_ITEMS,
- /**
- * Try to craft less items than requested. Will try to craft as many items as possible. If even {@code 1} cannot be
- * crafted, fall back to {@link #REPORT_MISSING_ITEMS}.
- */
- CRAFT_LESS,
-}
diff --git a/src/main/java/appeng/api/networking/crafting/CraftingJobStatus.java b/src/main/java/appeng/api/networking/crafting/CraftingJobStatus.java
deleted file mode 100644
index 109e51e23c9..00000000000
--- a/src/main/java/appeng/api/networking/crafting/CraftingJobStatus.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package appeng.api.networking.crafting;
-
-import appeng.api.stacks.GenericStack;
-
-public record CraftingJobStatus(GenericStack crafting, long totalItems, long progress, long elapsedTimeNanos) {
-}
diff --git a/src/main/java/appeng/api/networking/crafting/CraftingSubmitErrorCode.java b/src/main/java/appeng/api/networking/crafting/CraftingSubmitErrorCode.java
deleted file mode 100644
index 4585c4ff7ce..00000000000
--- a/src/main/java/appeng/api/networking/crafting/CraftingSubmitErrorCode.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package appeng.api.networking.crafting;
-
-import appeng.api.stacks.GenericStack;
-
-/**
- * Gives a reason for why submitting the crafting job failed.
- */
-public enum CraftingSubmitErrorCode {
- /**
- * Trying to submit a plan that is incomplete. Plans that return true for {@link ICraftingPlan#simulation()} are
- * incomplete.
- */
- INCOMPLETE_PLAN,
- /**
- * Couldn't find any CPUs to execute this job.
- */
- NO_CPU_FOUND,
- /**
- * None of the available CPUs are suitable to execute this job. {@link ICraftingSubmitResult#errorDetail()} contains
- * an instance of {@link UnsuitableCpus} giving details as to why available CPUs are unsuitable.
- */
- NO_SUITABLE_CPU_FOUND,
- /**
- * The selected crafting CPU is already working on something else.
- */
- CPU_BUSY,
- /**
- * The CPU is currently offline (no power or not enough channels).
- */
- CPU_OFFLINE,
- /**
- * The CPU is too small to process the job.
- */
- CPU_TOO_SMALL,
- /**
- * Could not obtain one of the ingredients needed for the job. {@link ICraftingSubmitResult#errorDetail()} is a
- * {@link GenericStack} explaining what is missing.
- */
- MISSING_INGREDIENT
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingCPU.java b/src/main/java/appeng/api/networking/crafting/ICraftingCPU.java
deleted file mode 100644
index 2d637b368ba..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingCPU.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.network.chat.Component;
-
-import appeng.api.config.CpuSelectionMode;
-
-public interface ICraftingCPU {
-
- /**
- * @return true if the CPU currently has a job.
- */
- boolean isBusy();
-
- /**
- * @return The status of the current job (that is if {@link #isBusy()} was true).
- */
- @Nullable
- CraftingJobStatus getJobStatus();
-
- /**
- * @return the available storage in bytes
- */
- long getAvailableStorage();
-
- /**
- * @return the number of co-processors in the CPU.
- */
- int getCoProcessors();
-
- /**
- * @return a null or the name of the cpu.
- */
- @Nullable
- Component getName();
-
- /**
- * @return The mode used to select this CPU for crafting jobs when the CPU should be auto-selected.
- */
- CpuSelectionMode getSelectionMode();
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingLink.java b/src/main/java/appeng/api/networking/crafting/ICraftingLink.java
deleted file mode 100644
index b6533967ecf..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingLink.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import net.minecraft.nbt.CompoundTag;
-
-public interface ICraftingLink {
-
- /**
- * @return true if the job was canceled.
- */
- boolean isCanceled();
-
- /**
- * @return true if the job was completed.
- */
- boolean isDone();
-
- /**
- * cancels the job.
- */
- void cancel();
-
- /**
- * @return true if this link was generated without a requesting machine, such as a player generated request.
- */
- boolean isStandalone();
-
- /**
- * write the link to an NBT Tag
- *
- * @param tag to be written data
- */
- void writeToNBT(CompoundTag tag);
-
- /**
- * @return the crafting ID for this link.
- */
- String getCraftingID();
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingPlan.java b/src/main/java/appeng/api/networking/crafting/ICraftingPlan.java
deleted file mode 100644
index 1df89f7b656..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingPlan.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import java.util.Map;
-
-import appeng.api.crafting.IPatternDetails;
-import appeng.api.stacks.GenericStack;
-import appeng.api.stacks.KeyCounter;
-
-/**
- * Result of a {@linkplain ICraftingService#beginCraftingCalculation crafting job calculation}. Do not edit any of the
- * map/lists, they are exposed directly!
- */
-public interface ICraftingPlan {
- /**
- * Final output of the job.
- */
- GenericStack finalOutput();
-
- /**
- * Total bytes used by the job.
- */
- long bytes();
-
- /**
- * True if some things were missing and this is just a simulation.
- */
- boolean simulation();
-
- /**
- * True there were multiple paths in the crafting tree, i.e. at least one item had multiple patterns that could
- * produce it.
- */
- boolean multiplePaths();
-
- /**
- * List of items that were used. (They would need to be extracted to start the job).
- */
- KeyCounter usedItems();
-
- /**
- * List of items that need to be emitted for this job.
- */
- KeyCounter emittedItems();
-
- /**
- * List of missing items if this is a simulation.
- */
- KeyCounter missingItems();
-
- /**
- * Map of each pattern to the number of times it needs to be crafted. Can be used to retrieve the crafted items:
- * outputs * times.
- */
- Map patternTimes();
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingProvider.java b/src/main/java/appeng/api/networking/crafting/ICraftingProvider.java
deleted file mode 100644
index 604a9eba1f8..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import java.util.List;
-import java.util.Set;
-
-import appeng.api.crafting.IPatternDetails;
-import appeng.api.networking.IGridNodeService;
-import appeng.api.networking.IManagedGridNode;
-import appeng.api.stacks.AEKey;
-import appeng.api.stacks.KeyCounter;
-
-/**
- * Allows a node to provide crafting patterns and emitable items to the network.
- */
-public interface ICraftingProvider extends IGridNodeService {
- /**
- * Return the patterns offered by this provider. {@link #pushPattern} will be called if they need to be crafted.
- */
- List getAvailablePatterns();
-
- /**
- * Return the priority for the patterns offered by this provider. The crafting calculation will prioritize patterns
- * with the highest priority.
- */
- default int getPatternPriority() {
- return 0;
- }
-
- /**
- * Instruct a provider to craft one of the patterns.
- *
- * @param patternDetails details
- * @param inputHolder the requested stacks, for each input slot of the pattern
- *
- * @return if the pattern was successfully pushed.
- */
- boolean pushPattern(IPatternDetails patternDetails, KeyCounter[] inputHolder);
-
- /**
- * @return if this is true, the crafting engine will refuse to send patterns to this provider.
- */
- boolean isBusy();
-
- /**
- * Return the emitable items offered by this provider. They should be crafted and inserted into the network when
- * {@link ICraftingService#isRequesting} is true.
- */
- default Set getEmitableItems() {
- return Set.of();
- }
-
- /**
- * This convenience method can be used when the crafting options or emitable items have changed to request an update
- * of the crafting service's cache.This only works if the given managed grid node provides this service.
- */
- static void requestUpdate(IManagedGridNode managedNode) {
- var node = managedNode.getNode();
- if (node != null) {
- node.getGrid().getCraftingService().refreshNodeCraftingProvider(node);
- }
- }
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingRequester.java b/src/main/java/appeng/api/networking/crafting/ICraftingRequester.java
deleted file mode 100644
index e75834ce7f4..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingRequester.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import com.google.common.collect.ImmutableSet;
-
-import appeng.api.config.Actionable;
-import appeng.api.networking.IGridNodeService;
-import appeng.api.networking.security.IActionHost;
-import appeng.api.stacks.AEKey;
-
-public interface ICraftingRequester extends IActionHost, IGridNodeService {
-
- /**
- * called when the host is added to the grid, and should return all crafting links it poses so they can be connected
- * with the cpu that hosts the job.
- *
- * @return set of jobs, or an empty list.
- */
- ImmutableSet getRequestedJobs();
-
- /**
- * items are injected into the requester as they are completed.
- *
- * @return the number of items inserted.
- */
- long insertCraftedItems(ICraftingLink link, AEKey what, long amount, Actionable mode);
-
- /**
- * called when the job changes from in progress, to either complete, or canceled.
- *
- * after this call the crafting link is "dead" and should be discarded.
- */
- void jobStateChange(ICraftingLink link);
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingService.java b/src/main/java/appeng/api/networking/crafting/ICraftingService.java
deleted file mode 100644
index 8366047925e..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingService.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.jetbrains.annotations.Nullable;
-
-import net.minecraft.world.level.Level;
-
-import appeng.api.crafting.IPatternDetails;
-import appeng.api.networking.IGridNode;
-import appeng.api.networking.IGridService;
-import appeng.api.networking.security.IActionSource;
-import appeng.api.stacks.AEKey;
-import appeng.api.storage.AEKeyFilter;
-
-public interface ICraftingService extends IGridService {
-
- /**
- * @param whatToCraft requested craft
- *
- * @return an unmodifiable collection of crafting patterns for the item in question.
- */
- Collection getCraftingFor(AEKey whatToCraft);
-
- /**
- * @return true if the grid knows how to craft the given key
- */
- default boolean isCraftable(AEKey whatToCraft) {
- return !getCraftingFor(whatToCraft).isEmpty();
- }
-
- /**
- * Refreshes the crafting mounts provided by a {@link IGridNode node} through its {@link ICraftingProvider}.
- *
- * @throws IllegalArgumentException If the given node is not part of this grid, or did not provide
- * {@link ICraftingProvider}.
- */
- void refreshNodeCraftingProvider(IGridNode node);
-
- /**
- * Important: Never mutate the passed or returned stacks.
- *
- * @return another fuzzy equals stack that can be crafted and matches the filter, or null if none exists
- */
- @Nullable
- AEKey getFuzzyCraftable(AEKey whatToCraft, AEKeyFilter filter);
-
- /**
- * Begin calculating a crafting job.
- *
- * @param level crafting level
- * @param simRequester source
- * @param craftWhat result
- * @param strategy usually {@link CalculationStrategy#REPORT_MISSING_ITEMS} for player requests
- *
- * @return a future which will at an undetermined point in the future get you the {@link ICraftingPlan} do not wait
- * on this, your be waiting forever.
- */
- Future beginCraftingCalculation(Level level, ICraftingSimulationRequester simRequester,
- AEKey craftWhat, long amount, CalculationStrategy strategy);
-
- /**
- * Submit the job to the Crafting system for processing.
- *
- * If you send a requestingMachine you need to keep track of the resulting {@link ICraftingLink}, persist it to nbt,
- * and expose it in {@link ICraftingRequester#getRequestedJobs()} so that the requester can be linked back to the
- * CPU after a chunk unload / grid change.
- *
- * @param job - the crafting job from beginCraftingJob
- * @param requestingMachine - a machine if its being requested via automation, may be null.
- * @param target - can be null
- * @param prioritizePower - if cpu is null, this determine if the system should prioritize power, or if it should
- * find the lower end cpus.
- * @param src - the action source to use when starting the job, this will be used for extracting
- * items, should usually be the same as the one provided to beginCraftingJob.
- *
- * @return the success/failure state, and a crafting link in case if successful and there was a requestingMachine.
- */
- ICraftingSubmitResult submitJob(ICraftingPlan job, @Nullable ICraftingRequester requestingMachine,
- @Nullable ICraftingCPU target,
- boolean prioritizePower, IActionSource src);
-
- /**
- * @return list of all the crafting cpus on the grid
- */
- ImmutableSet getCpus();
-
- /**
- * @param what to be requested item
- *
- * @return true if the item can be requested via a crafting emitter.
- */
- boolean canEmitFor(AEKey what);
-
- /**
- * Get the set of things that can be crafted for a given storage channel.
- */
- Set getCraftables(AEKeyFilter filter);
-
- /**
- * Returns true if what
is currently being requested for a crafting job in this grid.
- *
- * This means that its pattern was pushed to a provider and the result is now being awaited, or that more of the
- * item is expected to be emitted. The final output of a job does not count as being requested.
- *
- * @param what item being crafted
- *
- * @return true if it is being crafting
- */
- boolean isRequesting(AEKey what);
-
- /**
- * Gets the total amount being requested across all crafting cpus of a grid.
- *
- * @param what the key for which the requested amount should be returned
- *
- * @return The total amount being requested.
- */
- long getRequestedAmount(AEKey what);
-
- /**
- * Returns true if anything is currently being requested as part of a crafting job in this grid.
- *
- * @see #isRequesting(AEKey)
- */
- boolean isRequestingAny();
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingSimulationRequester.java b/src/main/java/appeng/api/networking/crafting/ICraftingSimulationRequester.java
deleted file mode 100644
index 4a7a32580ea..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingSimulationRequester.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package appeng.api.networking.crafting;
-
-import javax.annotation.Nullable;
-
-import appeng.api.networking.IGridNode;
-import appeng.api.networking.security.IActionHost;
-import appeng.api.networking.security.IActionSource;
-
-/**
- * The source of a crafting simulation request. This allows the crafting simulation to keep track of the current grid
- * across multiple ticks to simulate item extraction or to explore more patterns.
- *
- * Returning null in one of the functions will just prevent extraction or exploration of patterns, likely leading to an
- * unsuccessful {@link ICraftingPlan}.
- */
-public interface ICraftingSimulationRequester {
- /**
- * Return the current action source, used to extract items.
- */
- @Nullable
- IActionSource getActionSource();
-
- /**
- * Return the current grid node, used to access the current grid state.
- */
- @Nullable
- default IGridNode getGridNode() {
- var actionSource = getActionSource();
- if (actionSource != null) {
- return actionSource.machine().map(IActionHost::getActionableNode).orElse(null);
- }
- return null;
- }
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingSubmitResult.java b/src/main/java/appeng/api/networking/crafting/ICraftingSubmitResult.java
deleted file mode 100644
index ba0942cb410..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingSubmitResult.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package appeng.api.networking.crafting;
-
-import org.jetbrains.annotations.ApiStatus;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Result of {@linkplain ICraftingService#submitJob submitting a crafting job}.
- */
-@ApiStatus.NonExtendable
-public interface ICraftingSubmitResult {
- default boolean successful() {
- return errorCode() == null;
- }
-
- /**
- * @return A not-null error code if the auto-crafting request was not submitted succesfully.
- */
- @Nullable
- CraftingSubmitErrorCode errorCode();
-
- /**
- * If {@link #errorCode()} is not-null, this may optionally give additional error details. Type depends on the error
- * code returned in {@link #errorCode()}.
- */
- @Nullable
- Object errorDetail();
-
- /**
- * The crafting link, only available for successful requests with a requester. Make sure to properly keep track of
- * this object, save it to NBT, load it from NBT, and make it available to the network via
- * {@link ICraftingRequester#getRequestedJobs()}.
- */
- @Nullable
- ICraftingLink link();
-}
diff --git a/src/main/java/appeng/api/networking/crafting/ICraftingWatcherNode.java b/src/main/java/appeng/api/networking/crafting/ICraftingWatcherNode.java
deleted file mode 100644
index 99de5182480..00000000000
--- a/src/main/java/appeng/api/networking/crafting/ICraftingWatcherNode.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.crafting;
-
-import appeng.api.networking.IGridNodeService;
-import appeng.api.networking.IStackWatcher;
-import appeng.api.stacks.AEKey;
-
-/**
- * A node that is notified of changes to the currently crafting items in the network. Implementors should store the
- * watcher passed to {@link #updateWatcher} and use it to configure the watched stacks.
- */
-public interface ICraftingWatcherNode extends IGridNodeService {
-
- /**
- * provides the watcher for this host, for the current network, is called when the hot changes networks. You do not
- * need to clear your old watcher, its already been removed by the time this gets called.
- *
- * @param newWatcher crafting watcher for this host
- */
- void updateWatcher(IStackWatcher newWatcher);
-
- /**
- * Called when a crafting status changes.
- *
- * @param craftingGrid current crafting grid
- * @param what changed key
- */
- void onRequestChange(ICraftingService craftingGrid, AEKey what);
-}
diff --git a/src/main/java/appeng/api/networking/crafting/UnsuitableCpus.java b/src/main/java/appeng/api/networking/crafting/UnsuitableCpus.java
deleted file mode 100644
index 6d678d75d14..00000000000
--- a/src/main/java/appeng/api/networking/crafting/UnsuitableCpus.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package appeng.api.networking.crafting;
-
-/**
- * Details about unsuitable crafting CPUs unavailable for a job. Detail for
- * {@link appeng.api.networking.crafting.CraftingSubmitErrorCode#NO_SUITABLE_CPU_FOUND}.
- */
-public record UnsuitableCpus(int offline, int busy, int tooSmall, int excluded) {
-}
diff --git a/src/main/java/appeng/api/networking/energy/IAEPowerStorage.java b/src/main/java/appeng/api/networking/energy/IAEPowerStorage.java
deleted file mode 100644
index a575e86fec3..00000000000
--- a/src/main/java/appeng/api/networking/energy/IAEPowerStorage.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.energy;
-
-import appeng.api.config.AccessRestriction;
-import appeng.api.config.Actionable;
-import appeng.api.networking.IGrid;
-import appeng.api.networking.IGridNodeService;
-
-/**
- * Used to access information about AE's various power accepting blocks for monitoring purposes.
- */
-public interface IAEPowerStorage extends IEnergySource, IGridNodeService {
-
- /**
- * Inject amt, power into the device, it will store what it can, and return the amount unable to be stored.
- *
- * @param amt to be injected amount
- * @param mode action mode
- *
- * @return amount of power which was unable to be stored
- */
- double injectAEPower(double amt, Actionable mode);
-
- /**
- * @return the current maximum power ( this can change :P )
- */
- double getAEMaxPower();
-
- /**
- * @return the current AE Power Level, this may exceed getMEMaxPower()
- */
- double getAECurrentPower();
-
- /**
- * Checked on network reset to see if your block can be used as a public power storage ( use getPowerFlow to control
- * the behavior )
- *
- * @return true if it can be used as a public power storage
- */
- boolean isAEPublicPowerStorage();
-
- /**
- * Control the power flow by telling what the network can do, either add? or subtract? or both!
- *
- * @return access restriction what the network can do
- */
-
- AccessRestriction getPowerFlow();
-
- /**
- * The priority to use this energy storage.
- *
- * A higher value means it is more likely to be extracted from first, and less likely to be inserted into first.
- *
- * The value needs to be constant once added to a {@link IGrid}. Should it ever need to be changed, it has to be
- * removed from the grid, then update the value, and finally added back to the grid.
- *
- * This should never use {@link Integer#MIN_VALUE} or {@link Integer#MAX_VALUE}.
- *
- * @return the priority for this storage
- */
- default int getPriority() {
- return 0;
- }
-}
diff --git a/src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java b/src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java
deleted file mode 100644
index 8f503c611dc..00000000000
--- a/src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.energy;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnegative;
-
-import appeng.api.config.Actionable;
-import appeng.api.networking.IGridNodeService;
-
-/**
- * internal use only.
- */
-public interface IEnergyGridProvider extends IGridNodeService {
- /**
- * internal use only
- *
- * Can return a list of providers behind the current.
- *
- * An example would be something acting as proxy between different {@link IEnergyService}s.
- *
- * This can contain duplicate entries, AE will ensure that each provider is only visited once.
- *
- * internal use only
- */
-
- Collection providers();
-
- /**
- * internal use only
- *
- * Extracts the requested amount from the provider.
- *
- * This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
- * {@link IEnergyGridProvider#providers()}
- *
- * @return the used amount
- */
- @Nonnegative
- double extractProviderPower(@Nonnegative double amt, Actionable mode);
-
- /**
- * Injects the offered amount into the provider.
- *
- * This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
- * {@link IEnergyGridProvider#providers()}
- *
- * internal use only
- *
- * @return the leftover amount
- */
- @Nonnegative
- double injectProviderPower(@Nonnegative double amt, Actionable mode);
-
- /**
- * internal use only
- *
- * Returns the current demand of an provider.
- *
- * This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
- * {@link IEnergyGridProvider#providers()}
- *
- *
- * @param d the max amount offered, the demand should never exceed it.
- * @return the total amount demanded
- */
- @Nonnegative
- double getProviderEnergyDemand(@Nonnegative double d);
-
- /**
- * internal use only
- *
- * AE currently uses this to enqueue the next visited provider.
- *
- * There is no guarantee that this works on in a perfect way. It can be limited to the returns of the past
- * {@link IEnergyGridProvider#providers()}, but not any future one discovered by visiting further providers.
- *
- * E.g. inject into the the lowest one first or extract from the highest one.
- *
- * @return the current stored amount.
- *
- *
- */
- @Nonnegative
- double getProviderStoredEnergy();
-
- /**
- * internal use only
- *
- * AE currently uses this to enqueue the next visited provider.
- *
- * There is no guarantee that this works on in a perfect way. It can be limited to the returns of the past
- * {@link IEnergyGridProvider#providers()}, but not any future one discovered by visiting further providers.
- *
- * E.g. inject into the the lowest one first or extract from the highest one.
- *
- * @return the maximum amount stored.
- */
- @Nonnegative
- double getProviderMaxEnergy();
-}
diff --git a/src/main/java/appeng/api/networking/energy/IEnergyService.java b/src/main/java/appeng/api/networking/energy/IEnergyService.java
deleted file mode 100644
index cf3d769592a..00000000000
--- a/src/main/java/appeng/api/networking/energy/IEnergyService.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.energy;
-
-import javax.annotation.Nonnegative;
-
-import appeng.api.config.Actionable;
-import appeng.api.networking.IGridService;
-
-/**
- * AE's Power system.
- */
-public interface IEnergyService extends IGridService, IEnergySource {
-
- /**
- * Return the current calculated idle energy drain each tick, is used internally to drain power for each tick. It's
- * the sum of the {@linkplain #getChannelPowerUsage() idle channel power usage} and the idle usages of the machines
- * in the network.
- */
- @Nonnegative
- double getIdlePowerUsage();
-
- /**
- * @return the current idle power usage of channels
- */
- @Nonnegative
- double getChannelPowerUsage();
-
- /**
- * @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
- * extractPower.
- */
- @Nonnegative
- double getAvgPowerUsage();
-
- /**
- * @return the average energy injected into the system per tick, for the last 10 ticks.
- */
- @Nonnegative
- double getAvgPowerInjection();
-
- /**
- * AE maintains an idle draw of power separate from active power draw, it condenses this into a single operation
- * that determines the networks "powered state" if the network is considered off-line, your machines should not
- * function.
- *
- * Nodes are notified via {@link appeng.api.networking.IGridNodeListener#onStateChanged} when this value changes.
- * Most machines can simply test the value when they are about to perform work, without listening to this event.
- *
- * @return if the network is powered or not.
- */
- boolean isNetworkPowered();
-
- /**
- * AE will accept any power, and store it, to maintain sanity please don't send more then 10,000 at a time.
- *
- * IMPORTANT: Network power knows no bounds, for less spamy power flow, networks can store more then their allotted
- * storage, however, it should be kept to a minimum, to help with this, this method returns the networks current
- * OVERFLOW, this is not energy you can store some where else, its already stored in the network, you can extract it
- * if you want, however it it owned by the network, this is different then IAEEnergyStore
- *
- * Another important note, is that if a network that had overflow is deleted, its power is gone, this is one of the
- * reasons why keeping overflow to a minimum is important.
- *
- * @param amt power to inject into the network
- * @param mode should the action be simulated or performed?
- * @return the amount of power that the network has OVER the limit.
- */
- @Nonnegative
- double injectPower(@Nonnegative double amt, Actionable mode);
-
- /**
- * this is should be considered an estimate, and not relied upon for real calculations.
- *
- * @return estimated available power.
- */
- @Nonnegative
- double getStoredPower();
-
- /**
- * this is should be considered an estimate, and not relied upon for real calculations.
- *
- * @return estimated available power.
- */
- @Nonnegative
- double getMaxStoredPower();
-
- /**
- * Calculation will be capped at maxRequired, this improves performance by limiting the number of nodes needed to
- * calculate the demand.
- *
- * @return Amount of power required to charge the grid, in AE.
- */
- @Nonnegative
- double getEnergyDemand(@Nonnegative double maxRequired);
-}
diff --git a/src/main/java/appeng/api/networking/energy/IEnergySource.java b/src/main/java/appeng/api/networking/energy/IEnergySource.java
deleted file mode 100644
index 3f919262bc8..00000000000
--- a/src/main/java/appeng/api/networking/energy/IEnergySource.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.energy;
-
-import javax.annotation.Nonnegative;
-
-import appeng.api.config.Actionable;
-import appeng.api.config.PowerMultiplier;
-
-public interface IEnergySource {
-
- /**
- * Extract power from the network.
- *
- * @param amt extracted power
- * @param mode should the action be simulated or performed?
- *
- * @return returns extracted power.
- */
- @Nonnegative
- double extractAEPower(@Nonnegative double amt, Actionable mode,
- PowerMultiplier usePowerMultiplier);
-}
diff --git a/src/main/java/appeng/api/networking/energy/IEnergyWatcher.java b/src/main/java/appeng/api/networking/energy/IEnergyWatcher.java
deleted file mode 100644
index bdb4189f5d6..00000000000
--- a/src/main/java/appeng/api/networking/energy/IEnergyWatcher.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.energy;
-
-import javax.annotation.Nonnegative;
-
-/**
- * DO NOT IMPLEMENT.
- *
- * Will be injected when adding an {@link IEnergyWatcherNode} to a grid.
- */
-public interface IEnergyWatcher {
- /**
- * Add a specific threshold to watch.
- *
- * Supports multiple values, duplicate ones will not be added.
- *
- * @param amount
- * @return true, if successfully added.
- */
- boolean add(@Nonnegative double amount);
-
- /**
- * Remove a specific threshold from the watcher.
- *
- * @param amount
- * @return true, if successfully removed.
- */
- boolean remove(@Nonnegative double amount);
-
- /**
- * Removes all thresholds and resets the watcher to a clean state.
- */
- void reset();
-
-}
diff --git a/src/main/java/appeng/api/networking/energy/IEnergyWatcherNode.java b/src/main/java/appeng/api/networking/energy/IEnergyWatcherNode.java
deleted file mode 100644
index f4e9126a382..00000000000
--- a/src/main/java/appeng/api/networking/energy/IEnergyWatcherNode.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.energy;
-
-import appeng.api.networking.IGridNodeService;
-
-public interface IEnergyWatcherNode extends IGridNodeService {
-
- /**
- * provides the IEnergyWatcher for this host, for the current network, is called when the hot changes networks. You
- * do not need to clear your old watcher, its already been removed by the time this gets called.
- *
- * @param newWatcher new watcher
- */
- void updateWatcher(IEnergyWatcher newWatcher);
-
- /**
- * Called when a threshold is crossed.
- *
- * @param energyGrid grid
- */
- void onThresholdPass(IEnergyService energyGrid);
-}
diff --git a/src/main/java/appeng/api/networking/events/GridPowerIdleChange.java b/src/main/java/appeng/api/networking/events/GridPowerIdleChange.java
deleted file mode 100644
index 4507deafe0e..00000000000
--- a/src/main/java/appeng/api/networking/events/GridPowerIdleChange.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.events;
-
-import appeng.api.networking.IGridNode;
-
-/**
- * Implementers of a IGridBlock must post this event when your getIdlePowerUsage starts returning a new value, if you do
- * not post this event the network will not change the idle draw.
- *
- * you do not need to send this event when your node is added / removed from the grid.
- */
-public class GridPowerIdleChange extends GridEvent {
-
- public final IGridNode node;
-
- public GridPowerIdleChange(IGridNode nodeThatChanged) {
- this.node = nodeThatChanged;
- }
-}
diff --git a/src/main/java/appeng/api/networking/events/GridPowerStatusChange.java b/src/main/java/appeng/api/networking/events/GridPowerStatusChange.java
deleted file mode 100644
index 7dd1848314c..00000000000
--- a/src/main/java/appeng/api/networking/events/GridPowerStatusChange.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.events;
-
-/**
- * Posted when the Grid loses power or is powered again.
- */
-public class GridPowerStatusChange extends GridEvent {
-}
diff --git a/src/main/java/appeng/api/networking/events/GridPowerStorageStateChanged.java b/src/main/java/appeng/api/networking/events/GridPowerStorageStateChanged.java
deleted file mode 100644
index 3f5594a5777..00000000000
--- a/src/main/java/appeng/api/networking/events/GridPowerStorageStateChanged.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.events;
-
-import appeng.api.networking.energy.IAEPowerStorage;
-
-/**
- * informs the network, that a {@link IAEPowerStorage} block that had either run, out of power, or was full, is no
- * longer in that state.
- *
- * failure to post this event when your {@link IAEPowerStorage} changes state will result in your block not charging, or
- * not-discharging.
- *
- * you do not need to send this event when your node is added / removed from the grid.
- */
-public class GridPowerStorageStateChanged extends GridEvent {
-
- public final IAEPowerStorage storage;
- public final PowerEventType type;
-
- public GridPowerStorageStateChanged(IAEPowerStorage t, PowerEventType y) {
- this.storage = t;
- this.type = y;
- }
-
- public enum PowerEventType {
- /**
- * informs the network this block entity is ready to receive power again.
- */
- REQUEST_POWER,
-
- /**
- * informs the network this block entity is ready to provide power again.
- */
- PROVIDE_POWER
- }
-}
diff --git a/src/main/java/appeng/api/networking/events/GridSpatialEvent.java b/src/main/java/appeng/api/networking/events/GridSpatialEvent.java
deleted file mode 100644
index ea0166aab1b..00000000000
--- a/src/main/java/appeng/api/networking/events/GridSpatialEvent.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.events;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.level.Level;
-
-/**
- * An event that is posted whenever a spatial IO is active.
- */
-public class GridSpatialEvent extends GridEvent {
- /**
- * The level in which the Spatial I/O block entity triggering this transition is located.
- */
- public final Level spatialIoLevel;
- /**
- * The block position at which the Spatial I/O block entity triggering this transition is located.
- */
- public final BlockPos spatialIoPos;
- /**
- * The energy in AE units needed to perform this transition.
- */
- public final double spatialEnergyUsage;
- private boolean preventTransition;
-
- /**
- * @param spatialIoLevel Level where the Spatial IO is located
- * @param spatialIoPos Position where the Spatial IO is located
- * @param EnergyUsage ( the amount of energy that the SpatialIO uses)
- */
- public GridSpatialEvent(Level spatialIoLevel,
- BlockPos spatialIoPos,
- double EnergyUsage) {
- this.spatialIoLevel = spatialIoLevel;
- this.spatialIoPos = spatialIoPos;
- this.spatialEnergyUsage = EnergyUsage;
- }
-
- /**
- * Prevent the Spatial IO transition from happening.
- */
- public void preventTransition() {
- this.preventTransition = true;
- }
-
- /**
- * @return True if the transition into the spatial IO should not be allowed.
- */
- public boolean isTransitionPrevented() {
- return preventTransition;
- }
-
-}
diff --git a/src/main/java/appeng/api/networking/spatial/ISpatialService.java b/src/main/java/appeng/api/networking/spatial/ISpatialService.java
deleted file mode 100644
index 70db6313a56..00000000000
--- a/src/main/java/appeng/api/networking/spatial/ISpatialService.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.networking.spatial;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.level.Level;
-
-import appeng.api.networking.IGridService;
-
-public interface ISpatialService extends IGridService {
-
- /**
- * @return true if a region is defined at all, it doesn't have to be valid, but all points must be in the same
- * level.
- */
- boolean hasRegion();
-
- /**
- * @return true if the region defined is valid according to all rules.
- */
- boolean isValidRegion();
-
- /**
- * @return The level that the spatial region is in.
- */
- Level getLevel();
-
- /**
- * @return the minimum anchor point for the spatial region.
- */
- BlockPos getMin();
-
- /**
- * @return the maximum anchor point for the spatial region.
- */
- BlockPos getMax();
-
- /**
- * @return how many AE units are required to preform the activation
- */
- long requiredPower();
-
- /**
- * @return current 100% - 0% efficiency.
- */
- float currentEfficiency();
-}
diff --git a/src/main/java/appeng/api/parts/IPartHost.java b/src/main/java/appeng/api/parts/IPartHost.java
index 5c1415392c0..d271e7f7104 100644
--- a/src/main/java/appeng/api/parts/IPartHost.java
+++ b/src/main/java/appeng/api/parts/IPartHost.java
@@ -44,12 +44,6 @@
* Do Not Implement
*/
public interface IPartHost extends ICustomCableConnection {
-
- /**
- * @return the facade container
- */
- IFacadeContainer getFacadeContainer();
-
/**
* Get a part attached to the host based on the location it's attached to.
*
diff --git a/src/main/java/appeng/api/parts/SelectedPart.java b/src/main/java/appeng/api/parts/SelectedPart.java
index ed254a6aaf9..04a263dfc89 100644
--- a/src/main/java/appeng/api/parts/SelectedPart.java
+++ b/src/main/java/appeng/api/parts/SelectedPart.java
@@ -38,11 +38,6 @@ public class SelectedPart {
*/
public final IPart part;
- /**
- * facade part.
- */
- public final IFacadePart facade;
-
/**
* side the part is mounted too, or null for cables.
*/
@@ -51,19 +46,11 @@ public class SelectedPart {
public SelectedPart() {
this.part = null;
- this.facade = null;
this.side = null;
}
public SelectedPart(IPart part, Direction side) {
this.part = part;
- this.facade = null;
- this.side = side;
- }
-
- public SelectedPart(IFacadePart facade, Direction side) {
- this.part = null;
- this.facade = facade;
this.side = side;
}
}
diff --git a/src/main/java/appeng/api/stacks/AEItemKey.java b/src/main/java/appeng/api/stacks/AEItemKey.java
index 592697ed812..b38b4db988e 100644
--- a/src/main/java/appeng/api/stacks/AEItemKey.java
+++ b/src/main/java/appeng/api/stacks/AEItemKey.java
@@ -1,9 +1,7 @@
package appeng.api.stacks;
-import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Objects;
-import java.util.WeakHashMap;
import org.jetbrains.annotations.Nullable;
@@ -26,16 +24,17 @@
public final class AEItemKey extends AEKey {
private final Item item;
- private final InternedTag internedTag;
+ @Nullable
+ private final CompoundTag tag;
private final int hashCode;
private final int cachedDamage;
- private AEItemKey(Item item, InternedTag internedTag) {
- super(Platform.getItemDisplayName(item, internedTag.tag));
+ private AEItemKey(Item item, @Nullable CompoundTag tag) {
+ super(Platform.getItemDisplayName(item, tag));
this.item = item;
- this.internedTag = internedTag;
- this.hashCode = item.hashCode() * 31 + internedTag.hashCode;
- if (internedTag.tag != null && internedTag.tag.get("Damage") instanceof NumericTag numericTag) {
+ this.tag = tag;
+ this.hashCode = Objects.hash(item, tag);
+ if (this.tag != null && tag.get("Damage") instanceof NumericTag numericTag) {
this.cachedDamage = numericTag.getAsInt();
} else {
this.cachedDamage = 0;
@@ -44,6 +43,7 @@ private AEItemKey(Item item, InternedTag internedTag) {
@Nullable
public static AEItemKey of(ItemVariant variant) {
+
if (variant.isBlank()) {
return null;
}
@@ -87,7 +87,8 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass())
return false;
AEItemKey aeItemKey = (AEItemKey) o;
- return item == aeItemKey.item && internedTag == aeItemKey.internedTag;
+ // The hash code comparison is a fast-fail for two objects with different NBT or items
+ return hashCode == aeItemKey.hashCode && item == aeItemKey.item && Objects.equals(tag, aeItemKey.tag);
}
@Override
@@ -100,11 +101,12 @@ public static AEItemKey of(ItemLike item) {
}
public static AEItemKey of(ItemLike item, @Nullable CompoundTag tag) {
- return new AEItemKey(item.asItem(), InternedTag.of(tag, false));
+ // Do a defensive copy of the tag if we're not sure that we can take ownership
+ return new AEItemKey(item.asItem(), tag != null ? tag.copy() : null);
}
public boolean matches(ItemStack stack) {
- return !stack.isEmpty() && stack.is(item) && Objects.equals(stack.getTag(), internedTag.tag);
+ return !stack.isEmpty() && stack.is(item) && Objects.equals(stack.getTag(), tag);
}
public ItemStack toStack() {
@@ -144,8 +146,8 @@ public CompoundTag toTag() {
CompoundTag result = new CompoundTag();
result.putString("id", Registry.ITEM.getKey(item).toString());
- if (internedTag.tag != null) {
- result.put("tag", internedTag.tag.copy());
+ if (tag != null) {
+ result.put("tag", tag.copy());
}
return result;
@@ -178,7 +180,7 @@ public ResourceLocation getId() {
}
public ItemVariant toVariant() {
- return ItemVariant.of(item, internedTag.tag);
+ return ItemVariant.of(item, tag);
}
/**
@@ -186,16 +188,16 @@ public ItemVariant toVariant() {
*/
@Nullable
public CompoundTag getTag() {
- return internedTag.tag;
+ return tag;
}
@Nullable
public CompoundTag copyTag() {
- return internedTag.tag != null ? internedTag.tag.copy() : null;
+ return tag != null ? tag.copy() : null;
}
public boolean hasTag() {
- return internedTag.tag != null;
+ return tag != null;
}
@Override
@@ -228,7 +230,7 @@ public boolean isTagged(TagKey> tag) {
* @return True if the item represented by this key is damaged.
*/
public boolean isDamaged() {
- return cachedDamage > 0;
+ return tag != null && tag.getInt(ItemStack.TAG_DAMAGE) > 0;
}
@Override
@@ -236,7 +238,7 @@ public void writeToPacket(FriendlyByteBuf data) {
data.writeVarInt(Item.getId(item));
CompoundTag compoundTag = null;
if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
- compoundTag = internedTag.tag;
+ compoundTag = tag;
}
data.writeNbt(compoundTag);
}
@@ -245,7 +247,7 @@ public static AEItemKey fromPacket(FriendlyByteBuf data) {
int i = data.readVarInt();
var item = Item.byId(i);
var tag = data.readNbt();
- return new AEItemKey(item, InternedTag.of(tag, true));
+ return new AEItemKey(item, tag);
}
@Override
@@ -253,63 +255,6 @@ public String toString() {
var id = Registry.ITEM.getKey(item);
String idString = id != Registry.ITEM.getDefaultKey() ? id.toString()
: item.getClass().getName() + "(unregistered)";
- return internedTag.tag == null ? idString : idString + " (+tag)";
- }
-
- private static final class InternedTag {
- private static final InternedTag EMPTY = new InternedTag(null);
-
- private static final WeakHashMap> INTERNED = new WeakHashMap<>();
-
- private final CompoundTag tag;
- private final int hashCode;
-
- InternedTag(CompoundTag tag) {
- this.tag = tag;
- this.hashCode = Objects.hashCode(tag);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- InternedTag internedTag = (InternedTag) o;
- return Objects.equals(tag, internedTag.tag);
- }
-
- @Override
- public int hashCode() {
- return hashCode;
- }
-
- public static InternedTag of(@Nullable CompoundTag tag, boolean giveOwnership) {
- if (tag == null) {
- return EMPTY;
- }
-
- synchronized (AEItemKey.class) {
- var searchHolder = new InternedTag(tag);
- var weakRef = INTERNED.get(searchHolder);
- InternedTag ret = null;
-
- if (weakRef != null) {
- ret = weakRef.get();
- }
-
- if (ret == null) {
- // Copy the tag if we don't get to have ownership of it
- if (giveOwnership) {
- ret = searchHolder;
- } else {
- ret = new InternedTag(tag.copy());
- }
- INTERNED.put(ret, new WeakReference<>(ret));
- }
-
- return ret;
- }
- }
+ return tag == null ? idString : idString + " (+tag)";
}
}
diff --git a/src/main/java/appeng/api/storage/StorageCells.java b/src/main/java/appeng/api/storage/StorageCells.java
deleted file mode 100644
index a6c59f4fe8b..00000000000
--- a/src/main/java/appeng/api/storage/StorageCells.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import com.google.common.base.Preconditions;
-
-import net.minecraft.world.item.ItemStack;
-
-import appeng.api.storage.cells.IBasicCellItem;
-import appeng.api.storage.cells.ICellGuiHandler;
-import appeng.api.storage.cells.ICellHandler;
-import appeng.api.storage.cells.ISaveProvider;
-import appeng.api.storage.cells.StorageCell;
-
-/**
- * Storage Cell Registry, used for specially implemented cells, if you just want to make a item act like a cell, or new
- * cell with different bytes, you should probably consider implementing {@link IBasicCellItem} on your item instead.
- */
-@ThreadSafe
-public final class StorageCells {
-
- private static final List handlers = new ArrayList<>();
- private static final List guiHandlers = new ArrayList<>();
-
- private StorageCells() {
- }
-
- /**
- * Register a new handler.
- *
- * Never be call before {@link net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent} was handled by AE2. Will
- * throw an exception otherwise.
- *
- * @param handler cell handler
- */
- public static synchronized void addCellHandler(ICellHandler handler) {
- Objects.requireNonNull(handler, "Called before FMLCommonSetupEvent.");
- Preconditions.checkArgument(!handlers.contains(handler),
- "Tried to register the same handler instance twice.");
-
- handlers.add(handler);
- }
-
- /**
- * Register a new handler
- *
- * @param handler cell gui handler
- */
- public static synchronized void addCellGuiHandler(ICellGuiHandler handler) {
- guiHandlers.add(handler);
- }
-
- /**
- * return true, if you can get a InventoryHandler for the item passed.
- *
- * @param is to be checked item
- * @return true if the provided item, can be handled by a handler in AE, ( AE May choose to skip this and just get
- * the handler instead. )
- */
- public static synchronized boolean isCellHandled(ItemStack is) {
- if (is.isEmpty()) {
- return false;
- }
- for (ICellHandler ch : handlers) {
- if (ch.isCell(is)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * get the handler, for the requested item.
- *
- * @param is to be checked item
- * @return the handler registered for this item type.
- */
- @Nullable
- public static synchronized ICellHandler getHandler(ItemStack is) {
- if (is.isEmpty()) {
- return null;
- }
- for (ICellHandler ch : handlers) {
- if (ch.isCell(is)) {
- return ch;
- }
- }
- return null;
- }
-
- /**
- * get the handler, for the requested channel.
- *
- * @param is ItemStack
- * @return the handler registered for this channel.
- */
- @Nullable
- public static synchronized ICellGuiHandler getGuiHandler(ItemStack is) {
- ICellGuiHandler fallBack = null;
-
- for (ICellGuiHandler ch : guiHandlers) {
- if (ch.isSpecializedFor(is)) {
- return ch;
- }
-
- if (fallBack == null) {
- fallBack = ch;
- }
- }
- return fallBack;
- }
-
- /**
- * Returns the inventory for the provided storage cell item by querying all registered handlers.
- *
- * @param is item with inventory handler
- * @param host can be null. If provided, the host is responsible for persisting the cell content.
- * @return The cell inventory, or null if there isn't one.
- */
- @Nullable
- public static synchronized StorageCell getCellInventory(ItemStack is, @Nullable ISaveProvider host) {
- if (is.isEmpty()) {
- return null;
- }
- for (var ch : handlers) {
- var inventory = ch.getCellInventory(is, host);
- if (inventory != null) {
- return inventory;
- }
- }
- return null;
- }
-
-}
diff --git a/src/main/java/appeng/api/storage/StorageHelper.java b/src/main/java/appeng/api/storage/StorageHelper.java
index 659cbd8ec13..f4be5fe6487 100644
--- a/src/main/java/appeng/api/storage/StorageHelper.java
+++ b/src/main/java/appeng/api/storage/StorageHelper.java
@@ -27,78 +27,50 @@
import com.google.common.primitives.Ints;
-import net.minecraft.nbt.CompoundTag;
import appeng.api.config.Actionable;
-import appeng.api.config.PowerMultiplier;
-import appeng.api.networking.crafting.ICraftingLink;
-import appeng.api.networking.crafting.ICraftingRequester;
-import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.IActionSource;
import appeng.api.stacks.AEItemKey;
import appeng.api.stacks.AEKey;
import appeng.core.stats.AeStats;
-import appeng.crafting.CraftingLink;
public final class StorageHelper {
private StorageHelper() {
}
/**
- * load a crafting link from nbt data.
+ * Extracts items from a {@link MEStorage}
*
- * @param data to be loaded data
- * @return crafting link
- */
- public static ICraftingLink loadCraftingLink(CompoundTag data, ICraftingRequester req) {
- Objects.requireNonNull(data);
- Objects.requireNonNull(req);
-
- return new CraftingLink(data, req);
- }
-
- /**
- * Extracts items from a {@link MEStorage} respecting power requirements.
- *
- * @param energy Energy source.
* @param inv Inventory to extract from.
* @param request Requested item and count.
* @param src Action source.
* @return extracted items or {@code null} of nothing was extracted.
*/
- public static long poweredExtraction(IEnergySource energy, MEStorage inv,
+ public static long extract(MEStorage inv,
AEKey request, long amount, IActionSource src) {
- return poweredExtraction(energy, inv, request, amount, src, Actionable.MODULATE);
+ return extract(inv, request, amount, src, Actionable.MODULATE);
}
/**
- * Extracts items from a {@link MEStorage} respecting power requirements.
+ * Extracts items from a {@link MEStorage}
*
- * @param energy Energy source.
* @param inv Inventory to extract from.
* @param request Requested item and count.
* @param src Action source.
* @param mode Simulate or modulate
* @return extracted items or {@code null} of nothing was extracted.
*/
- public static long poweredExtraction(IEnergySource energy, MEStorage inv,
+ public static long extract(MEStorage inv,
AEKey request, long amount, IActionSource src, Actionable mode) {
- Objects.requireNonNull(energy, "energy");
Objects.requireNonNull(inv, "inv");
Objects.requireNonNull(request, "request");
Objects.requireNonNull(src, "src");
Objects.requireNonNull(mode, "mode");
- var retrieved = inv.extract(request, amount, Actionable.SIMULATE, src);
-
- var energyFactor = Math.max(1.0, request.getAmountPerOperation());
- var availablePower = energy.extractAEPower(retrieved / energyFactor, Actionable.SIMULATE,
- PowerMultiplier.CONFIG);
- var itemToExtract = Math.min((long) (availablePower * energyFactor + 0.9), retrieved);
+ var itemToExtract = inv.extract(request, amount, Actionable.SIMULATE, src);
if (itemToExtract > 0) {
if (mode == Actionable.MODULATE) {
- energy.extractAEPower(retrieved / energyFactor, Actionable.MODULATE, PowerMultiplier.CONFIG);
var ret = inv.extract(request, itemToExtract, Actionable.MODULATE, src);
if (ret != 0 && request instanceof AEItemKey) {
@@ -116,32 +88,29 @@ public static long poweredExtraction(IEnergySource energy, MEStorage inv,
}
/**
- * Inserts items into a {@link MEStorage} respecting power requirements.
+ * Inserts items into a {@link MEStorage}
*
- * @param energy Energy source.
* @param inv Inventory to insert into.
* @param input Items to insert.
* @param src Action source.
* @return the number of items inserted.
*/
- public static long poweredInsert(IEnergySource energy, MEStorage inv,
+ public static long insert(MEStorage inv,
AEKey input, long amount, IActionSource src) {
- return poweredInsert(energy, inv, input, amount, src, Actionable.MODULATE);
+ return insert(inv, input, amount, src, Actionable.MODULATE);
}
/**
- * Inserts items into a {@link MEStorage} respecting power requirements.
+ * Inserts items into a {@link MEStorage}
*
- * @param energy Energy source.
* @param inv Inventory to insert into.
* @param input Items to insert.
* @param src Action source.
* @param mode Simulate or modulate
* @return the number of items inserted.
*/
- public static long poweredInsert(IEnergySource energy, MEStorage inv, AEKey input, long amount,
+ public static long insert(MEStorage inv, AEKey input, long amount,
IActionSource src, Actionable mode) {
- Objects.requireNonNull(energy);
Objects.requireNonNull(inv);
Objects.requireNonNull(input);
Objects.requireNonNull(src);
@@ -152,17 +121,7 @@ public static long poweredInsert(IEnergySource energy, MEStorage inv, AEKey inpu
return 0;
}
- final double energyFactor = Math.max(1.0, input.getAmountPerOperation());
- final double availablePower = energy.extractAEPower(amount / energyFactor, Actionable.SIMULATE,
- PowerMultiplier.CONFIG);
- amount = Math.min((long) (availablePower * energyFactor + 0.9), amount);
-
- if (amount <= 0) {
- return 0;
- }
-
if (mode == Actionable.MODULATE) {
- energy.extractAEPower(amount / energyFactor, Actionable.MODULATE, PowerMultiplier.CONFIG);
var inserted = inv.insert(input, amount, Actionable.MODULATE, src);
if (input instanceof AEItemKey) {
diff --git a/src/main/java/appeng/api/storage/cells/CellState.java b/src/main/java/appeng/api/storage/cells/CellState.java
deleted file mode 100644
index 21705ea6bb7..00000000000
--- a/src/main/java/appeng/api/storage/cells/CellState.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-/**
- * @author yueh
- */
-public enum CellState {
- /**
- * No cell at all
- */
- ABSENT(0),
-
- /**
- * A cell without anything stored
- */
- EMPTY(0x00FF00),
-
- /**
- * Stored something, but neither types nor totally full
- */
- NOT_EMPTY(0x00AAFF),
-
- /**
- * Available types exhausted
- */
- TYPES_FULL(0xFFAA00),
-
- /**
- * Full cell, technically could have free types
- */
- FULL(0xFF0000);
-
- /**
- * A color indicating this state.
- */
- private final int stateColor;
-
- CellState(int stateColor) {
- this.stateColor = stateColor;
- }
-
- /**
- * @return A color representative of this state. Used for the drive LEDs for example.
- */
- public int getStateColor() {
- return stateColor;
- }
-}
diff --git a/src/main/java/appeng/api/storage/cells/IBasicCellItem.java b/src/main/java/appeng/api/storage/cells/IBasicCellItem.java
deleted file mode 100644
index 1d100b5d7b2..00000000000
--- a/src/main/java/appeng/api/storage/cells/IBasicCellItem.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-import java.util.List;
-import java.util.Optional;
-
-import com.google.common.base.Preconditions;
-
-import net.minecraft.network.chat.Component;
-import net.minecraft.world.inventory.tooltip.TooltipComponent;
-import net.minecraft.world.item.ItemStack;
-
-import appeng.api.stacks.AEKey;
-import appeng.api.stacks.AEKeyType;
-import appeng.me.cells.BasicCellHandler;
-
-/**
- * Implement this on any item to register a "basic cell", which is a cell that works similarly to AE2's own item and
- * fluid cells. There is no need to register an {@link ICellHandler} for such an item. AE2 automatically handles the
- * internals and NBT data, which is both nice, and bad for you!
- *
- * The standard AE implementation also only provides 1-63 Types.
- */
-public interface IBasicCellItem extends ICellWorkbenchItem {
- /**
- * Basic cell items are limited to a single {@link AEKeyType}.
- */
- AEKeyType getKeyType();
-
- /**
- * The number of bytes that can be stored on this type of storage cell.
- *
- * It wont work if the return is not a multiple of 8. The limit is ({@link Integer#MAX_VALUE} + 1) / 8.
- *
- * @param cellItem item
- * @return number of bytes
- */
- int getBytes(ItemStack cellItem);
-
- /**
- * Determines the number of bytes used for any type included on the cell.
- *
- * @param cellItem item
- * @return number of bytes
- */
- int getBytesPerType(ItemStack cellItem);
-
- /**
- * Must be between 1 and 63, indicates how many types can be stored on this type of storage cell.
- *
- * @param cellItem item
- * @return number of types
- */
- int getTotalTypes(ItemStack cellItem);
-
- /**
- * Allows you to fine tune which items are allowed on a given cell, if you don't care, just return false; As the
- * handler for this type of cell is still the default cells, the normal AE black list is also applied.
- *
- * @param cellItem item
- * @param requestedAddition requested addition
- * @return true to preventAdditionOfItem
- */
- default boolean isBlackListed(ItemStack cellItem, AEKey requestedAddition) {
- return false;
- }
-
- /**
- * Allows you to specify if this storage cell can be stored inside other storage cells, only set this for special
- * items like the matter cannon that are not general purpose storage.
- *
- * @return true if the storage cell can be stored inside other storage cells, this is generally false, except for
- * certain situations such as the matter cannon.
- */
- default boolean storableInStorageCell() {
- return false;
- }
-
- /**
- * Allows an item to selectively enable or disable its status as a storage cell.
- *
- * @param i item
- * @return if the ItemStack should currently be usable as a storage cell.
- */
- default boolean isStorageCell(ItemStack i) {
- return true;
- }
-
- /**
- * @return drain in ae/t this storage cell will use.
- */
- double getIdleDrain();
-
- /**
- * Convenient helper to append useful tooltip information.
- */
- default void addCellInformationToTooltip(ItemStack is, List lines) {
- Preconditions.checkArgument(is.getItem() == this);
- BasicCellHandler.INSTANCE.addCellInformationToTooltip(is, lines);
- }
-
- /**
- * Helper to get the additional tooltip image line showing the content/filter/upgrades.
- */
- default Optional getCellTooltipImage(ItemStack is) {
- Preconditions.checkArgument(is.getItem() == this);
- return BasicCellHandler.INSTANCE.getTooltipImage(is);
- }
-}
diff --git a/src/main/java/appeng/api/storage/cells/ICellGuiHandler.java b/src/main/java/appeng/api/storage/cells/ICellGuiHandler.java
deleted file mode 100644
index f6ff42f0b44..00000000000
--- a/src/main/java/appeng/api/storage/cells/ICellGuiHandler.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2021 TeamAppliedEnergistics
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-
-import appeng.api.implementations.blockentities.IChestOrDrive;
-
-/**
- * This interface is used by the ME Chest to open the appropriate GUI when a storage cell is inserted into the chest,
- * and the player right-clicks the terminal screen on the chest. Since any storage cell may be inserted into the chest,
- * this can potentially open a terminal screen provided by an addon, and this interface allows addons to facilitate
- * that.
- *
- * @see appeng.api.storage.StorageCells
- */
-public interface ICellGuiHandler {
- /**
- * Return true to prioritize this handler for the provided {@link ItemStack}.
- *
- * @param cell Cell ItemStack
- * @return True, if specialized else false.
- */
- boolean isSpecializedFor(ItemStack cell);
-
- /**
- * Called when the storage cell is placed in an ME Chest and the user tries to open the terminal side, if your item
- * is not available via ME Chests simply tell the user they can't use it, or something, otherwise you should open
- * your gui and display the cell to the user.
- *
- * @param player player opening chest gui
- * @param chest to be opened chest
- * @param cellHandler cell handler
- * @param cell the storage cell
- */
- void openChestGui(Player player, IChestOrDrive chest, ICellHandler cellHandler, ItemStack cell);
-}
diff --git a/src/main/java/appeng/api/storage/cells/ICellHandler.java b/src/main/java/appeng/api/storage/cells/ICellHandler.java
deleted file mode 100644
index 1b85b795852..00000000000
--- a/src/main/java/appeng/api/storage/cells/ICellHandler.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.world.item.ItemStack;
-
-/**
- * Implementations of this interface provide AE2 with a way to interact with storage cells that may be represented by
- * arbitrary {@link ItemStack}
- *
- * @see appeng.api.storage.StorageCells
- */
-public interface ICellHandler {
-
- /**
- * return true if the provided item is handled by your cell handler. ( AE May choose to skip this method, and just
- * request a handler )
- *
- * @param is to be checked item
- * @return return true, if getCellHandler will not return null.
- */
- boolean isCell(ItemStack is);
-
- /**
- * Returns the cell's inventory or null if the item stack is not handled by this handler, or it currently doesn't
- * want to act as a storage cell.
- *
- * @param is a storage cell item.
- * @param host anytime the contents of your storage cell changes it should use this to request a save, please note,
- * this value can be null. If provided, the host is responsible for persisting the cell content.
- * @return The cell inventory or null if the stack is not a cell supported by this handler.
- */
- @Nullable
- StorageCell getCellInventory(ItemStack is, @Nullable ISaveProvider host);
-
-}
diff --git a/src/main/java/appeng/api/storage/cells/ICellWorkbenchItem.java b/src/main/java/appeng/api/storage/cells/ICellWorkbenchItem.java
deleted file mode 100644
index 19b2a38da59..00000000000
--- a/src/main/java/appeng/api/storage/cells/ICellWorkbenchItem.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-import net.minecraft.world.item.ItemStack;
-
-import appeng.api.config.FuzzyMode;
-import appeng.api.upgrades.IUpgradeableItem;
-import appeng.util.ConfigInventory;
-
-public interface ICellWorkbenchItem extends IUpgradeableItem {
- /**
- * Determines whether or not the item should be treated as a cell and allow for configuration via a cell workbench.
- * By default, any such item with either a filtering or upgrade inventory is thus assumed to be editable.
- *
- * @param is item
- * @return true if the item should be editable in the cell workbench.
- */
- default boolean isEditable(ItemStack is) {
- return getConfigInventory(is).size() > 0 || getUpgrades(is).size() > 0;
- }
-
- /**
- * Used to extract, or mirror the contents of the work bench onto the cell.
- *
- * This should not exceed 63 slots. Any more than that might cause issues.
- *
- * onInventoryChange will be called when saving is needed.
- */
- default ConfigInventory getConfigInventory(ItemStack is) {
- return ConfigInventory.EMPTY_TYPES;
- }
-
- /**
- * @return the current fuzzy status.
- */
- FuzzyMode getFuzzyMode(ItemStack is);
-
- /**
- * sets the setting on the cell.
- */
- void setFuzzyMode(ItemStack is, FuzzyMode fzMode);
-}
diff --git a/src/main/java/appeng/api/storage/cells/ISaveProvider.java b/src/main/java/appeng/api/storage/cells/ISaveProvider.java
deleted file mode 100644
index 533093141a1..00000000000
--- a/src/main/java/appeng/api/storage/cells/ISaveProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-/**
- * Tells the cell provider that changes have been made and the cell must be persisted
- */
-@FunctionalInterface
-public interface ISaveProvider {
- /**
- * Cell has changed and needs to be persisted.
- */
- void saveChanges();
-}
diff --git a/src/main/java/appeng/api/storage/cells/StorageCell.java b/src/main/java/appeng/api/storage/cells/StorageCell.java
deleted file mode 100644
index 61b71a78bd0..00000000000
--- a/src/main/java/appeng/api/storage/cells/StorageCell.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2013 AlgorithmX2
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package appeng.api.storage.cells;
-
-import appeng.api.storage.MEStorage;
-
-/**
- * Represents the most general possible cell inventory. Register a {@link ICellHandler} to provide custom subclasses.
- */
-public interface StorageCell extends MEStorage {
- /**
- * Return the current status of the cell.
- */
- CellState getStatus();
-
- /**
- * Return the idle drain of the cell: how many AE/t it uses passively.
- */
- double getIdleDrain();
-
- /**
- * Tells the cell to persist to NBT.
- */
- void persist();
-}
diff --git a/src/main/java/appeng/api/upgrades/Upgrades.java b/src/main/java/appeng/api/upgrades/Upgrades.java
index 95535663bdd..1d476976ccc 100644
--- a/src/main/java/appeng/api/upgrades/Upgrades.java
+++ b/src/main/java/appeng/api/upgrades/Upgrades.java
@@ -22,7 +22,6 @@
import appeng.core.localization.GuiText;
import appeng.core.localization.Tooltips;
-import appeng.items.materials.EnergyCardItem;
import appeng.items.materials.UpgradeCardItem;
/**
@@ -90,20 +89,6 @@ public static synchronized int getMaxInstallable(ItemLike card, ItemLike upgrada
return 0;
}
- /**
- * Returns a cumulative energy multiplier based on the amount of "energy cards" fitted onto a tool. Returns 0 if no
- * such cards exist within the tool's upgrade inventory.
- */
- public static int getEnergyCardMultiplier(IUpgradeInventory upgrades) {
- int multiplier = 0;
- for (var card : upgrades) {
- if (card.getItem() instanceof EnergyCardItem ec) {
- multiplier += ec.getEnergyMultiplier();
- }
- }
- return multiplier;
- }
-
/**
* Creates a new upgrade item which can be used to receive automated tooltips and allow custom upgrades to be added
* to AE2's toolbelt in the network tool.
diff --git a/src/main/java/appeng/block/AEBaseBlockItem.java b/src/main/java/appeng/block/AEBaseBlockItem.java
index 2fd0320d38b..aa613c93787 100644
--- a/src/main/java/appeng/block/AEBaseBlockItem.java
+++ b/src/main/java/appeng/block/AEBaseBlockItem.java
@@ -36,7 +36,6 @@
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
-import appeng.block.misc.LightDetectorBlock;
import appeng.block.networking.WirelessBlock;
import appeng.blockentity.AEBaseBlockEntity;
@@ -80,14 +79,7 @@ public InteractionResult place(BlockPlaceContext context) {
Player player = context.getPlayer();
if (this.blockType instanceof AEBaseEntityBlock) {
- if (this.blockType instanceof LightDetectorBlock) {
- up = side;
- if (up == Direction.UP || up == Direction.DOWN) {
- forward = Direction.SOUTH;
- } else {
- forward = Direction.UP;
- }
- } else if (this.blockType instanceof WirelessBlock) {
+ if (this.blockType instanceof WirelessBlock) {
forward = side;
if (forward == Direction.UP || forward == Direction.DOWN) {
up = Direction.SOUTH;
@@ -129,7 +121,7 @@ public InteractionResult place(BlockPlaceContext context) {
return result;
}
- if (this.blockType instanceof AEBaseEntityBlock && !(this.blockType instanceof LightDetectorBlock)) {
+ if (this.blockType instanceof AEBaseEntityBlock) {
final AEBaseBlockEntity blockEntity = ((AEBaseEntityBlock>) this.blockType).getBlockEntity(
context.getLevel(),
context.getClickedPos());
diff --git a/src/main/java/appeng/block/AEBaseEntityBlock.java b/src/main/java/appeng/block/AEBaseEntityBlock.java
index a67f5ee0ddf..8eb8e541c2c 100644
--- a/src/main/java/appeng/block/AEBaseEntityBlock.java
+++ b/src/main/java/appeng/block/AEBaseEntityBlock.java
@@ -51,7 +51,6 @@
import appeng.block.networking.CableBusBlock;
import appeng.blockentity.AEBaseBlockEntity;
import appeng.blockentity.AEBaseInvBlockEntity;
-import appeng.items.tools.MemoryCardItem;
import appeng.util.InteractionUtil;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
@@ -193,37 +192,6 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player
ItemStack heldItem;
if (player != null && !player.getItemInHand(hand).isEmpty()) {
heldItem = player.getItemInHand(hand);
-
- if (heldItem.getItem() instanceof IMemoryCard memoryCard && !(this instanceof CableBusBlock)) {
- final AEBaseBlockEntity blockEntity = this.getBlockEntity(level, pos);
-
- if (blockEntity == null) {
- return InteractionResult.FAIL;
- }
-
- final String name = this.getDescriptionId();
-
- if (InteractionUtil.isInAlternateUseMode(player)) {
- var data = new CompoundTag();
- blockEntity.exportSettings(SettingsFrom.MEMORY_CARD, data, player);
- if (!data.isEmpty()) {
- memoryCard.setMemoryCardContents(heldItem, name, data);
- memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_SAVED);
- }
- } else {
- final String savedName = memoryCard.getSettingsName(heldItem);
- final CompoundTag data = memoryCard.getData(heldItem);
-
- if (this.getDescriptionId().equals(savedName)) {
- blockEntity.importSettings(SettingsFrom.MEMORY_CARD, data, player);
- memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
- } else {
- MemoryCardItem.importGenericSettingsAndNotify(blockEntity, data, player);
- }
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
}
return this.onActivated(level, pos, player, hand, player.getItemInHand(hand), hit);
diff --git a/src/main/java/appeng/block/crafting/AbstractCraftingUnitBlock.java b/src/main/java/appeng/block/crafting/AbstractCraftingUnitBlock.java
deleted file mode 100644
index 28b1897a9df..00000000000
--- a/src/main/java/appeng/block/crafting/AbstractCraftingUnitBlock.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.crafting.CraftingBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.locator.MenuLocators;
-import appeng.menu.me.crafting.CraftingCPUMenu;
-import appeng.util.InteractionUtil;
-
-public abstract class AbstractCraftingUnitBlock extends AEBaseEntityBlock {
- public static final BooleanProperty FORMED = BooleanProperty.create("formed");
- public static final BooleanProperty POWERED = BooleanProperty.create("powered");
-
- public final ICraftingUnitType type;
-
- public AbstractCraftingUnitBlock(BlockBehaviour.Properties props, ICraftingUnitType type) {
- super(props);
- this.type = type;
- this.registerDefaultState(defaultBlockState().setValue(FORMED, false).setValue(POWERED, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- builder.add(FORMED);
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn,
- BlockPos fromPos, boolean isMoving) {
- final CraftingBlockEntity cp = this.getBlockEntity(level, pos);
- if (cp != null) {
- cp.updateMultiBlock(fromPos);
- }
- }
-
- @Override
- public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
- if (newState.getBlock() == state.getBlock()) {
- return; // Just a block state change
- }
-
- final CraftingBlockEntity cp = this.getBlockEntity(level, pos);
- if (cp != null) {
- cp.breakCluster();
- }
-
- super.onRemove(state, level, pos, newState, isMoving);
- }
-
- @Override
- public InteractionResult use(BlockState state, Level level, BlockPos pos, Player p, InteractionHand hand,
- BlockHitResult hit) {
- final CraftingBlockEntity tg = this.getBlockEntity(level, pos);
-
- if (tg != null && !InteractionUtil.isInAlternateUseMode(p) && tg.isFormed() && tg.isActive()) {
- if (!level.isClientSide()) {
- hit.getDirection();
- MenuOpener.open(CraftingCPUMenu.TYPE, p,
- MenuLocators.forBlockEntity(tg));
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- return super.use(state, level, pos, p, hand, hit);
- }
-}
diff --git a/src/main/java/appeng/block/crafting/CraftingBlockItem.java b/src/main/java/appeng/block/crafting/CraftingBlockItem.java
deleted file mode 100644
index 59ce08a9800..00000000000
--- a/src/main/java/appeng/block/crafting/CraftingBlockItem.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-import java.util.function.Supplier;
-
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResultHolder;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.ItemLike;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-
-import appeng.block.AEBaseBlockItem;
-import appeng.core.AEConfig;
-import appeng.core.definitions.AEBlocks;
-import appeng.util.InteractionUtil;
-
-/**
- * Item that allows uncrafting CPU parts by disassembling them back into the crafting unit and the extra item.
- */
-public class CraftingBlockItem extends AEBaseBlockItem {
- /**
- * This can be retrieved when disassembling the crafting unit.
- */
- protected final Supplier disassemblyExtra;
-
- public CraftingBlockItem(Block id, Item.Properties props, Supplier disassemblyExtra) {
- super(id, props);
- this.disassemblyExtra = disassemblyExtra;
- }
-
- @Override
- public InteractionResultHolder use(Level level, Player player, InteractionHand hand) {
- if (AEConfig.instance().isDisassemblyCraftingEnabled() && InteractionUtil.isInAlternateUseMode(player)) {
- int itemCount = player.getItemInHand(hand).getCount();
- player.setItemInHand(hand, ItemStack.EMPTY);
-
- player.getInventory().placeItemBackInInventory(AEBlocks.CRAFTING_UNIT.stack(itemCount));
- player.getInventory().placeItemBackInInventory(new ItemStack(disassemblyExtra.get(), itemCount));
-
- return InteractionResultHolder.sidedSuccess(player.getItemInHand(hand), level.isClientSide());
- }
- return super.use(level, player, hand);
- }
-
- private void disassemble(ItemStack stack, Player player) {
- }
-}
diff --git a/src/main/java/appeng/block/crafting/CraftingMonitorBlock.java b/src/main/java/appeng/block/crafting/CraftingMonitorBlock.java
deleted file mode 100644
index b13c6f8eef7..00000000000
--- a/src/main/java/appeng/block/crafting/CraftingMonitorBlock.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-import net.minecraft.world.level.block.state.BlockBehaviour;
-
-import appeng.blockentity.crafting.CraftingMonitorBlockEntity;
-
-public class CraftingMonitorBlock extends AbstractCraftingUnitBlock {
- public CraftingMonitorBlock(BlockBehaviour.Properties props, ICraftingUnitType type) {
- super(props, type);
- }
-}
diff --git a/src/main/java/appeng/block/crafting/CraftingUnitBlock.java b/src/main/java/appeng/block/crafting/CraftingUnitBlock.java
deleted file mode 100644
index bd6c495ca1f..00000000000
--- a/src/main/java/appeng/block/crafting/CraftingUnitBlock.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-import net.minecraft.world.level.block.state.BlockBehaviour;
-
-import appeng.blockentity.crafting.CraftingBlockEntity;
-
-public class CraftingUnitBlock extends AbstractCraftingUnitBlock {
-
- public CraftingUnitBlock(BlockBehaviour.Properties props, ICraftingUnitType type) {
- super(props, type);
- }
-
-}
diff --git a/src/main/java/appeng/block/crafting/CraftingUnitType.java b/src/main/java/appeng/block/crafting/CraftingUnitType.java
deleted file mode 100644
index f526f3fedae..00000000000
--- a/src/main/java/appeng/block/crafting/CraftingUnitType.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package appeng.block.crafting;
-
-import net.minecraft.world.item.Item;
-
-import appeng.core.definitions.AEBlocks;
-
-public enum CraftingUnitType implements ICraftingUnitType {
- UNIT(0),
- ACCELERATOR(0),
- STORAGE_1K(1),
- STORAGE_4K(4),
- STORAGE_16K(16),
- STORAGE_64K(64),
- STORAGE_256K(256),
- MONITOR(0);
-
- private final int storageKb;
-
- CraftingUnitType(int storageKb) {
- this.storageKb = storageKb;
- }
-
- @Override
- public long getStorageBytes() {
- return 1024L * this.storageKb;
- }
-
- @Override
- public int getAcceleratorThreads() {
- return this == ACCELERATOR ? 1 : 0;
- }
-
- @Override
- public Item getItemFromType() {
- var definition = switch (this) {
- case UNIT -> AEBlocks.CRAFTING_UNIT;
- case ACCELERATOR -> AEBlocks.CRAFTING_ACCELERATOR;
- case STORAGE_1K -> AEBlocks.CRAFTING_STORAGE_1K;
- case STORAGE_4K -> AEBlocks.CRAFTING_STORAGE_4K;
- case STORAGE_16K -> AEBlocks.CRAFTING_STORAGE_16K;
- case STORAGE_64K -> AEBlocks.CRAFTING_STORAGE_64K;
- case STORAGE_256K -> AEBlocks.CRAFTING_STORAGE_256K;
- case MONITOR -> AEBlocks.CRAFTING_MONITOR;
- };
- return definition.asItem();
- }
-}
diff --git a/src/main/java/appeng/block/crafting/ICraftingUnitType.java b/src/main/java/appeng/block/crafting/ICraftingUnitType.java
deleted file mode 100644
index 6fc4c542db6..00000000000
--- a/src/main/java/appeng/block/crafting/ICraftingUnitType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package appeng.block.crafting;
-
-import net.minecraft.world.item.Item;
-
-/**
- * Implemented by classes/enums meant to provide their own types of crafting CPU blocks.
- */
-public interface ICraftingUnitType {
-
- /**
- * @return the capacity of a given crafting storage block in bytes (should be 0 if not storage).
- */
- long getStorageBytes();
-
- /**
- * @return how many co-processors a crafting unit provides. For lag-mitigation purposes, a hard-coded limit has been
- * set of 16 threads for any given co-processing unit block.
- */
- int getAcceleratorThreads();
-
- /**
- * @return the BlockItem for the crafting storage block corresponding with its type for block-entity purposes.
- */
- Item getItemFromType();
-}
diff --git a/src/main/java/appeng/block/crafting/MolecularAssemblerBlock.java b/src/main/java/appeng/block/crafting/MolecularAssemblerBlock.java
deleted file mode 100644
index 15407ba0177..00000000000
--- a/src/main/java/appeng/block/crafting/MolecularAssemblerBlock.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.crafting.MolecularAssemblerBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.MolecularAssemblerMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class MolecularAssemblerBlock extends AEBaseEntityBlock {
-
- public static final BooleanProperty POWERED = BooleanProperty.create("powered");
-
- public MolecularAssemblerBlock(BlockBehaviour.Properties props) {
- super(props);
- registerDefaultState(defaultBlockState().setValue(POWERED, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, MolecularAssemblerBlockEntity be) {
- return currentState.setValue(POWERED, be.isPowered());
- }
-
- @Override
- public InteractionResult use(BlockState state, Level level, BlockPos pos, Player p, InteractionHand hand,
- BlockHitResult hit) {
- final MolecularAssemblerBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null && !InteractionUtil.isInAlternateUseMode(p)) {
- if (!level.isClientSide()) {
- hit.getDirection();
- MenuOpener.open(MolecularAssemblerMenu.TYPE, p,
- MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- return super.use(state, level, pos, p, hand, hit);
- }
-
-}
diff --git a/src/main/java/appeng/block/crafting/PatternProviderBlock.java b/src/main/java/appeng/block/crafting/PatternProviderBlock.java
deleted file mode 100644
index 10547841a41..00000000000
--- a/src/main/java/appeng/block/crafting/PatternProviderBlock.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.api.util.IOrientable;
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.crafting.PatternProviderBlockEntity;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class PatternProviderBlock extends AEBaseEntityBlock {
-
- private static final BooleanProperty OMNIDIRECTIONAL = BooleanProperty.create("omnidirectional");
-
- public PatternProviderBlock() {
- super(defaultProps(Material.METAL));
- registerDefaultState(defaultBlockState().setValue(OMNIDIRECTIONAL, true));
- }
-
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(OMNIDIRECTIONAL);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, PatternProviderBlockEntity be) {
- return currentState.setValue(OMNIDIRECTIONAL, be.isOmniDirectional());
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos,
- boolean isMoving) {
- var be = this.getBlockEntity(level, pos);
- if (be != null) {
- be.getLogic().updateRedstoneState();
- }
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- var be = this.getBlockEntity(level, pos);
- if (be != null) {
- if (!level.isClientSide()) {
- be.openMenu(p, MenuLocators.forBlockEntity(be));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-
- @Override
- protected boolean hasCustomRotation() {
- return true;
- }
-
- @Override
- protected void customRotateBlock(IOrientable rotatable, Direction axis) {
- if (rotatable instanceof PatternProviderBlockEntity patternProvider) {
- patternProvider.setSide(axis);
- }
- }
-}
diff --git a/src/main/java/appeng/block/misc/CellWorkbenchBlock.java b/src/main/java/appeng/block/misc/CellWorkbenchBlock.java
deleted file mode 100644
index d5e7709f372..00000000000
--- a/src/main/java/appeng/block/misc/CellWorkbenchBlock.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.CellWorkbenchBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.CellWorkbenchMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class CellWorkbenchBlock extends AEBaseEntityBlock {
-
- public CellWorkbenchBlock() {
- super(defaultProps(Material.METAL));
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- final CellWorkbenchBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null) {
- if (!level.isClientSide()) {
- MenuOpener.open(CellWorkbenchMenu.TYPE, p, MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-}
diff --git a/src/main/java/appeng/block/misc/ChargerBlock.java b/src/main/java/appeng/block/misc/ChargerBlock.java
deleted file mode 100644
index 66b0c8e7c05..00000000000
--- a/src/main/java/appeng/block/misc/ChargerBlock.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import com.mojang.math.Vector3f;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.client.Minecraft;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.util.Mth;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.BlockHitResult;
-import net.minecraft.world.phys.Vec3;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.api.util.AEAxisAlignedBB;
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.ChargerBlockEntity;
-import appeng.client.render.FacingToRotation;
-import appeng.client.render.effects.LightningArcParticleData;
-import appeng.core.AEConfig;
-import appeng.core.AppEngClient;
-import appeng.util.InteractionUtil;
-
-public class ChargerBlock extends AEBaseEntityBlock {
-
- public ChargerBlock() {
- super(defaultProps(Material.METAL).noOcclusion());
- }
-
- @Override
- public int getLightBlock(BlockState state, BlockGetter level, BlockPos pos) {
- return 2; // FIXME Double check this (esp. value range)
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player player,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(player)) {
- return InteractionResult.PASS;
- }
-
- if (!level.isClientSide()) {
- final ChargerBlockEntity tc = this.getBlockEntity(level, pos);
- if (tc != null) {
- tc.activate(player);
- }
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource r) {
- if (!AEConfig.instance().isEnableEffects()) {
- return;
- }
-
- var blockEntity = this.getBlockEntity(level, pos);
- if (blockEntity != null && blockEntity.isWorking()) {
- if (r.nextFloat() < 0.5) {
- return;
- }
-
- var rotation = FacingToRotation.get(blockEntity.getForward(), blockEntity.getUp());
-
- for (int bolts = 0; bolts < 3; bolts++) {
- // Slightly offset the lightning arc on the x/z plane
- var xOff = Mth.randomBetween(r, -0.15f, 0.15f);
- var zOff = Mth.randomBetween(r, -0.15f, 0.15f);
-
- // Compute two points in the charger block. One at the bottom, and one on the top.
- // Account for the rotation while doing this.
- var center = new Vector3f(pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f);
- var origin = new Vector3f(xOff, -0.3f, zOff);
- origin.transform(rotation.getRot());
- origin.add(center);
- var target = new Vector3f(xOff, 0.3f, zOff);
- target.transform(rotation.getRot());
- target.add(center);
-
- // Split the arcs between arc coming from the top/bottom of the charger since it's symmetrical
- if (r.nextBoolean()) {
- var tmp = target;
- target = origin;
- origin = tmp;
- }
-
- if (AppEngClient.instance().shouldAddParticles(r)) {
- Minecraft.getInstance().particleEngine.createParticle(
- new LightningArcParticleData(new Vec3(target)),
- origin.x(),
- origin.y(),
- origin.z(),
- 0.0, 0.0, 0.0);
- }
- }
- }
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
-
- final ChargerBlockEntity blockEntity = this.getBlockEntity(level, pos);
- if (blockEntity != null) {
- final double twoPixels = 2.0 / 16.0;
- final Direction up = blockEntity.getUp();
- final Direction forward = blockEntity.getForward();
- final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels,
- 1.0 - twoPixels, 1.0 - twoPixels);
-
- if (up.getStepX() != 0) {
- bb.minX = 0;
- bb.maxX = 1;
- }
- if (up.getStepY() != 0) {
- bb.minY = 0;
- bb.maxY = 1;
- }
- if (up.getStepZ() != 0) {
- bb.minZ = 0;
- bb.maxZ = 1;
- }
-
- switch (forward) {
- case DOWN:
- bb.maxY = 1;
- break;
- case UP:
- bb.minY = 0;
- break;
- case NORTH:
- bb.maxZ = 1;
- break;
- case SOUTH:
- bb.minZ = 0;
- break;
- case EAST:
- bb.minX = 0;
- break;
- case WEST:
- bb.maxX = 1;
- break;
- default:
- break;
- }
-
- return Shapes.create(bb.getBoundingBox());
- }
- return Shapes.create(new AABB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
- }
-
- @Override
- public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos,
- CollisionContext context) {
- return Shapes.create(new AABB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
- }
-
-}
diff --git a/src/main/java/appeng/block/misc/CondenserBlock.java b/src/main/java/appeng/block/misc/CondenserBlock.java
deleted file mode 100644
index e4e6dda288b..00000000000
--- a/src/main/java/appeng/block/misc/CondenserBlock.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.CondenserBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.CondenserMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class CondenserBlock extends AEBaseEntityBlock {
-
- public CondenserBlock() {
- super(defaultProps(Material.METAL));
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player player,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(player)) {
- return InteractionResult.PASS;
- }
-
- if (!level.isClientSide()) {
- final CondenserBlockEntity tc = this.getBlockEntity(level, pos);
- if (tc != null && !InteractionUtil.isInAlternateUseMode(player)) {
- hit.getDirection();
- MenuOpener.open(CondenserMenu.TYPE, player,
- MenuLocators.forBlockEntity(tc));
- }
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-}
diff --git a/src/main/java/appeng/block/misc/CrankBlock.java b/src/main/java/appeng/block/misc/CrankBlock.java
deleted file mode 100644
index 893ed7345a1..00000000000
--- a/src/main/java/appeng/block/misc/CrankBlock.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import org.jetbrains.annotations.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.LivingEntity;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.LevelReader;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.RenderShape;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.BlockHitResult;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.api.implementations.blockentities.ICrankable;
-import appeng.api.util.IOrientableBlock;
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.CrankBlockEntity;
-import appeng.util.FakePlayer;
-
-public class CrankBlock extends AEBaseEntityBlock implements IOrientableBlock {
-
- public CrankBlock(Properties props) {
- super(props);
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player player, InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (player instanceof FakePlayer || player == null) {
- this.dropCrank(level, pos);
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- var crank = this.getBlockEntity(level, pos);
- if (crank != null) {
- crank.power();
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- return InteractionResult.PASS;
- }
-
- private void dropCrank(Level level, BlockPos pos) {
- level.destroyBlock(pos, true);
- level.sendBlockUpdated(pos, defaultBlockState(), level.getBlockState(pos), 3);
- }
-
- @Override
- public void setPlacedBy(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack is) {
- super.setPlacedBy(level, pos, state, placer, is);
-
- var be = getBlockEntity(level, pos);
- if (be != null) {
- var mnt = this.findCrankableDirection(level, pos);
- if (mnt == null) {
- dropCrank(level, pos);
- return;
- }
-
- Direction forward = Direction.UP;
- if (mnt == Direction.UP || mnt == Direction.DOWN) {
- forward = Direction.SOUTH;
- }
- be.setOrientation(forward, mnt.getOpposite());
- } else {
- dropCrank(level, pos);
- }
- }
-
- @Override
- protected boolean isValidOrientation(LevelAccessor levelAccessor, BlockPos pos, Direction forward, Direction up) {
- if (levelAccessor instanceof Level level) {
- var be = level.getBlockEntity(pos);
- return !(be instanceof CrankBlockEntity) || isCrankable(level, pos, up.getOpposite());
- } else {
- return true;
- }
- }
-
- private Direction findCrankableDirection(Level level, BlockPos pos) {
- for (var dir : Direction.values()) {
- if (isCrankable(level, pos, dir)) {
- return dir;
- }
- }
- return null;
- }
-
- private boolean isCrankable(Level level, BlockPos pos, Direction offset) {
- var o = pos.relative(offset);
- return ICrankable.get(level, o, offset.getOpposite()) != null;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public RenderShape getRenderShape(BlockState state) {
- return RenderShape.ENTITYBLOCK_ANIMATED;
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- var be = this.getBlockEntity(level, pos);
- if (be != null) {
- if (!isCrankable(level, pos, be.getUp().getOpposite())) {
- dropCrank(level, pos);
- }
- } else {
- dropCrank(level, pos);
- }
- }
-
- @Override
- public boolean canSurvive(BlockState state, LevelReader levelReader, BlockPos pos) {
- if (levelReader instanceof Level level) {
- return findCrankableDirection(level, pos) != null;
- } else {
- return true;
- }
- }
-
- private Direction getUp(BlockGetter level, BlockPos pos) {
- var crank = getBlockEntity(level, pos);
- return crank != null ? crank.getUp() : null;
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- Direction up = getUp(level, pos);
-
- if (up == null) {
- return Shapes.empty();
- } else {
- // FIXME: Cache per direction, and build it 'precise', not just from AABB
- final double xOff = -0.15 * up.getStepX();
- final double yOff = -0.15 * up.getStepY();
- final double zOff = -0.15 * up.getStepZ();
- return Shapes.create(
- new AABB(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85));
- }
-
- }
-}
diff --git a/src/main/java/appeng/block/misc/InscriberBlock.java b/src/main/java/appeng/block/misc/InscriberBlock.java
deleted file mode 100644
index 68927b8c8cb..00000000000
--- a/src/main/java/appeng/block/misc/InscriberBlock.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.context.BlockPlaceContext;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.SimpleWaterloggedBlock;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.BlockStateProperties;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.FluidState;
-import net.minecraft.world.level.material.Fluids;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.InscriberBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.InscriberMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class InscriberBlock extends AEBaseEntityBlock implements SimpleWaterloggedBlock {
-
- private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
-
- public InscriberBlock(BlockBehaviour.Properties props) {
- super(props);
- this.registerDefaultState(this.defaultBlockState().setValue(WATERLOGGED, false));
- }
-
- @Override
- public int getLightBlock(BlockState state, BlockGetter level, BlockPos pos) {
- return 2; // FIXME validate this. a) possibly not required because of getShape b) value
- // range. was 2 in 1.10
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (!InteractionUtil.isInAlternateUseMode(p)) {
- final InscriberBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null) {
- if (!level.isClientSide()) {
- hit.getDirection();
- MenuOpener.open(InscriberMenu.TYPE, p,
- MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- }
- return InteractionResult.PASS;
-
- }
-
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(WATERLOGGED);
- }
-
- @Override
- @Nullable
- public BlockState getStateForPlacement(BlockPlaceContext context) {
- BlockPos pos = context.getClickedPos();
- FluidState fluidState = context.getLevel().getFluidState(pos);
- BlockState blockState = this.defaultBlockState()
- .setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER);
-
- return blockState;
- }
-
- @Override
- public FluidState getFluidState(BlockState blockState) {
- return blockState.getValue(WATERLOGGED).booleanValue()
- ? Fluids.WATER.getSource(false)
- : super.getFluidState(blockState);
- }
-
- @Override
- public BlockState updateShape(BlockState blockState, Direction facing, BlockState facingState, LevelAccessor level,
- BlockPos currentPos, BlockPos facingPos) {
- if (blockState.getValue(WATERLOGGED).booleanValue()) {
- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
- }
-
- return super.updateShape(blockState, facing, facingState, level, currentPos, facingPos);
- }
-
-}
diff --git a/src/main/java/appeng/block/misc/InterfaceBlock.java b/src/main/java/appeng/block/misc/InterfaceBlock.java
deleted file mode 100644
index 1d9e9a632f2..00000000000
--- a/src/main/java/appeng/block/misc/InterfaceBlock.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.InterfaceBlockEntity;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class InterfaceBlock extends AEBaseEntityBlock {
- public InterfaceBlock() {
- super(defaultProps(Material.METAL));
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- var be = this.getBlockEntity(level, pos);
- if (be != null) {
- if (!level.isClientSide()) {
- hit.getDirection();
- be.openMenu(p, MenuLocators.forBlockEntity(be));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-}
diff --git a/src/main/java/appeng/block/misc/LightDetectorBlock.java b/src/main/java/appeng/block/misc/LightDetectorBlock.java
deleted file mode 100644
index dea3b2302c9..00000000000
--- a/src/main/java/appeng/block/misc/LightDetectorBlock.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.item.context.BlockPlaceContext;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.LevelReader;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BlockStateProperties;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.FluidState;
-import net.minecraft.world.level.material.Fluids;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.api.util.IOrientable;
-import appeng.api.util.IOrientableBlock;
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.LightDetectorBlockEntity;
-import appeng.helpers.AEMaterials;
-import appeng.helpers.MetaRotation;
-import appeng.hooks.INeighborChangeSensitive;
-
-public class LightDetectorBlock extends AEBaseEntityBlock
- implements IOrientableBlock, INeighborChangeSensitive {
-
- // Used to alternate between two variants of the fixture on adjacent blocks
- public static final BooleanProperty ODD = BooleanProperty.create("odd");
-
- public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
-
- public LightDetectorBlock() {
- super(defaultProps(AEMaterials.FIXTURE).noCollission().noOcclusion());
-
- this.registerDefaultState(
- this.defaultBlockState().setValue(BlockStateProperties.FACING, Direction.UP).setValue(ODD, false)
- .setValue(WATERLOGGED, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(BlockStateProperties.FACING);
- builder.add(ODD);
- builder.add(WATERLOGGED);
- }
-
- @Override
- public int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) {
- if (level instanceof Level && this.getBlockEntity(level, pos).isReady()) {
- // FIXME: This is ... uhm... fishy
- return ((Level) level).getMaxLocalRawBrightness(pos) - 6;
- }
-
- return 0;
- }
-
- @Override
- public void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, BlockPos neighbor) {
- final LightDetectorBlockEntity tld = this.getBlockEntity(level, pos);
- if (tld != null) {
- tld.updateLight();
- }
- }
-
- @Override
- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource rand) {
- // cancel out lightning
- }
-
- @Override
- public boolean isValidOrientation(LevelAccessor level, BlockPos pos, Direction forward,
- Direction up) {
- return this.canPlaceAt(level, pos, up.getOpposite());
- }
-
- private boolean canPlaceAt(LevelReader level, BlockPos pos, Direction dir) {
- return canSupportCenter(level, pos.relative(dir), dir.getOpposite());
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
-
- // FIXME: We should / rather MUST use state here because at startup, this gets
- // called without a level
-
- final Direction up = this.getOrientable(level, pos).getUp();
- final double xOff = -0.3 * up.getStepX();
- final double yOff = -0.3 * up.getStepY();
- final double zOff = -0.3 * up.getStepZ();
- return Shapes
- .create(new AABB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
- }
-
- @Override
- public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos,
- CollisionContext context) {
- return Shapes.empty();
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final Direction up = this.getOrientable(level, pos).getUp();
- if (!this.canPlaceAt(level, pos, up.getOpposite())) {
- this.dropTorch(level, pos);
- }
- }
-
- private void dropTorch(Level level, BlockPos pos) {
- final BlockState prev = level.getBlockState(pos);
- level.destroyBlock(pos, true);
- level.sendBlockUpdated(pos, prev, level.getBlockState(pos), 3);
- }
-
- @Override
- public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
- for (Direction dir : Direction.values()) {
- if (this.canPlaceAt(level, pos, dir)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public IOrientable getOrientable(BlockGetter level, BlockPos pos) {
- return new MetaRotation(level, pos, BlockStateProperties.FACING);
- }
-
- @Override
- @Nullable
- public BlockState getStateForPlacement(BlockPlaceContext context) {
- BlockPos pos = context.getClickedPos();
- FluidState fluidState = context.getLevel().getFluidState(pos);
- BlockState blockState = this.defaultBlockState()
- .setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER);
-
- return blockState;
- }
-
- @Override
- public FluidState getFluidState(BlockState blockState) {
- return blockState.getValue(WATERLOGGED).booleanValue()
- ? Fluids.WATER.getSource(false)
- : super.getFluidState(blockState);
- }
-
- @Override
- public BlockState updateShape(BlockState blockState, Direction facing, BlockState facingState, LevelAccessor level,
- BlockPos currentPos, BlockPos facingPos) {
- if (blockState.getValue(WATERLOGGED).booleanValue()) {
- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
- }
-
- return super.updateShape(blockState, facing, facingState, level, currentPos, facingPos);
- }
-}
diff --git a/src/main/java/appeng/block/misc/MysteriousCubeBlock.java b/src/main/java/appeng/block/misc/MysteriousCubeBlock.java
deleted file mode 100644
index 121be9051c3..00000000000
--- a/src/main/java/appeng/block/misc/MysteriousCubeBlock.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package appeng.block.misc;
-
-import java.util.List;
-
-import org.jetbrains.annotations.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.network.chat.Component;
-import net.minecraft.server.level.ServerLevel;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.TooltipFlag;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.material.Material;
-
-import appeng.block.AEBaseBlock;
-import appeng.core.localization.GuiText;
-import appeng.core.localization.Tooltips;
-import appeng.server.services.compass.CompassService;
-
-public class MysteriousCubeBlock extends AEBaseBlock {
- public static final Properties PROPERTIES = defaultProps(Material.METAL).strength(10, 1000);
-
- public MysteriousCubeBlock() {
- super(PROPERTIES);
- }
-
- @Override
- public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
- if (level instanceof ServerLevel serverLevel) {
- CompassService.notifyBlockChange(serverLevel, pos);
- }
- }
-
- @Override
- public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
- if (newState.getBlock() == state.getBlock()) {
- return; // Just a block state change
- }
-
- super.onRemove(state, level, pos, newState, isMoving);
-
- if (level instanceof ServerLevel serverLevel) {
- CompassService.notifyBlockChange(serverLevel, pos);
- }
- }
-
- @Override
- public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip,
- TooltipFlag flag) {
- tooltip.add(Tooltips.of(GuiText.MysteriousQuote, Tooltips.QUOTE_TEXT));
- }
-}
diff --git a/src/main/java/appeng/block/misc/QuartzFixtureBlock.java b/src/main/java/appeng/block/misc/QuartzFixtureBlock.java
deleted file mode 100644
index d9bfaa6459b..00000000000
--- a/src/main/java/appeng/block/misc/QuartzFixtureBlock.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import java.util.EnumMap;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.item.context.BlockPlaceContext;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.LevelReader;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.Blocks;
-import net.minecraft.world.level.block.SimpleWaterloggedBlock;
-import net.minecraft.world.level.block.SoundType;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BlockStateProperties;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.block.state.properties.DirectionProperty;
-import net.minecraft.world.level.material.FluidState;
-import net.minecraft.world.level.material.Fluids;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.api.util.IOrientable;
-import appeng.api.util.IOrientableBlock;
-import appeng.block.AEBaseBlock;
-import appeng.client.render.effects.ParticleTypes;
-import appeng.core.AEConfig;
-import appeng.core.AppEngClient;
-import appeng.helpers.AEMaterials;
-import appeng.helpers.MetaRotation;
-
-public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock, SimpleWaterloggedBlock {
-
- // Cache VoxelShapes for each facing
- private static final Map SHAPES;
-
- static {
- SHAPES = new EnumMap<>(Direction.class);
-
- for (Direction facing : Direction.values()) {
- final double xOff = -0.3 * facing.getStepX();
- final double yOff = -0.3 * facing.getStepY();
- final double zOff = -0.3 * facing.getStepZ();
- VoxelShape shape = Shapes
- .create(new AABB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
- SHAPES.put(facing, shape);
- }
- }
-
- // Cannot use the vanilla FACING property here because it excludes facing DOWN
- public static final DirectionProperty FACING = BlockStateProperties.FACING;
-
- // Used to alternate between two variants of the fixture on adjacent blocks
- public static final BooleanProperty ODD = BooleanProperty.create("odd");
-
- public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
-
- public QuartzFixtureBlock() {
- super(defaultProps(
- AEMaterials.FIXTURE).noCollission().noOcclusion().strength(0)
- .lightLevel(b -> 14).sound(SoundType.GLASS));
-
- this.registerDefaultState(
- defaultBlockState().setValue(FACING, Direction.UP).setValue(ODD, false).setValue(WATERLOGGED, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- builder.add(FACING, ODD, WATERLOGGED);
- }
-
- // For reference, see WallTorchBlock
- @Override
- @Nullable
- public BlockState getStateForPlacement(BlockPlaceContext context) {
- BlockState blockstate = super.getStateForPlacement(context);
- BlockPos pos = context.getClickedPos();
- FluidState fluidState = context.getLevel().getFluidState(pos);
-
- // Set the even/odd property
- boolean oddPlacement = (pos.getX() + pos.getY() + pos.getZ()) % 2 != 0;
- blockstate = blockstate.setValue(ODD, oddPlacement).setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER);
-
- LevelReader levelReader = context.getLevel();
- Direction[] adirection = context.getNearestLookingDirections();
-
- for (Direction direction : adirection) {
- if (canPlaceAt(levelReader, pos, direction)) {
- return blockstate.setValue(FACING, direction.getOpposite());
- }
- }
-
- return null;
- }
-
- // Break the fixture if the block it is attached to is changed so that it could
- // no longer be placed
- @Override
- public BlockState updateShape(BlockState blockState, Direction facing, BlockState facingState, LevelAccessor level,
- BlockPos currentPos, BlockPos facingPos) {
- if (blockState.getValue(WATERLOGGED).booleanValue()) {
- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
- }
-
- Direction fixtureFacing = blockState.getValue(FACING);
- if (facing.getOpposite() == fixtureFacing && !canPlaceAt(level, currentPos, facing)) {
- return Blocks.AIR.defaultBlockState();
- }
- return blockState;
- }
-
- @Override
- public boolean isValidOrientation(LevelAccessor level, BlockPos pos, Direction forward,
- Direction up) {
- // FIXME: I think this entire method -> not required, but not sure... are quartz
- // fixtures rotateable???
- return this.canPlaceAt(level, pos, up.getOpposite());
- }
-
- private boolean canPlaceAt(LevelReader level, BlockPos pos, Direction dir) {
- return canSupportCenter(level, pos.relative(dir), dir.getOpposite());
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- Direction facing = state.getValue(FACING);
- return SHAPES.get(facing);
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource r) {
- if (!AEConfig.instance().isEnableEffects()) {
- return;
- }
-
- if (r.nextFloat() < 0.98) {
- return;
- }
-
- final Direction up = this.getOrientable(level, pos).getUp();
- final double xOff = -0.3 * up.getStepX();
- final double yOff = -0.3 * up.getStepY();
- final double zOff = -0.3 * up.getStepZ();
- for (int bolts = 0; bolts < 3; bolts++) {
- if (AppEngClient.instance().shouldAddParticles(r)) {
- level.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(),
- zOff + 0.5 + pos.getZ(), 0, 0, 0);
- }
- }
- }
-
- // FIXME: Replaced by the postPlaceupdate stuff above, but check item drops!
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final Direction up = this.getOrientable(level, pos).getUp();
- if (!this.canPlaceAt(level, pos, up.getOpposite())) {
- this.dropTorch(level, pos);
- }
- }
-
- private void dropTorch(Level level, BlockPos pos) {
- final BlockState prev = level.getBlockState(pos);
- level.destroyBlock(pos, true);
- level.sendBlockUpdated(pos, prev, level.getBlockState(pos), 3);
- }
-
- @Override
- public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
- for (Direction dir : Direction.values()) {
- if (this.canPlaceAt(level, pos, dir)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public IOrientable getOrientable(BlockGetter level, BlockPos pos) {
- return new MetaRotation(level, pos, FACING);
- }
-
- @Override
- public FluidState getFluidState(BlockState blockState) {
- return blockState.getValue(WATERLOGGED).booleanValue()
- ? Fluids.WATER.getSource(false)
- : super.getFluidState(blockState);
- }
-
-}
diff --git a/src/main/java/appeng/block/misc/QuartzGrowthAcceleratorBlock.java b/src/main/java/appeng/block/misc/QuartzGrowthAcceleratorBlock.java
deleted file mode 100644
index 41c5584119a..00000000000
--- a/src/main/java/appeng/block/misc/QuartzGrowthAcceleratorBlock.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.client.Minecraft;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.SoundType;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-
-import appeng.api.util.IOrientableBlock;
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.QuartzGrowthAcceleratorBlockEntity;
-import appeng.client.render.effects.ParticleTypes;
-import appeng.core.AEConfig;
-import appeng.core.AppEngClient;
-import appeng.util.Platform;
-
-public class QuartzGrowthAcceleratorBlock extends AEBaseEntityBlock
- implements IOrientableBlock {
-
- private static final BooleanProperty POWERED = BooleanProperty.create("powered");
-
- public QuartzGrowthAcceleratorBlock() {
- super(defaultProps(Material.STONE).sound(SoundType.METAL));
- this.registerDefaultState(this.defaultBlockState().setValue(POWERED, false));
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState,
- QuartzGrowthAcceleratorBlockEntity be) {
- return currentState.setValue(POWERED, be.isPowered());
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- }
-
- @Environment(EnvType.CLIENT)
- @Override
- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource r) {
- if (!AEConfig.instance().isEnableEffects()) {
- return;
- }
-
- final QuartzGrowthAcceleratorBlockEntity cga = this.getBlockEntity(level, pos);
-
- if (cga != null && cga.isPowered() && AppEngClient.instance().shouldAddParticles(r)) {
- final double d0 = r.nextFloat() - 0.5F;
- final double d1 = r.nextFloat() - 0.5F;
-
- final Direction up = cga.getUp();
- final Direction forward = cga.getForward();
- final Direction west = Platform.crossProduct(forward, up);
-
- double rx = 0.5 + pos.getX();
- double ry = 0.5 + pos.getY();
- double rz = 0.5 + pos.getZ();
-
- rx += up.getStepX() * d0;
- ry += up.getStepY() * d0;
- rz += up.getStepZ() * d0;
-
- final int x = pos.getX();
- final int y = pos.getY();
- final int z = pos.getZ();
-
- double dz = 0;
- double dx = 0;
- BlockPos pt = null;
-
- switch (r.nextInt(4)) {
- case 0 -> {
- dx = 0.6;
- dz = d1;
- pt = new BlockPos(x + west.getStepX(), y + west.getStepY(), z + west.getStepZ());
- }
- case 1 -> {
- dx = d1;
- dz += 0.6;
- pt = new BlockPos(x + forward.getStepX(), y + forward.getStepY(), z + forward.getStepZ());
- }
- case 2 -> {
- dx = d1;
- dz = -0.6;
- pt = new BlockPos(x - forward.getStepX(), y - forward.getStepY(), z - forward.getStepZ());
- }
- case 3 -> {
- dx = -0.6;
- dz = d1;
- pt = new BlockPos(x - west.getStepX(), y - west.getStepY(), z - west.getStepZ());
- }
- }
-
- if (!level.getBlockState(pt).isAir()) {
- return;
- }
-
- rx += dx * west.getStepX();
- ry += dx * west.getStepY();
- rz += dx * west.getStepZ();
-
- rx += dz * forward.getStepX();
- ry += dz * forward.getStepY();
- rz += dz * forward.getStepZ();
-
- Minecraft.getInstance().particleEngine.createParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D,
- 0.0D);
- }
- }
-
-}
diff --git a/src/main/java/appeng/block/misc/SecurityStationBlock.java b/src/main/java/appeng/block/misc/SecurityStationBlock.java
index ba72d34cff0..80d39c3afe3 100644
--- a/src/main/java/appeng/block/misc/SecurityStationBlock.java
+++ b/src/main/java/appeng/block/misc/SecurityStationBlock.java
@@ -29,7 +29,6 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult;
@@ -38,24 +37,13 @@
import appeng.util.InteractionUtil;
public class SecurityStationBlock extends AEBaseEntityBlock {
-
- private static final BooleanProperty POWERED = BooleanProperty.create("powered");
-
public SecurityStationBlock() {
super(defaultProps(Material.METAL));
-
- this.registerDefaultState(this.defaultBlockState().setValue(POWERED, false));
}
@Override
protected void createBlockStateDefinition(Builder builder) {
super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, SecurityStationBlockEntity be) {
- return currentState.setValue(POWERED, be.isActive());
}
@Override
diff --git a/src/main/java/appeng/block/misc/TinyTNTBlock.java b/src/main/java/appeng/block/misc/TinyTNTBlock.java
deleted file mode 100644
index c3d00056c52..00000000000
--- a/src/main/java/appeng/block/misc/TinyTNTBlock.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.sounds.SoundEvents;
-import net.minecraft.sounds.SoundSource;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.entity.LivingEntity;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.entity.projectile.AbstractArrow;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.Items;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Explosion;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.BlockHitResult;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.block.AEBaseBlock;
-import appeng.entity.TinyTNTPrimedEntity;
-
-public class TinyTNTBlock extends AEBaseBlock {
-
- private static final VoxelShape SHAPE = Shapes
- .create(new AABB(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
-
- public TinyTNTBlock(BlockBehaviour.Properties props) {
- super(props);
- }
-
- @Override
- public int getLightBlock(BlockState state, BlockGetter level, BlockPos pos) {
- return 2; // FIXME: Validate that this is the correct value range
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- return SHAPE;
- }
-
- @Override
- public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player,
- InteractionHand handIn, BlockHitResult hit) {
- ItemStack heldItem = player.getItemInHand(handIn);
- if (!heldItem.isEmpty() && heldItem.getItem() == Items.FLINT_AND_STEEL) {
- this.startFuse(level, pos, player);
- level.removeBlock(pos, false);
- heldItem.hurtAndBreak(1, player, p -> {
- p.broadcastBreakEvent(handIn);
- }); // FIXME Check if onBroken is equivalent
- return InteractionResult.sidedSuccess(level.isClientSide());
- } else {
- return super.use(state, level, pos, player, handIn, hit);
- }
- }
-
- public void startFuse(Level level, BlockPos pos, LivingEntity igniter) {
- if (!level.isClientSide) {
- final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(level, pos.getX() + 0.5F,
- pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter);
- level.addFreshEntity(primedTinyTNTEntity);
- level.playSound(null, primedTinyTNTEntity.getX(), primedTinyTNTEntity.getY(),
- primedTinyTNTEntity.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1, 1);
- }
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- if (level.getBestNeighborSignal(pos) > 0) {
- this.startFuse(level, pos, null);
- level.removeBlock(pos, false);
- }
- }
-
- @Override
- public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
- super.onPlace(state, level, pos, oldState, isMoving);
-
- if (level.getBestNeighborSignal(pos) > 0) {
- this.startFuse(level, pos, null);
- level.removeBlock(pos, false);
- }
- }
-
- @Override
- public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
- if (!level.isClientSide && entity instanceof AbstractArrow arrow) {
-
- if (arrow.isOnFire()) {
- LivingEntity igniter = null;
- // Check if the shooter still exists
- Entity shooter = arrow.getOwner();
- if (shooter instanceof LivingEntity) {
- igniter = (LivingEntity) shooter;
- }
- this.startFuse(level, pos, igniter);
- level.removeBlock(pos, false);
- }
- }
- }
-
- @Override
- public boolean dropFromExplosion(Explosion exp) {
- return false;
- }
-
- @Override
- public void wasExploded(Level level, BlockPos pos, Explosion exp) {
- super.wasExploded(level, pos, exp);
- if (!level.isClientSide) {
- final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(level, pos.getX() + 0.5F,
- pos.getY() + 0.5F, pos.getZ() + 0.5F, exp.getSourceMob());
- primedTinyTNTEntity
- .setFuse(level.random.nextInt(primedTinyTNTEntity.getFuse() / 4)
- + primedTinyTNTEntity.getFuse() / 8);
- level.addFreshEntity(primedTinyTNTEntity);
- }
- }
-
-}
diff --git a/src/main/java/appeng/block/misc/VibrationChamberBlock.java b/src/main/java/appeng/block/misc/VibrationChamberBlock.java
deleted file mode 100644
index f5c9e766578..00000000000
--- a/src/main/java/appeng/block/misc/VibrationChamberBlock.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.core.particles.ParticleTypes;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.VibrationChamberBlockEntity;
-import appeng.core.AEConfig;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.VibrationChamberMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public final class VibrationChamberBlock extends AEBaseEntityBlock {
-
- // Indicates that the vibration chamber is currently working
- public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
-
- public VibrationChamberBlock() {
- super(defaultProps(Material.METAL).strength(4.2F));
- this.registerDefaultState(this.defaultBlockState().setValue(ACTIVE, false));
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, VibrationChamberBlockEntity be) {
- return currentState.setValue(ACTIVE, be.isOn);
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(ACTIVE);
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player player,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(player)) {
- return InteractionResult.PASS;
- }
-
- if (!level.isClientSide()) {
- final VibrationChamberBlockEntity tc = this.getBlockEntity(level, pos);
- if (tc != null) {
- hit.getDirection();
- MenuOpener.open(VibrationChamberMenu.TYPE, player,
- MenuLocators.forBlockEntity(tc));
- }
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- @Override
- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource r) {
- if (!AEConfig.instance().isEnableEffects()) {
- return;
- }
-
- final VibrationChamberBlockEntity tc = this.getBlockEntity(level, pos);
- if (tc != null && tc.isOn) {
- double f1 = pos.getX() + 0.5F;
- double f2 = pos.getY() + 0.5F;
- double f3 = pos.getZ() + 0.5F;
-
- final Direction forward = tc.getForward();
- final Direction up = tc.getUp();
-
- // Cross-Product of forward/up directional vector
- final int west_x = forward.getStepY() * up.getStepZ() - forward.getStepZ() * up.getStepY();
- final int west_y = forward.getStepZ() * up.getStepX() - forward.getStepX() * up.getStepZ();
- final int west_z = forward.getStepX() * up.getStepY() - forward.getStepY() * up.getStepX();
-
- f1 += forward.getStepX() * 0.6;
- f2 += forward.getStepY() * 0.6;
- f3 += forward.getStepZ() * 0.6;
-
- final double ox = r.nextDouble();
- final double oy = r.nextDouble() * 0.2f;
-
- f1 += up.getStepX() * (-0.3 + oy);
- f2 += up.getStepY() * (-0.3 + oy);
- f3 += up.getStepZ() * (-0.3 + oy);
-
- f1 += west_x * (0.3 * ox - 0.15);
- f2 += west_y * (0.3 * ox - 0.15);
- f3 += west_z * (0.3 * ox - 0.15);
-
- level.addParticle(ParticleTypes.SMOKE, f1, f2, f3, 0.0D, 0.0D, 0.0D);
- level.addParticle(ParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D);
- }
- }
-}
diff --git a/src/main/java/appeng/block/networking/CableBusBlock.java b/src/main/java/appeng/block/networking/CableBusBlock.java
index 3f2d3ca7fe7..f0aec169479 100644
--- a/src/main/java/appeng/block/networking/CableBusBlock.java
+++ b/src/main/java/appeng/block/networking/CableBusBlock.java
@@ -84,12 +84,11 @@
import appeng.hooks.ICustomPickBlock;
import appeng.hooks.IDynamicLadder;
import appeng.hooks.INeighborChangeSensitive;
-import appeng.integration.abstraction.IAEFacade;
import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.util.Platform;
-public class CableBusBlock extends AEBaseEntityBlock implements IAEFacade, SimpleWaterloggedBlock,
+public class CableBusBlock extends AEBaseEntityBlock implements SimpleWaterloggedBlock,
ICustomBlockHitEffect, ICustomBlockDestroyEffect, INeighborChangeSensitive, IDynamicLadder, ICustomPickBlock {
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
@@ -190,8 +189,6 @@ public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter le
if (sp.part != null) {
return new ItemStack(sp.part.getPartItem());
- } else if (sp.facade != null) {
- return sp.facade.getItemStack();
}
return ItemStack.EMPTY;
@@ -216,18 +213,6 @@ private ICableBusContainer cb(BlockGetter level, BlockPos pos) {
return out == null ? NULL_CABLE_BUS : out;
}
- @Nullable
- private IFacadeContainer fc(BlockGetter level, BlockPos pos) {
- final BlockEntity te = level.getBlockEntity(pos);
- IFacadeContainer out = null;
-
- if (te instanceof CableBusBlockEntity) {
- out = ((CableBusBlockEntity) te).getCableBus().getFacadeContainer();
- }
-
- return out;
- }
-
@Override
public InteractionResult onActivated(Level level, BlockPos pos, Player player,
InteractionHand hand,
@@ -255,20 +240,6 @@ public void fillItemCategory(CreativeModeTab group, NonNullList itemS
// do nothing
}
- @Override
- public BlockState getFacadeState(BlockGetter level, BlockPos pos, Direction side) {
- if (side != null) {
- IFacadeContainer container = this.fc(level, pos);
- if (container != null) {
- IFacadePart facade = container.getFacade(side);
- if (facade != null) {
- return facade.getBlockState();
- }
- }
- }
- return level.getBlockState(pos);
- }
-
@Override
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
CableBusBlockEntity te = getBlockEntity(level, pos);
@@ -434,22 +405,6 @@ public boolean addDestroyEffects(BlockState state, Level level, BlockPos pos,
@Override
public BlockState getAppearance(BlockState state, BlockAndTintGetter renderView, BlockPos pos, Direction side,
@Nullable BlockState sourceState, @Nullable BlockPos sourcePos) {
- if (((RenderAttachedBlockView) renderView)
- .getBlockEntityRenderAttachment(pos) instanceof CableBusRenderState cableBusRenderState) {
- var renderingFacadeDir = RENDERING_FACADE_DIRECTION.get();
- var facades = cableBusRenderState.getFacades();
-
- if (side.getOpposite() != renderingFacadeDir) {
- var facadeState = facades.get(side);
- if (facadeState != null) {
- return facadeState.getSourceBlock();
- }
- }
-
- if (renderingFacadeDir != null && facades.containsKey(renderingFacadeDir)) {
- return facades.get(renderingFacadeDir).getSourceBlock();
- }
- }
return state;
}
}
diff --git a/src/main/java/appeng/block/networking/ControllerBlock.java b/src/main/java/appeng/block/networking/ControllerBlock.java
index 463205ed03b..ecb3da70f0b 100644
--- a/src/main/java/appeng/block/networking/ControllerBlock.java
+++ b/src/main/java/appeng/block/networking/ControllerBlock.java
@@ -41,7 +41,6 @@
import appeng.blockentity.networking.ControllerBlockEntity;
import appeng.menu.MenuOpener;
import appeng.menu.locator.MenuLocators;
-import appeng.menu.me.networktool.NetworkStatusMenu;
public class ControllerBlock extends AEBaseEntityBlock {
@@ -149,9 +148,6 @@ public InteractionResult onActivated(Level level, BlockPos pos, Player player, I
@org.jetbrains.annotations.Nullable ItemStack heldItem, BlockHitResult hit) {
var controller = getBlockEntity(level, pos);
if (controller != null) {
- if (!level.isClientSide) {
- MenuOpener.open(NetworkStatusMenu.CONTROLLER_TYPE, player, MenuLocators.forBlockEntity(controller));
- }
return InteractionResult.sidedSuccess(level.isClientSide);
}
return InteractionResult.FAIL;
diff --git a/src/main/java/appeng/block/networking/CreativeEnergyCellBlock.java b/src/main/java/appeng/block/networking/CreativeEnergyCellBlock.java
deleted file mode 100644
index c84969b7049..00000000000
--- a/src/main/java/appeng/block/networking/CreativeEnergyCellBlock.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.networking;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.networking.CreativeEnergyCellBlockEntity;
-import appeng.helpers.AEMaterials;
-
-public class CreativeEnergyCellBlock extends AEBaseEntityBlock {
-
- public CreativeEnergyCellBlock() {
- super(defaultProps(AEMaterials.GLASS));
- }
-}
diff --git a/src/main/java/appeng/block/networking/EnergyAcceptorBlock.java b/src/main/java/appeng/block/networking/EnergyAcceptorBlock.java
deleted file mode 100644
index 8ea636309eb..00000000000
--- a/src/main/java/appeng/block/networking/EnergyAcceptorBlock.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.networking;
-
-import net.minecraft.world.level.material.Material;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.networking.EnergyAcceptorBlockEntity;
-
-public class EnergyAcceptorBlock extends AEBaseEntityBlock {
-
- public EnergyAcceptorBlock() {
- super(defaultProps(Material.METAL));
- }
-}
diff --git a/src/main/java/appeng/block/networking/EnergyCellBlock.java b/src/main/java/appeng/block/networking/EnergyCellBlock.java
deleted file mode 100644
index 8b64453d27f..00000000000
--- a/src/main/java/appeng/block/networking/EnergyCellBlock.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.networking;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.NonNullList;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.util.Mth;
-import net.minecraft.world.item.CreativeModeTab;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.IntegerProperty;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.networking.EnergyCellBlockEntity;
-import appeng.helpers.AEMaterials;
-
-public class EnergyCellBlock extends AEBaseEntityBlock {
-
- public static final int MAX_FULLNESS = 4;
-
- public static final IntegerProperty ENERGY_STORAGE = IntegerProperty.create("fullness", 0, MAX_FULLNESS);
-
- private final double maxPower;
- private final double chargeRate;
- private final int priority;
-
- public EnergyCellBlock(double maxPower, double chargeRate, int priority) {
- super(defaultProps(AEMaterials.GLASS));
- this.maxPower = maxPower;
- this.chargeRate = chargeRate;
- this.priority = priority;
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void fillItemCategory(CreativeModeTab group, NonNullList itemStacks) {
- super.fillItemCategory(group, itemStacks);
-
- final ItemStack charged = new ItemStack(this, 1);
- final CompoundTag tag = charged.getOrCreateTag();
- tag.putDouble("internalCurrentPower", this.getMaxPower());
- tag.putDouble("internalMaxPower", this.getMaxPower());
-
- itemStacks.add(charged);
- }
-
- public double getMaxPower() {
- return this.maxPower;
- }
-
- public double getChargeRate() {
- return this.chargeRate;
- }
-
- public int getPriority() {
- return this.priority;
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(ENERGY_STORAGE);
- }
-
- @Override
- public boolean hasAnalogOutputSignal(BlockState state) {
- return true;
- }
-
- @Override
- public int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos) {
- var cell = getBlockEntity(level, pos);
- if (cell != null) {
- var currentPower = cell.getAECurrentPower();
- var maxPower = cell.getAEMaxPower();
- var fillFactor = currentPower / maxPower;
- return Mth.floor(fillFactor * 14.0F) + (currentPower > 0 ? 1 : 0);
- }
- return 0;
- }
-}
diff --git a/src/main/java/appeng/block/networking/EnergyCellBlockItem.java b/src/main/java/appeng/block/networking/EnergyCellBlockItem.java
deleted file mode 100644
index 3d12716b0d1..00000000000
--- a/src/main/java/appeng/block/networking/EnergyCellBlockItem.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.networking;
-
-import java.util.List;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.chat.Component;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.TooltipFlag;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-
-import appeng.api.config.AccessRestriction;
-import appeng.api.config.Actionable;
-import appeng.api.implementations.items.IAEItemPowerStorage;
-import appeng.block.AEBaseBlockItem;
-import appeng.core.localization.Tooltips;
-
-public class EnergyCellBlockItem extends AEBaseBlockItem implements IAEItemPowerStorage {
-
- public EnergyCellBlockItem(Block block, Item.Properties props) {
- super(block, props);
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void addCheckedInformation(ItemStack stack, Level level, List lines,
- TooltipFlag advancedTooltips) {
- double internalCurrentPower = 0;
- final double internalMaxPower = this.getMaxEnergyCapacity();
-
- if (internalMaxPower > 0) {
- final CompoundTag tag = stack.getTag();
- if (tag != null) {
- internalCurrentPower = tag.getDouble("internalCurrentPower");
- }
-
- lines.add(
- Tooltips.energyStorageComponent(internalCurrentPower, internalMaxPower));
- }
- }
-
- @Override
- public double injectAEPower(ItemStack is, double amount, Actionable mode) {
- final double internalCurrentPower = this.getInternal(is);
- final double internalMaxPower = this.getAEMaxPower(is);
- final double required = internalMaxPower - internalCurrentPower;
- final double overflow = Math.max(0, Math.min(amount - required, amount));
-
- if (mode == Actionable.MODULATE) {
- final double toAdd = Math.min(required, amount);
- final double newPowerStored = internalCurrentPower + toAdd;
-
- this.setInternal(is, newPowerStored);
- }
-
- return overflow;
- }
-
- @Override
- public double extractAEPower(ItemStack is, double amount, Actionable mode) {
- final double internalCurrentPower = this.getInternal(is);
- final double fulfillable = Math.min(amount, internalCurrentPower);
-
- if (mode == Actionable.MODULATE) {
- final double newPowerStored = internalCurrentPower - fulfillable;
-
- this.setInternal(is, newPowerStored);
- }
-
- return fulfillable;
- }
-
- @Override
- public double getAEMaxPower(ItemStack is) {
- return this.getMaxEnergyCapacity();
- }
-
- @Override
- public double getAECurrentPower(ItemStack is) {
- return this.getInternal(is);
- }
-
- @Override
- public AccessRestriction getPowerFlow(ItemStack is) {
- return AccessRestriction.WRITE;
- }
-
- @Override
- public double getChargeRate(ItemStack stack) {
- return ((EnergyCellBlock) getBlock()).getChargeRate();
- }
-
- private double getMaxEnergyCapacity() {
- return ((EnergyCellBlock) getBlock()).getMaxPower();
- }
-
- private double getInternal(ItemStack is) {
- final CompoundTag nbt = is.getOrCreateTag();
- return nbt.getDouble("internalCurrentPower");
- }
-
- private void setInternal(ItemStack is, double amt) {
- final CompoundTag nbt = is.getOrCreateTag();
- nbt.putDouble("internalCurrentPower", amt);
- }
-
-}
diff --git a/src/main/java/appeng/block/networking/WirelessBlock.java b/src/main/java/appeng/block/networking/WirelessBlock.java
index bf68d10641b..fa284a327c1 100644
--- a/src/main/java/appeng/block/networking/WirelessBlock.java
+++ b/src/main/java/appeng/block/networking/WirelessBlock.java
@@ -50,9 +50,6 @@
import appeng.block.AEBaseEntityBlock;
import appeng.blockentity.networking.WirelessBlockEntity;
import appeng.helpers.AEMaterials;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.WirelessMenu;
-import appeng.menu.locator.MenuLocators;
import appeng.util.InteractionUtil;
public class WirelessBlock extends AEBaseEntityBlock implements SimpleWaterloggedBlock {
@@ -82,7 +79,7 @@ protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, Wi
if (be.isActive()) {
teState = State.HAS_CHANNEL;
- } else if (be.isPowered()) {
+ } else {
teState = State.ON;
}
@@ -104,8 +101,6 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player
if (tg != null && !InteractionUtil.isInAlternateUseMode(player)) {
if (!level.isClientSide()) {
hit.getDirection();
- MenuOpener.open(WirelessMenu.TYPE, player,
- MenuLocators.forBlockEntity(tg));
}
return InteractionResult.sidedSuccess(level.isClientSide());
}
diff --git a/src/main/java/appeng/block/paint/PaintSplotches.java b/src/main/java/appeng/block/paint/PaintSplotches.java
deleted file mode 100644
index 036ed76adf2..00000000000
--- a/src/main/java/appeng/block/paint/PaintSplotches.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.paint;
-
-import java.util.Collection;
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-import appeng.helpers.Splotch;
-
-/**
- * Used to transfer the state about paint splotches from the game thread to the render thread.
- */
-public class PaintSplotches {
-
- private final List splotches;
-
- public PaintSplotches(Collection splotches) {
- this.splotches = ImmutableList.copyOf(splotches);
- }
-
- List getSplotches() {
- return this.splotches;
- }
-
-}
diff --git a/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java b/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java
deleted file mode 100644
index f87db0a13f8..00000000000
--- a/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.paint;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-import javax.annotation.Nullable;
-
-import com.google.common.collect.ImmutableList;
-
-import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
-import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
-import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView;
-import net.minecraft.client.renderer.block.model.BakedQuad;
-import net.minecraft.client.renderer.block.model.ItemOverrides;
-import net.minecraft.client.renderer.block.model.ItemTransforms;
-import net.minecraft.client.renderer.texture.TextureAtlas;
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.resources.model.BakedModel;
-import net.minecraft.client.resources.model.Material;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.BlockAndTintGetter;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.client.render.cablebus.CubeBuilder;
-import appeng.core.AppEng;
-import appeng.helpers.Splotch;
-
-/**
- * Renders paint blocks, which render multiple "splotches" that have been applied to the sides of adjacent blocks using
- * a matter cannon with paint balls.
- */
-class PaintSplotchesBakedModel implements BakedModel, FabricBakedModel {
-
- private static final Material TEXTURE_PAINT1 = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/paint1"));
- private static final Material TEXTURE_PAINT2 = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/paint2"));
- private static final Material TEXTURE_PAINT3 = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/paint3"));
-
- private final TextureAtlasSprite[] textures;
-
- PaintSplotchesBakedModel(Function bakedTextureGetter) {
- this.textures = new TextureAtlasSprite[] { bakedTextureGetter.apply(TEXTURE_PAINT1),
- bakedTextureGetter.apply(TEXTURE_PAINT2), bakedTextureGetter.apply(TEXTURE_PAINT3) };
- }
-
- @Override
- public boolean isVanillaAdapter() {
- return false;
- }
-
- @Override
- public void emitBlockQuads(BlockAndTintGetter blockView, BlockState state, BlockPos pos,
- Supplier randomSupplier, RenderContext context) {
-
- Object renderAttachment = ((RenderAttachedBlockView) blockView).getBlockEntityRenderAttachment(pos);
- if (!(renderAttachment instanceof PaintSplotches)) {
- return;
- }
- PaintSplotches splotchesState = (PaintSplotches) renderAttachment;
-
- List splotches = splotchesState.getSplotches();
-
- CubeBuilder builder = new CubeBuilder(context.getEmitter());
-
- float offsetConstant = 0.001f;
- for (Splotch s : splotches) {
-
- if (s.isLumen()) {
- builder.setColorRGB(s.getColor().whiteVariant);
- builder.setEmissiveMaterial(true);
- } else {
- builder.setColorRGB(s.getColor().mediumVariant);
- builder.setEmissiveMaterial(false);
- }
-
- float offset = offsetConstant;
- offsetConstant += 0.001f;
-
- final float buffer = 0.1f;
-
- float pos_x = s.x();
- float pos_y = s.y();
-
- pos_x = Math.max(buffer, Math.min(1.0f - buffer, pos_x));
- pos_y = Math.max(buffer, Math.min(1.0f - buffer, pos_y));
-
- TextureAtlasSprite ico = this.textures[s.getSeed() % this.textures.length];
- builder.setTexture(ico);
- builder.setCustomUv(s.getSide().getOpposite(), 0, 0, 16, 16);
-
- switch (s.getSide()) {
- case UP:
- offset = 1.0f - offset;
- builder.addQuad(Direction.DOWN, pos_x - buffer, offset, pos_y - buffer, pos_x + buffer, offset,
- pos_y + buffer);
- break;
-
- case DOWN:
- builder.addQuad(Direction.UP, pos_x - buffer, offset, pos_y - buffer, pos_x + buffer, offset,
- pos_y + buffer);
- break;
-
- case EAST:
- offset = 1.0f - offset;
- builder.addQuad(Direction.WEST, offset, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer,
- pos_y + buffer);
- break;
-
- case WEST:
- builder.addQuad(Direction.EAST, offset, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer,
- pos_y + buffer);
- break;
-
- case SOUTH:
- offset = 1.0f - offset;
- builder.addQuad(Direction.NORTH, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer,
- pos_y + buffer, offset);
- break;
-
- case NORTH:
- builder.addQuad(Direction.SOUTH, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer,
- pos_y + buffer, offset);
- break;
-
- default:
- }
- }
- }
-
- @Override
- public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) {
- }
-
- @Override
- public List getQuads(@Nullable BlockState state, @Nullable Direction face, RandomSource random) {
- return Collections.emptyList();
- }
-
- @Override
- public ItemTransforms getTransforms() {
- return ItemTransforms.NO_TRANSFORMS;
- }
-
- @Override
- public boolean useAmbientOcclusion() {
- return false;
- }
-
- @Override
- public boolean isGui3d() {
- return true;
- }
-
- @Override
- public boolean isCustomRenderer() {
- return false;
- }
-
- @Override
- public TextureAtlasSprite getParticleIcon() {
- return this.textures[0];
- }
-
- @Override
- public ItemOverrides getOverrides() {
- return ItemOverrides.EMPTY;
- }
-
- @Override
- public boolean usesBlockLight() {
- return false;
- }
-
- static List getRequiredTextures() {
- return ImmutableList.of(TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3);
- }
-}
diff --git a/src/main/java/appeng/block/paint/PaintSplotchesBlock.java b/src/main/java/appeng/block/paint/PaintSplotchesBlock.java
deleted file mode 100644
index 8ed08996d19..00000000000
--- a/src/main/java/appeng/block/paint/PaintSplotchesBlock.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.paint;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.NonNullList;
-import net.minecraft.world.item.CreativeModeTab;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.context.BlockPlaceContext;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.biome.Biome;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.IntegerProperty;
-import net.minecraft.world.level.material.Fluid;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.level.material.MaterialColor;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.misc.PaintSplotchesBlockEntity;
-
-public class PaintSplotchesBlock extends AEBaseEntityBlock {
-
- /**
- * Lumen paint splotches contribute light-level 12, two or more have light-level 15. We model this with 0 = 0, 1 =
- * 12, 2 = 15.
- */
- public static final IntegerProperty LIGHT_LEVEL = IntegerProperty.create("light_level", 0, 2);
-
- public PaintSplotchesBlock() {
- super(defaultProps(Material.WATER, MaterialColor.NONE).noOcclusion().air().lightLevel(state -> {
- var lightLevel = state.getValue(LIGHT_LEVEL);
- return switch (lightLevel) {
- default -> 0;
- case 1 -> 12;
- case 2 -> 15;
- };
- }));
- registerDefaultState(defaultBlockState().setValue(LIGHT_LEVEL, 0));
- }
-
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(LIGHT_LEVEL);
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void fillItemCategory(CreativeModeTab group, NonNullList itemStacks) {
- // do nothing
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- return Shapes.empty();
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final PaintSplotchesBlockEntity tp = this.getBlockEntity(level, pos);
-
- if (tp != null) {
- tp.neighborChanged();
- }
- }
-
- @Override
- public void handlePrecipitation(BlockState state, Level level, BlockPos pos, Biome.Precipitation precipitation) {
- if (!level.isClientSide() && precipitation == Biome.Precipitation.RAIN) {
- level.removeBlock(pos, false);
- }
- }
-
- @Override
- public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) {
- return true;
- }
-
- @Override
- public boolean canBeReplaced(BlockState state, Fluid fluid) {
- return true;
- }
-
-}
diff --git a/src/main/java/appeng/block/paint/PaintSplotchesModel.java b/src/main/java/appeng/block/paint/PaintSplotchesModel.java
deleted file mode 100644
index d58689d9ffb..00000000000
--- a/src/main/java/appeng/block/paint/PaintSplotchesModel.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.paint;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-import java.util.function.Function;
-
-import com.mojang.datafixers.util.Pair;
-
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.resources.model.BakedModel;
-import net.minecraft.client.resources.model.Material;
-import net.minecraft.client.resources.model.ModelBakery;
-import net.minecraft.client.resources.model.ModelState;
-import net.minecraft.client.resources.model.UnbakedModel;
-import net.minecraft.resources.ResourceLocation;
-
-public class PaintSplotchesModel implements UnbakedModel {
-
- @org.jetbrains.annotations.Nullable
- @Override
- public BakedModel bake(ModelBakery modelBakery, Function textureGetter,
- ModelState modelState, ResourceLocation resourceLocation) {
- return new PaintSplotchesBakedModel(textureGetter);
- }
-
- @Override
- public Collection getMaterials(Function function,
- Set> set) {
- return PaintSplotchesBakedModel.getRequiredTextures();
- }
-
- @Override
- public Collection getDependencies() {
- return Collections.emptyList();
- }
-
-}
diff --git a/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java b/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java
deleted file mode 100644
index f0f0eecf8d3..00000000000
--- a/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.qnb;
-
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-import javax.annotation.Nullable;
-
-import com.google.common.collect.ImmutableList;
-
-import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
-import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
-import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
-import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView;
-import net.minecraft.client.renderer.block.model.BakedQuad;
-import net.minecraft.client.renderer.block.model.ItemOverrides;
-import net.minecraft.client.renderer.block.model.ItemTransforms;
-import net.minecraft.client.renderer.texture.TextureAtlas;
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.resources.model.BakedModel;
-import net.minecraft.client.resources.model.Material;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.BlockAndTintGetter;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.client.render.cablebus.CubeBuilder;
-import appeng.core.AppEng;
-import appeng.core.definitions.AEBlocks;
-
-class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
-
- private static final Material TEXTURE_LINK = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/quantum_link"));
- private static final Material TEXTURE_RING = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/quantum_ring"));
- private static final Material TEXTURE_RING_LIGHT = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/quantum_ring_light"));
- private static final Material TEXTURE_RING_LIGHT_CORNER = new Material(
- TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "block/quantum_ring_light_corner"));
- private static final Material TEXTURE_CABLE_GLASS = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "part/cable/glass/transparent"));
- private static final Material TEXTURE_COVERED_CABLE = new Material(TextureAtlas.LOCATION_BLOCKS,
- new ResourceLocation(AppEng.MOD_ID, "part/cable/covered/transparent"));
-
- private static final float DEFAULT_RENDER_MIN = 2.0f;
- private static final float DEFAULT_RENDER_MAX = 14.0f;
-
- private static final float CORNER_POWERED_RENDER_MIN = 3.9f;
- private static final float CORNER_POWERED_RENDER_MAX = 12.1f;
-
- private static final float CENTER_POWERED_RENDER_MIN = -0.01f;
- private static final float CENTER_POWERED_RENDER_MAX = 16.01f;
-
- private final BakedModel baseModel;
-
- private final Block linkBlock;
-
- private final TextureAtlasSprite linkTexture;
- private final TextureAtlasSprite ringTexture;
- private final TextureAtlasSprite glassCableTexture;
- private final TextureAtlasSprite coveredCableTexture;
- private final TextureAtlasSprite lightTexture;
- private final TextureAtlasSprite lightCornerTexture;
-
- public QnbFormedBakedModel(BakedModel baseModel, Function bakedTextureGetter) {
- this.baseModel = baseModel;
- this.linkTexture = bakedTextureGetter.apply(TEXTURE_LINK);
- this.ringTexture = bakedTextureGetter.apply(TEXTURE_RING);
- this.glassCableTexture = bakedTextureGetter.apply(TEXTURE_CABLE_GLASS);
- this.coveredCableTexture = bakedTextureGetter.apply(TEXTURE_COVERED_CABLE);
- this.lightTexture = bakedTextureGetter.apply(TEXTURE_RING_LIGHT);
- this.lightCornerTexture = bakedTextureGetter.apply(TEXTURE_RING_LIGHT_CORNER);
- this.linkBlock = AEBlocks.QUANTUM_LINK.block();
- }
-
- @Override
- public boolean isVanillaAdapter() {
- return false;
- }
-
- @Override
- public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) {
-
- }
-
- @Override
- public void emitBlockQuads(BlockAndTintGetter blockView, BlockState state, BlockPos pos,
- Supplier randomSupplier, RenderContext context) {
- QnbFormedState formedState = getState(blockView, pos);
-
- if (formedState == null) {
- context.fallbackConsumer().accept(this.baseModel);
- return;
- }
-
- buildQuads(context.getEmitter(), formedState, state);
-
- }
-
- @Override
- public List getQuads(@Nullable BlockState state, @Nullable Direction face, RandomSource random) {
- return baseModel.getQuads(state, face, random);
- }
-
- @Override
- public ItemTransforms getTransforms() {
- return ItemTransforms.NO_TRANSFORMS;
- }
-
- private static QnbFormedState getState(BlockAndTintGetter view, BlockPos pos) {
- if (view instanceof RenderAttachedBlockView renderAttachedBlockView) {
- Object attachment = renderAttachedBlockView.getBlockEntityRenderAttachment(pos);
- if (attachment instanceof QnbFormedState qnbFormedState) {
- return qnbFormedState;
- }
- }
- return null;
- }
-
- private void buildQuads(QuadEmitter emitter, QnbFormedState formedState, BlockState state) {
- CubeBuilder builder = new CubeBuilder(emitter);
-
- if (state.getBlock() == this.linkBlock) {
- Set sides = formedState.getAdjacentQuantumBridges();
-
- this.renderCableAt(builder, 0.11f * 16, this.glassCableTexture, 0.141f * 16, sides);
-
- this.renderCableAt(builder, 0.188f * 16, this.coveredCableTexture, 0.1875f * 16, sides);
-
- builder.setTexture(this.linkTexture);
- builder.addCube(DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX,
- DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX);
- } else if (formedState.isCorner()) {
- this.renderCableAt(builder, 0.188f * 16, this.coveredCableTexture, 0.05f * 16,
- formedState.getAdjacentQuantumBridges());
-
- builder.setTexture(this.ringTexture);
- builder.addCube(DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX,
- DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX);
-
- if (formedState.isPowered()) {
- builder.setTexture(this.lightCornerTexture);
- builder.setEmissiveMaterial(true);
- for (Direction facing : Direction.values()) {
- // Offset the face by a slight amount so that it is drawn over the already drawn
- // ring texture
- // (avoids z-fighting)
- float xOffset = Math.abs(facing.getStepX() * 0.01f);
- float yOffset = Math.abs(facing.getStepY() * 0.01f);
- float zOffset = Math.abs(facing.getStepZ() * 0.01f);
-
- builder.setDrawFaces(EnumSet.of(facing));
- builder.addCube(DEFAULT_RENDER_MIN - xOffset, DEFAULT_RENDER_MIN - yOffset,
- DEFAULT_RENDER_MIN - zOffset, DEFAULT_RENDER_MAX + xOffset,
- DEFAULT_RENDER_MAX + yOffset, DEFAULT_RENDER_MAX + zOffset);
- }
- builder.setEmissiveMaterial(false);
- }
- } else {
- builder.setTexture(this.ringTexture);
-
- builder.addCube(0, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, 16, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX);
-
- builder.addCube(DEFAULT_RENDER_MIN, 0, DEFAULT_RENDER_MIN, DEFAULT_RENDER_MAX, 16, DEFAULT_RENDER_MAX);
-
- builder.addCube(DEFAULT_RENDER_MIN, DEFAULT_RENDER_MIN, 0, DEFAULT_RENDER_MAX, DEFAULT_RENDER_MAX, 16);
-
- if (formedState.isPowered()) {
- builder.setTexture(this.lightTexture);
- builder.setEmissiveMaterial(true);
- for (Direction facing : Direction.values()) {
- // Offset the face by a slight amount so that it is drawn over the already drawn
- // ring texture
- // (avoids z-fighting)
- float xOffset = Math.abs(facing.getStepX() * 0.01f);
- float yOffset = Math.abs(facing.getStepY() * 0.01f);
- float zOffset = Math.abs(facing.getStepZ() * 0.01f);
-
- builder.setDrawFaces(EnumSet.of(facing));
- builder.addCube(-xOffset, -yOffset, -zOffset, 16 + xOffset, 16 + yOffset, 16 + zOffset);
- }
- }
- }
- }
-
- private void renderCableAt(CubeBuilder builder, float thickness, TextureAtlasSprite texture, float pull,
- Set connections) {
- builder.setTexture(texture);
-
- if (connections.contains(Direction.WEST)) {
- builder.addCube(0, 8 - thickness, 8 - thickness, 8 - thickness - pull, 8 + thickness, 8 + thickness);
- }
-
- if (connections.contains(Direction.EAST)) {
- builder.addCube(8 + thickness + pull, 8 - thickness, 8 - thickness, 16, 8 + thickness, 8 + thickness);
- }
-
- if (connections.contains(Direction.NORTH)) {
- builder.addCube(8 - thickness, 8 - thickness, 0, 8 + thickness, 8 + thickness, 8 - thickness - pull);
- }
-
- if (connections.contains(Direction.SOUTH)) {
- builder.addCube(8 - thickness, 8 - thickness, 8 + thickness + pull, 8 + thickness, 8 + thickness, 16);
- }
-
- if (connections.contains(Direction.DOWN)) {
- builder.addCube(8 - thickness, 0, 8 - thickness, 8 + thickness, 8 - thickness - pull, 8 + thickness);
- }
-
- if (connections.contains(Direction.UP)) {
- builder.addCube(8 - thickness, 8 + thickness + pull, 8 - thickness, 8 + thickness, 16, 8 + thickness);
- }
- }
-
- @Override
- public boolean useAmbientOcclusion() {
- return this.baseModel.useAmbientOcclusion();
- }
-
- @Override
- public boolean isGui3d() {
- return true;
- }
-
- @Override
- public boolean usesBlockLight() {
- return false;
- }
-
- @Override
- public boolean isCustomRenderer() {
- return false;
- }
-
- @Override
- public TextureAtlasSprite getParticleIcon() {
- return this.baseModel.getParticleIcon();
- }
-
- @Override
- public ItemOverrides getOverrides() {
- return this.baseModel.getOverrides();
- }
-
- public static List getRequiredTextures() {
- return ImmutableList.of(TEXTURE_LINK, TEXTURE_RING, TEXTURE_CABLE_GLASS, TEXTURE_COVERED_CABLE,
- TEXTURE_RING_LIGHT, TEXTURE_RING_LIGHT_CORNER);
- }
-}
diff --git a/src/main/java/appeng/block/qnb/QnbFormedModel.java b/src/main/java/appeng/block/qnb/QnbFormedModel.java
deleted file mode 100644
index 30d12cdd483..00000000000
--- a/src/main/java/appeng/block/qnb/QnbFormedModel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.qnb;
-
-import java.util.Collection;
-import java.util.function.Function;
-import java.util.stream.Stream;
-
-import com.google.common.collect.ImmutableSet;
-
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.resources.model.BakedModel;
-import net.minecraft.client.resources.model.Material;
-import net.minecraft.client.resources.model.ModelBakery;
-import net.minecraft.client.resources.model.ModelState;
-import net.minecraft.resources.ResourceLocation;
-
-import appeng.client.render.BasicUnbakedModel;
-import appeng.core.AppEng;
-
-public class QnbFormedModel implements BasicUnbakedModel {
-
- private static final ResourceLocation MODEL_RING = new ResourceLocation(AppEng.MOD_ID, "block/qnb/ring");
-
- @org.jetbrains.annotations.Nullable
- @Override
- public BakedModel bake(ModelBakery modelBakery, Function textureGetter,
- ModelState modelState, ResourceLocation resourceLocation) {
- BakedModel ringModel = modelBakery.bake(MODEL_RING, modelState);
- return new QnbFormedBakedModel(ringModel, textureGetter);
- }
-
- @Override
- public Collection getDependencies() {
- return ImmutableSet.of(MODEL_RING);
- }
-
- @Override
- public Stream getAdditionalTextures() {
- return QnbFormedBakedModel.getRequiredTextures().stream();
- }
-
-}
diff --git a/src/main/java/appeng/block/qnb/QnbFormedState.java b/src/main/java/appeng/block/qnb/QnbFormedState.java
deleted file mode 100644
index d4cc38a6c32..00000000000
--- a/src/main/java/appeng/block/qnb/QnbFormedState.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.qnb;
-
-import java.util.Set;
-
-import net.minecraft.core.Direction;
-
-public class QnbFormedState {
-
- private final Set adjacentQuantumBridges;
-
- private final boolean corner;
-
- private final boolean powered;
-
- public QnbFormedState(Set adjacentQuantumBridges, boolean corner, boolean powered) {
- this.adjacentQuantumBridges = adjacentQuantumBridges;
- this.corner = corner;
- this.powered = powered;
- }
-
- public Set getAdjacentQuantumBridges() {
- return this.adjacentQuantumBridges;
- }
-
- public boolean isCorner() {
- return this.corner;
- }
-
- public boolean isPowered() {
- return this.powered;
- }
-
-}
diff --git a/src/main/java/appeng/block/qnb/QuantumBaseBlock.java b/src/main/java/appeng/block/qnb/QuantumBaseBlock.java
deleted file mode 100644
index c0e40095dc9..00000000000
--- a/src/main/java/appeng/block/qnb/QuantumBaseBlock.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.qnb;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.item.context.BlockPlaceContext;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.SimpleWaterloggedBlock;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BlockStateProperties;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.FluidState;
-import net.minecraft.world.level.material.Fluids;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.qnb.QuantumBridgeBlockEntity;
-
-public abstract class QuantumBaseBlock extends AEBaseEntityBlock
- implements SimpleWaterloggedBlock {
-
- public static final BooleanProperty FORMED = BooleanProperty.create("formed");
- private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
-
- private static final VoxelShape SHAPE;
-
- static {
- final float shave = 2.0f / 16.0f;
- SHAPE = Shapes.create(new AABB(shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave));
- }
-
- public QuantumBaseBlock(BlockBehaviour.Properties props) {
- super(props);
- this.registerDefaultState(this.defaultBlockState().setValue(FORMED, false)
- .setValue(WATERLOGGED, false));
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- return SHAPE;
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(FORMED);
- builder.add(WATERLOGGED);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, QuantumBridgeBlockEntity be) {
- return currentState.setValue(FORMED, be.isFormed());
- }
-
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final QuantumBridgeBlockEntity bridge = this.getBlockEntity(level, pos);
- if (bridge != null) {
- bridge.neighborUpdate(fromPos);
- }
- }
-
- @Override
- public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
- if (newState.getBlock() == state.getBlock()) {
- return; // Just a block state change
- }
-
- final QuantumBridgeBlockEntity bridge = this.getBlockEntity(level, pos);
- if (bridge != null) {
- bridge.breakClusterOnRemove();
- }
-
- super.onRemove(state, level, pos, newState, isMoving);
- }
-
- @Override
- @Nullable
- public BlockState getStateForPlacement(BlockPlaceContext context) {
- BlockPos pos = context.getClickedPos();
- FluidState fluidState = context.getLevel().getFluidState(pos);
- BlockState blockState = this.defaultBlockState()
- .setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER);
-
- return blockState;
- }
-
- @Override
- public FluidState getFluidState(BlockState blockState) {
- return blockState.getValue(WATERLOGGED).booleanValue()
- ? Fluids.WATER.getSource(false)
- : super.getFluidState(blockState);
- }
-
- @Override
- public BlockState updateShape(BlockState blockState, Direction facing, BlockState facingState, LevelAccessor level,
- BlockPos currentPos, BlockPos facingPos) {
- if (blockState.getValue(WATERLOGGED).booleanValue()) {
- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
- }
-
- return super.updateShape(blockState, facing, facingState, level, currentPos, facingPos);
- }
-
-}
diff --git a/src/main/java/appeng/block/qnb/QuantumLinkChamberBlock.java b/src/main/java/appeng/block/qnb/QuantumLinkChamberBlock.java
deleted file mode 100644
index ee0bfa93349..00000000000
--- a/src/main/java/appeng/block/qnb/QuantumLinkChamberBlock.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.qnb;
-
-import javax.annotation.Nullable;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.core.BlockPos;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.BlockHitResult;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.blockentity.qnb.QuantumBridgeBlockEntity;
-import appeng.client.EffectType;
-import appeng.core.AppEng;
-import appeng.core.AppEngClient;
-import appeng.helpers.AEMaterials;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.QNBMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class QuantumLinkChamberBlock extends QuantumBaseBlock {
-
- private static final VoxelShape SHAPE;
-
- static {
- final double onePixel = 2.0 / 16.0;
- SHAPE = Shapes.create(
- new AABB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
- }
-
- public QuantumLinkChamberBlock() {
- super(defaultProps(AEMaterials.GLASS));
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource rand) {
- final QuantumBridgeBlockEntity bridge = this.getBlockEntity(level, pos);
- if (bridge != null && bridge.hasQES() && AppEngClient.instance().shouldAddParticles(rand)) {
- AppEng.instance().spawnEffect(EffectType.Energy, level, pos.getX() + 0.5, pos.getY() + 0.5,
- pos.getZ() + 0.5,
- null);
- }
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- final QuantumBridgeBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null) {
- if (!level.isClientSide()) {
- MenuOpener.open(QNBMenu.TYPE, p, MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- return InteractionResult.PASS;
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- return SHAPE;
- }
-
-}
diff --git a/src/main/java/appeng/block/qnb/QuantumRingBlock.java b/src/main/java/appeng/block/qnb/QuantumRingBlock.java
deleted file mode 100644
index dcf1c9bb47f..00000000000
--- a/src/main/java/appeng/block/qnb/QuantumRingBlock.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.qnb;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.blockentity.qnb.QuantumBridgeBlockEntity;
-
-public class QuantumRingBlock extends QuantumBaseBlock {
-
- private static final VoxelShape SHAPE = createShape(2.0 / 16.0);
- private static final VoxelShape SHAPE_CORNER = createShape(2.0 / 16.0);
- private static final VoxelShape SHAPE_CENTER = createCenterShape(2.0 / 16.0);
-
- private static final double DEFAULT_MODEL_MIN = 2.0 / 16.0;
- private static final double DEFAULT_MODEL_MAX = 14.0 / 16.0;
-
- public QuantumRingBlock() {
- super(defaultProps(Material.METAL));
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- final QuantumBridgeBlockEntity bridge = this.getBlockEntity(level, pos);
- if (bridge != null && bridge.isCorner()) {
- return SHAPE_CORNER;
- } else if (bridge != null && bridge.isFormed()) {
- return SHAPE_CENTER;
- }
- return SHAPE;
- }
-
- private static VoxelShape createShape(double onePixel) {
- return Shapes.create(
- new AABB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
- }
-
- private static VoxelShape createCenterShape(double offset) {
- VoxelShape centerShape = SHAPE;
- for (Direction facing : Direction.values()) {
- double xOffset = Math.abs(facing.getStepX() * offset);
- double yOffset = Math.abs(facing.getStepY() * offset);
- double zOffset = Math.abs(facing.getStepZ() * offset);
-
- VoxelShape extrusion = Shapes.create(
- new AABB(DEFAULT_MODEL_MIN - xOffset, DEFAULT_MODEL_MIN - yOffset,
- DEFAULT_MODEL_MIN - zOffset, DEFAULT_MODEL_MAX + xOffset,
- DEFAULT_MODEL_MAX + yOffset, DEFAULT_MODEL_MAX + zOffset));
-
- centerShape = Shapes.or(centerShape, extrusion);
- }
-
- return centerShape;
- }
-}
diff --git a/src/main/java/appeng/block/spatial/MatrixFrameBlock.java b/src/main/java/appeng/block/spatial/MatrixFrameBlock.java
deleted file mode 100644
index 3f4c624241c..00000000000
--- a/src/main/java/appeng/block/spatial/MatrixFrameBlock.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.spatial;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.NonNullList;
-import net.minecraft.world.item.CreativeModeTab;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Explosion;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelReader;
-import net.minecraft.world.level.block.RenderShape;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.level.material.MaterialColor;
-import net.minecraft.world.level.material.PushReaction;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.block.AEBaseBlock;
-
-/**
- * This block is used to fill empty space in spatial dimensions and delinates the border of a spatial dimensions's
- * usable space.
- */
-public class MatrixFrameBlock extends AEBaseBlock {
-
- private static final Material MATERIAL = new Material(MaterialColor.NONE, false, true, true, false, false, false,
- PushReaction.PUSH_ONLY);
-
- public MatrixFrameBlock() {
- super(BlockBehaviour.Properties.of(MATERIAL).strength(-1.0F, 6000000.0F).noOcclusion().noLootTable());
- }
-
- @Override
- public RenderShape getRenderShape(BlockState state) {
- return RenderShape.INVISIBLE;
- }
-
- @Override
- @Environment(EnvType.CLIENT)
- public void fillItemCategory(CreativeModeTab group, NonNullList itemStacks) {
- // do nothing
- }
-
- @Override
- public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos,
- CollisionContext context) {
- return Shapes.block();
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- // This also prevents any blocks from being placed on this block!
- return Shapes.empty();
- }
-
- @Override
- public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
- return false;
- }
-
- @Override
- public void wasExploded(Level level, BlockPos pos, Explosion explosion) {
- // Don't explode.
- }
-
- @Override
- public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) {
- return true;
- }
-
- @Override
- public float getShadeBrightness(BlockState state, BlockGetter level, BlockPos pos) {
- return 1.0f;
- }
-
-}
diff --git a/src/main/java/appeng/block/spatial/SpatialAnchorBlock.java b/src/main/java/appeng/block/spatial/SpatialAnchorBlock.java
deleted file mode 100644
index c2c4442d237..00000000000
--- a/src/main/java/appeng/block/spatial/SpatialAnchorBlock.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.spatial;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.spatial.SpatialAnchorBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.SpatialAnchorMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-/**
- * The block for our chunk loader
- */
-public class SpatialAnchorBlock extends AEBaseEntityBlock {
-
- public static final BooleanProperty POWERED = BooleanProperty.create("powered");
-
- public SpatialAnchorBlock() {
- super(defaultProps(Material.METAL));
- this.registerDefaultState(this.defaultBlockState().setValue(POWERED, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, SpatialAnchorBlockEntity be) {
- return currentState.setValue(POWERED, be.isActive());
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- final SpatialAnchorBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null) {
- if (!level.isClientSide()) {
- hit.getDirection();
- MenuOpener.open(SpatialAnchorMenu.TYPE, p,
- MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-
-}
diff --git a/src/main/java/appeng/block/spatial/SpatialIOPortBlock.java b/src/main/java/appeng/block/spatial/SpatialIOPortBlock.java
deleted file mode 100644
index 5273f72a91d..00000000000
--- a/src/main/java/appeng/block/spatial/SpatialIOPortBlock.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.spatial;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.spatial.SpatialIOPortBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.SpatialIOPortMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class SpatialIOPortBlock extends AEBaseEntityBlock {
-
- public final static BooleanProperty POWERED = BooleanProperty.create("powered");
-
- public SpatialIOPortBlock() {
- super(defaultProps(Material.METAL));
- this.registerDefaultState(this.defaultBlockState().setValue(POWERED, false));
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final SpatialIOPortBlockEntity te = this.getBlockEntity(level, pos);
- if (te != null) {
- te.updateRedstoneState();
- }
- }
-
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, SpatialIOPortBlockEntity be) {
- return currentState.setValue(POWERED, be.isActive());
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- final SpatialIOPortBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null) {
- if (!level.isClientSide()) {
- hit.getDirection();
- MenuOpener.open(SpatialIOPortMenu.TYPE, p,
- MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-}
diff --git a/src/main/java/appeng/block/spatial/SpatialPylonBlock.java b/src/main/java/appeng/block/spatial/SpatialPylonBlock.java
deleted file mode 100644
index e3363dfc1de..00000000000
--- a/src/main/java/appeng/block/spatial/SpatialPylonBlock.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.spatial;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.spatial.SpatialPylonBlockEntity;
-import appeng.helpers.AEMaterials;
-
-public class SpatialPylonBlock extends AEBaseEntityBlock {
-
- public static final BooleanProperty POWERED_ON = BooleanProperty.create("powered_on");
-
- public SpatialPylonBlock() {
- super(defaultProps(AEMaterials.GLASS).lightLevel(state -> {
- return state.getValue(POWERED_ON) ? 8 : 0;
- }));
- registerDefaultState(defaultBlockState().setValue(POWERED_ON, false));
- }
-
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED_ON);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, SpatialPylonBlockEntity be) {
- var poweredOn = (be.getDisplayBits() & SpatialPylonBlockEntity.DISPLAY_POWERED_ENABLED) != 0;
- return currentState.setValue(SpatialPylonBlock.POWERED_ON, poweredOn);
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final SpatialPylonBlockEntity tsp = this.getBlockEntity(level, pos);
- if (tsp != null) {
- tsp.neighborChanged(fromPos);
- }
- }
-
-}
diff --git a/src/main/java/appeng/block/storage/ChestBlock.java b/src/main/java/appeng/block/storage/ChestBlock.java
deleted file mode 100644
index f2639da5ffa..00000000000
--- a/src/main/java/appeng/block/storage/ChestBlock.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.storage;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.api.storage.cells.CellState;
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.storage.ChestBlockEntity;
-import appeng.core.localization.PlayerMessages;
-import appeng.util.InteractionUtil;
-
-public class ChestBlock extends AEBaseEntityBlock {
-
- private final static BooleanProperty LIGHTS_ON = BooleanProperty.create("lights_on");
-
- public ChestBlock() {
- super(defaultProps(Material.METAL));
- this.registerDefaultState(this.defaultBlockState().setValue(LIGHTS_ON, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(LIGHTS_ON);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, ChestBlockEntity be) {
- var cellState = CellState.ABSENT;
-
- if (be.getCellCount() >= 1) {
- cellState = be.getCellStatus(0);
- }
-
- return currentState.setValue(LIGHTS_ON, be.isPowered() && cellState != CellState.ABSENT);
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- var be = this.getBlockEntity(level, pos);
- if (be != null && !InteractionUtil.isInAlternateUseMode(p)) {
- if (!level.isClientSide()) {
- if (hit.getDirection() == be.getUp()) {
- if (!be.openGui(p)) {
- p.sendSystemMessage(PlayerMessages.ChestCannotReadStorageCell.text());
- }
- } else {
- be.openCellInventoryMenu(p);
- }
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- return InteractionResult.PASS;
- }
-}
diff --git a/src/main/java/appeng/block/storage/DriveBlock.java b/src/main/java/appeng/block/storage/DriveBlock.java
deleted file mode 100644
index f28c6658013..00000000000
--- a/src/main/java/appeng/block/storage/DriveBlock.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.storage;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.storage.DriveBlockEntity;
-import appeng.util.InteractionUtil;
-
-public class DriveBlock extends AEBaseEntityBlock {
-
- public DriveBlock() {
- super(defaultProps(Material.METAL));
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- var be = this.getBlockEntity(level, pos);
- if (be != null) {
- if (!level.isClientSide()) {
- be.openMenu(p);
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-}
diff --git a/src/main/java/appeng/block/storage/IOPortBlock.java b/src/main/java/appeng/block/storage/IOPortBlock.java
deleted file mode 100644
index 5bfa6904769..00000000000
--- a/src/main/java/appeng/block/storage/IOPortBlock.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.storage;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.Material;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.storage.IOPortBlockEntity;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.IOPortMenu;
-import appeng.menu.locator.MenuLocators;
-import appeng.util.InteractionUtil;
-
-public class IOPortBlock extends AEBaseEntityBlock {
-
- public final static BooleanProperty POWERED = BooleanProperty.create("powered");
-
- public IOPortBlock() {
- super(defaultProps(Material.METAL));
- this.registerDefaultState(this.defaultBlockState().setValue(POWERED, false));
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos,
- boolean isMoving) {
- final IOPortBlockEntity te = this.getBlockEntity(level, pos);
- if (te != null) {
- te.updateRedstoneState();
- }
- }
-
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(POWERED);
- }
-
- @Override
- protected BlockState updateBlockStateFromBlockEntity(BlockState currentState, IOPortBlockEntity be) {
- return currentState.setValue(POWERED, be.isActive());
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player p,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (InteractionUtil.isInAlternateUseMode(p)) {
- return InteractionResult.PASS;
- }
-
- final IOPortBlockEntity tg = this.getBlockEntity(level, pos);
- if (tg != null) {
- if (!level.isClientSide()) {
- hit.getDirection();
- MenuOpener.open(IOPortMenu.TYPE, p,
- MenuLocators.forBlockEntity(tg));
- }
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
- return InteractionResult.PASS;
- }
-}
diff --git a/src/main/java/appeng/block/storage/SkyChestBlock.java b/src/main/java/appeng/block/storage/SkyChestBlock.java
deleted file mode 100644
index 856d3b4d19e..00000000000
--- a/src/main/java/appeng/block/storage/SkyChestBlock.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.storage;
-
-import java.util.EnumMap;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.server.level.ServerLevel;
-import net.minecraft.util.RandomSource;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.context.BlockPlaceContext;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.LevelAccessor;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.RenderShape;
-import net.minecraft.world.level.block.SimpleWaterloggedBlock;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition.Builder;
-import net.minecraft.world.level.block.state.properties.BlockStateProperties;
-import net.minecraft.world.level.block.state.properties.BooleanProperty;
-import net.minecraft.world.level.material.FluidState;
-import net.minecraft.world.level.material.Fluids;
-import net.minecraft.world.phys.AABB;
-import net.minecraft.world.phys.BlockHitResult;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.storage.SkyChestBlockEntity;
-import appeng.core.definitions.AEBlockEntities;
-import appeng.menu.MenuOpener;
-import appeng.menu.implementations.SkyChestMenu;
-import appeng.menu.locator.MenuLocators;
-
-public class SkyChestBlock extends AEBaseEntityBlock implements SimpleWaterloggedBlock {
-
- private static final double AABB_OFFSET_BOTTOM = 0.00;
- private static final double AABB_OFFSET_SIDES = 0.06;
- private static final double AABB_OFFSET_TOP = 0.0625;
-
- // Precomputed bounding boxes of the chest, sorted into the map by the UP
- // direction
- private static final Map SHAPES = new EnumMap<>(Direction.class);
-
- private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
-
- static {
- for (Direction up : Direction.values()) {
- AABB aabb = computeAABB(up);
- SHAPES.put(up, Shapes.create(aabb));
- }
- }
-
- public enum SkyChestType {
- STONE, BLOCK
- }
-
- public final SkyChestType type;
-
- public SkyChestBlock(SkyChestType type, BlockBehaviour.Properties props) {
- super(props);
- this.type = type;
- registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
- }
-
- @Override
- protected void createBlockStateDefinition(Builder builder) {
- super.createBlockStateDefinition(builder);
- builder.add(WATERLOGGED);
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public RenderShape getRenderShape(BlockState state) {
- return RenderShape.ENTITYBLOCK_ANIMATED;
- }
-
- @Override
- public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) {
- return true;
- }
-
- @Override
- public InteractionResult onActivated(Level level, BlockPos pos, Player player,
- InteractionHand hand,
- @Nullable ItemStack heldItem, BlockHitResult hit) {
- if (!level.isClientSide()) {
- SkyChestBlockEntity blockEntity = getBlockEntity(level, pos);
- if (blockEntity != null) {
- blockEntity.unpackLootTable(player);
- MenuOpener.open(SkyChestMenu.TYPE, player,
- MenuLocators.forBlockEntity(blockEntity));
- }
- }
-
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- @Override
- public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
- level.getBlockEntity(pos, AEBlockEntities.SKY_CHEST).ifPresent(SkyChestBlockEntity::recheckOpen);
-
- }
-
- @Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- final SkyChestBlockEntity sk = this.getBlockEntity(level, pos);
- Direction up = sk != null ? sk.getUp() : Direction.UP;
- return SHAPES.get(up);
- }
-
- private static AABB computeAABB(Direction up) {
- final double offsetX = up.getStepX() == 0 ? AABB_OFFSET_SIDES : 0.0;
- final double offsetY = up.getStepY() == 0 ? AABB_OFFSET_SIDES : 0.0;
- final double offsetZ = up.getStepZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
-
- // for x/z top and bottom is swapped
- final double minX = Math.max(0.0,
- offsetX + (up.getStepX() < 0 ? AABB_OFFSET_BOTTOM : up.getStepX() * AABB_OFFSET_TOP));
- final double minY = Math.max(0.0,
- offsetY + (up.getStepY() < 0 ? AABB_OFFSET_TOP : up.getStepY() * AABB_OFFSET_BOTTOM));
- final double minZ = Math.max(0.0,
- offsetZ + (up.getStepZ() < 0 ? AABB_OFFSET_BOTTOM : up.getStepZ() * AABB_OFFSET_TOP));
-
- final double maxX = Math.min(1.0,
- 1.0 - offsetX - (up.getStepX() < 0 ? AABB_OFFSET_TOP : up.getStepX() * AABB_OFFSET_BOTTOM));
- final double maxY = Math.min(1.0,
- 1.0 - offsetY - (up.getStepY() < 0 ? AABB_OFFSET_BOTTOM : up.getStepY() * AABB_OFFSET_TOP));
- final double maxZ = Math.min(1.0,
- 1.0 - offsetZ - (up.getStepZ() < 0 ? AABB_OFFSET_TOP : up.getStepZ() * AABB_OFFSET_BOTTOM));
-
- return new AABB(minX, minY, minZ, maxX, maxY, maxZ);
- }
-
- @Override
- @Nullable
- public BlockState getStateForPlacement(BlockPlaceContext context) {
- BlockPos pos = context.getClickedPos();
- FluidState fluidState = context.getLevel().getFluidState(pos);
- BlockState blockState = this.defaultBlockState()
- .setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER);
-
- return blockState;
- }
-
- @Override
- public FluidState getFluidState(BlockState blockState) {
- return blockState.getValue(WATERLOGGED).booleanValue()
- ? Fluids.WATER.getSource(false)
- : super.getFluidState(blockState);
- }
-
- @Override
- public BlockState updateShape(BlockState blockState, Direction facing, BlockState facingState, LevelAccessor level,
- BlockPos currentPos, BlockPos facingPos) {
- if (blockState.getValue(WATERLOGGED)) {
- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
- }
-
- return super.updateShape(blockState, facing, facingState, level, currentPos, facingPos);
- }
-
- @Override
- public void playerWillDestroy(Level level, BlockPos blockPos, BlockState state, Player player) {
- super.playerWillDestroy(level, blockPos, state, player);
- // Spawn loot for player
- level.getBlockEntity(blockPos, AEBlockEntities.SKY_CHEST).ifPresent(chest -> chest.unpackLootTable(player));
- }
-}
diff --git a/src/main/java/appeng/block/storage/SkyStoneTankBlock.java b/src/main/java/appeng/block/storage/SkyStoneTankBlock.java
deleted file mode 100644
index cd4dc760a2e..00000000000
--- a/src/main/java/appeng/block/storage/SkyStoneTankBlock.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package appeng.block.storage;
-
-import java.util.List;
-
-import org.jetbrains.annotations.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.network.chat.Component;
-import net.minecraft.world.InteractionHand;
-import net.minecraft.world.InteractionResult;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.TooltipFlag;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.BlockHitResult;
-
-import appeng.block.AEBaseEntityBlock;
-import appeng.blockentity.storage.SkyStoneTankBlockEntity;
-import appeng.core.localization.GuiText;
-import appeng.core.localization.Tooltips;
-
-public class SkyStoneTankBlock extends AEBaseEntityBlock {
-
- public SkyStoneTankBlock(Properties props) {
- super(props);
- }
-
- @Override
- public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player,
- InteractionHand hand, BlockHitResult hit) {
- if (super.use(state, level, pos, player, hand, hit) == InteractionResult.PASS) {
- SkyStoneTankBlockEntity be = (SkyStoneTankBlockEntity) level.getBlockEntity(pos);
- if (be != null && be.onPlayerUse(player, hand)) {
- return InteractionResult.sidedSuccess(level.isClientSide());
- }
-
- }
- return InteractionResult.PASS;
- }
-
- @Override
- public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip,
- TooltipFlag flag) {
- super.appendHoverText(stack, level, tooltip, flag);
- tooltip.add(Tooltips.of(GuiText.TankBucketCapacity, SkyStoneTankBlockEntity.BUCKET_CAPACITY));
- }
-}
diff --git a/src/main/java/appeng/blockentity/AEBaseBlockEntity.java b/src/main/java/appeng/blockentity/AEBaseBlockEntity.java
index eb89200faa0..0cfd825cbe7 100644
--- a/src/main/java/appeng/blockentity/AEBaseBlockEntity.java
+++ b/src/main/java/appeng/blockentity/AEBaseBlockEntity.java
@@ -66,7 +66,6 @@
import appeng.helpers.ICustomNameObject;
import appeng.hooks.VisualStateSaving;
import appeng.hooks.ticking.TickHandler;
-import appeng.items.tools.MemoryCardItem;
import appeng.util.CustomNameUtil;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
@@ -328,10 +327,6 @@ public void setOrientation(Direction inForward, Direction inUp) {
@OverridingMethodsMustInvokeSuper
public void exportSettings(SettingsFrom mode, CompoundTag output, @Nullable Player player) {
CustomNameUtil.setCustomName(output, customName);
-
- if (mode == SettingsFrom.MEMORY_CARD) {
- MemoryCardItem.exportGenericSettings(this, output);
- }
}
/**
@@ -346,8 +341,6 @@ public void importSettings(SettingsFrom mode, CompoundTag input, @Nullable Playe
if (customName != null) {
this.customName = customName.getString();
}
-
- MemoryCardItem.importGenericSettings(this, input, player);
}
/**
diff --git a/src/main/java/appeng/blockentity/crafting/CraftingBlockEntity.java b/src/main/java/appeng/blockentity/crafting/CraftingBlockEntity.java
deleted file mode 100644
index 20669ba4852..00000000000
--- a/src/main/java/appeng/blockentity/crafting/CraftingBlockEntity.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.crafting;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.Iterator;
-
-import com.google.common.collect.Iterators;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.server.level.ServerLevel;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.Items;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.implementations.IPowerChannelState;
-import appeng.api.networking.GridFlags;
-import appeng.api.networking.IGridMultiblock;
-import appeng.api.networking.IGridNode;
-import appeng.api.networking.IGridNodeListener;
-import appeng.api.util.IConfigManager;
-import appeng.api.util.IConfigurableObject;
-import appeng.block.crafting.AbstractCraftingUnitBlock;
-import appeng.blockentity.grid.AENetworkBlockEntity;
-import appeng.core.definitions.AEBlocks;
-import appeng.me.cluster.IAEMultiBlock;
-import appeng.me.cluster.implementations.CraftingCPUCalculator;
-import appeng.me.cluster.implementations.CraftingCPUCluster;
-import appeng.util.NullConfigManager;
-import appeng.util.Platform;
-import appeng.util.iterators.ChainedIterator;
-
-public class CraftingBlockEntity extends AENetworkBlockEntity
- implements IAEMultiBlock, IPowerChannelState, IConfigurableObject {
-
- private final CraftingCPUCalculator calc = new CraftingCPUCalculator(this);
- private CompoundTag previousState = null;
- private boolean isCoreBlock = false;
- private CraftingCPUCluster cluster;
-
- public CraftingBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
- this.getMainNode().setFlags(GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL)
- .setExposedOnSides(EnumSet.noneOf(Direction.class))
- .addService(IGridMultiblock.class, this::getMultiblockNodes);
- }
-
- @Override
- protected Item getItemFromBlockEntity() {
- if (this.level == null) {
- return Items.AIR;
- }
- return getUnitBlock().type.getItemFromType();
- }
-
- @Override
- public boolean canBeRotated() {
- return false;
- }
-
- @Override
- public void setName(String name) {
- super.setName(name);
- if (this.cluster != null) {
- this.cluster.updateName();
- }
- }
-
- public AbstractCraftingUnitBlock> getUnitBlock() {
- if (this.level == null || this.notLoaded() || this.isRemoved()) {
- return AEBlocks.CRAFTING_UNIT.block();
- }
- return (AbstractCraftingUnitBlock>) this.level.getBlockState(this.worldPosition).getBlock();
- }
-
- public long getStorageBytes() {
- return getUnitBlock().type.getStorageBytes();
- }
-
- public int getAcceleratorThreads() {
- return getUnitBlock().type.getAcceleratorThreads();
- }
-
- @Override
- public void onReady() {
- super.onReady();
- this.getMainNode().setVisualRepresentation(this.getItemFromBlockEntity());
- if (level instanceof ServerLevel serverLevel) {
- this.calc.calculateMultiblock(serverLevel, worldPosition);
- }
- }
-
- public void updateMultiBlock(BlockPos changedPos) {
- if (level instanceof ServerLevel serverLevel) {
- this.calc.updateMultiblockAfterNeighborUpdate(serverLevel, worldPosition, changedPos);
- }
- }
-
- public void updateStatus(CraftingCPUCluster c) {
- if (this.cluster != null && this.cluster != c) {
- this.cluster.breakCluster();
- }
-
- this.cluster = c;
- this.updateSubType(true);
- }
-
- public void updateSubType(boolean updateFormed) {
- if (this.level == null || this.notLoaded() || this.isRemoved()) {
- return;
- }
-
- final boolean formed = this.isFormed();
- boolean power = this.getMainNode().isOnline();
-
- final BlockState current = this.level.getBlockState(this.worldPosition);
-
- // The block entity might try to update while being destroyed
- if (current.getBlock() instanceof AbstractCraftingUnitBlock) {
- final BlockState newState = current.setValue(AbstractCraftingUnitBlock.POWERED, power)
- .setValue(AbstractCraftingUnitBlock.FORMED, formed);
-
- if (current != newState) {
- // Not using flag 2 here (only send to clients, prevent block update) will cause
- // infinite loops
- // In case there is an inconsistency in the crafting clusters.
- this.level.setBlock(this.worldPosition, newState, 2);
- }
- }
-
- if (updateFormed) {
- if (formed) {
- this.getMainNode().setExposedOnSides(EnumSet.allOf(Direction.class));
- } else {
- this.getMainNode().setExposedOnSides(EnumSet.noneOf(Direction.class));
- }
- }
- }
-
- public boolean isFormed() {
- if (isClientSide()) {
- return this.level.getBlockState(this.worldPosition).getValue(AbstractCraftingUnitBlock.FORMED);
- }
- return this.cluster != null;
- }
-
- @Override
- public void saveAdditional(CompoundTag data) {
- super.saveAdditional(data);
- data.putBoolean("core", this.isCoreBlock());
- if (this.isCoreBlock() && this.cluster != null) {
- this.cluster.writeToNBT(data);
- }
- }
-
- @Override
- public void loadTag(CompoundTag data) {
- super.loadTag(data);
- this.setCoreBlock(data.getBoolean("core"));
- if (this.isCoreBlock()) {
- if (this.cluster != null) {
- this.cluster.readFromNBT(data);
- } else {
- this.setPreviousState(data.copy());
- }
- }
- }
-
- @Override
- public void disconnect(boolean update) {
- if (this.cluster != null) {
- this.cluster.destroy();
- if (update) {
- this.updateSubType(true);
- }
- }
- }
-
- @Override
- public CraftingCPUCluster getCluster() {
- return this.cluster;
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public void onMainNodeStateChanged(IGridNodeListener.State reason) {
- if (reason != IGridNodeListener.State.GRID_BOOT) {
- this.updateSubType(false);
- }
- }
-
- public void breakCluster() {
- if (this.cluster != null) {
- this.cluster.cancel();
- var inv = this.cluster.craftingLogic.getInventory();
-
- // Drop stacks
- var places = new ArrayList();
-
- for (var blockEntity : (Iterable) this.cluster::getBlockEntities) {
- if (this == blockEntity) {
- places.add(worldPosition);
- } else {
- for (var d : Direction.values()) {
- var p = blockEntity.worldPosition.relative(d);
-
- if (this.level.isEmptyBlock(p)) {
- places.add(p);
- }
- }
- }
- }
-
- if (places.isEmpty()) {
- throw new IllegalStateException(
- this.cluster + " does not contain any kind of blocks, which were destroyed.");
- }
-
- for (var entry : inv.list) {
- var position = places.get(Platform.getRandomInt() % places.size());
- var stacks = new ArrayList();
- entry.getKey().addDrops(entry.getLongValue(), stacks, this.level, position);
- Platform.spawnDrops(this.level, position, stacks);
- }
-
- this.cluster.destroy();
- }
- }
-
- @Override
- public boolean isPowered() {
- if (isClientSide()) {
- return this.level.getBlockState(this.worldPosition).getValue(AbstractCraftingUnitBlock.POWERED);
- }
- return this.getMainNode().isActive();
- }
-
- @Override
- public boolean isActive() {
- if (!isClientSide()) {
- return this.getMainNode().isActive();
- }
- return this.isPowered() && this.isFormed();
- }
-
- public boolean isCoreBlock() {
- return this.isCoreBlock;
- }
-
- public void setCoreBlock(boolean isCoreBlock) {
- this.isCoreBlock = isCoreBlock;
- }
-
- public CompoundTag getPreviousState() {
- return this.previousState;
- }
-
- public void setPreviousState(CompoundTag previousState) {
- this.previousState = previousState;
- }
-
- @Override
- public Object getRenderAttachmentData() {
- return new CraftingCubeModelData(getUp(), getForward(), getConnections());
- }
-
- protected EnumSet getConnections() {
- if (level == null) {
- return EnumSet.noneOf(Direction.class);
- }
-
- EnumSet connections = EnumSet.noneOf(Direction.class);
-
- for (Direction facing : Direction.values()) {
- if (this.isConnected(level, worldPosition, facing)) {
- connections.add(facing);
- }
- }
-
- return connections;
- }
-
- private boolean isConnected(BlockGetter level, BlockPos pos, Direction side) {
- BlockPos adjacentPos = pos.relative(side);
- return level.getBlockState(adjacentPos).getBlock() instanceof AbstractCraftingUnitBlock;
- }
-
- private Iterator getMultiblockNodes() {
- if (this.getCluster() == null) {
- return new ChainedIterator<>();
- }
- return Iterators.transform(this.getCluster().getBlockEntities(), CraftingBlockEntity::getGridNode);
- }
-
- @Override
- public IConfigManager getConfigManager() {
- var cluster = this.getCluster();
-
- if (cluster != null) {
- return this.getCluster().getConfigManager();
- } else {
- return NullConfigManager.INSTANCE;
- }
- }
-}
diff --git a/src/main/java/appeng/blockentity/crafting/CraftingCubeModelData.java b/src/main/java/appeng/blockentity/crafting/CraftingCubeModelData.java
deleted file mode 100644
index d554fdd862b..00000000000
--- a/src/main/java/appeng/blockentity/crafting/CraftingCubeModelData.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.crafting;
-
-import java.util.EnumSet;
-import java.util.Objects;
-
-import net.minecraft.core.Direction;
-
-import appeng.client.render.model.AEModelData;
-
-public class CraftingCubeModelData extends AEModelData {
-
- // Contains information on which sides of the block are connected to other parts
- // of a formed crafting cube
- private final EnumSet connections;
-
- public CraftingCubeModelData(Direction up, Direction forward, EnumSet connections) {
- super(up, forward);
- this.connections = Objects.requireNonNull(connections);
- }
-
- @Override
- public boolean isCacheable() {
- return false; // Too many variants
- }
-
- public EnumSet getConnections() {
- return connections;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- if (!super.equals(o)) {
- return false;
- }
- CraftingCubeModelData that = (CraftingCubeModelData) o;
- return connections.equals(that.connections);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), connections);
- }
-
-}
diff --git a/src/main/java/appeng/blockentity/crafting/CraftingMonitorBlockEntity.java b/src/main/java/appeng/blockentity/crafting/CraftingMonitorBlockEntity.java
deleted file mode 100644
index b6e2866a5c6..00000000000
--- a/src/main/java/appeng/blockentity/crafting/CraftingMonitorBlockEntity.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.crafting;
-
-import java.util.Objects;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.implementations.blockentities.IColorableBlockEntity;
-import appeng.api.stacks.GenericStack;
-import appeng.api.util.AEColor;
-
-public class CraftingMonitorBlockEntity extends CraftingBlockEntity implements IColorableBlockEntity {
-
- private GenericStack display;
- private AEColor paintedColor = AEColor.TRANSPARENT;
-
- public CraftingMonitorBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
- }
-
- @Override
- protected boolean readFromStream(FriendlyByteBuf data) {
- final boolean c = super.readFromStream(data);
- final AEColor oldPaintedColor = this.paintedColor;
- this.paintedColor = AEColor.values()[data.readByte()];
-
- this.display = GenericStack.readBuffer(data);
-
- return oldPaintedColor != this.paintedColor || c; // Block Entity Renderer takes care of display
- }
-
- @Override
- protected void writeToStream(FriendlyByteBuf data) {
- super.writeToStream(data);
- data.writeByte(this.paintedColor.ordinal());
-
- GenericStack.writeBuffer(display, data);
- }
-
- @Override
- public void loadTag(CompoundTag data) {
- super.loadTag(data);
- if (data.contains("paintedColor")) {
- this.paintedColor = AEColor.values()[data.getByte("paintedColor")];
- }
- }
-
- @Override
- public void saveAdditional(CompoundTag data) {
- super.saveAdditional(data);
- data.putByte("paintedColor", (byte) this.paintedColor.ordinal());
- }
-
- public void setJob(@Nullable GenericStack stack) {
- if (!Objects.equals(this.display, stack)) {
- this.display = stack;
- this.markForUpdate();
- }
- }
-
- @Nullable
- public GenericStack getJobProgress() {
- return this.display;
- }
-
- @Override
- public AEColor getColor() {
- return this.paintedColor;
- }
-
- @Override
- public boolean recolourBlock(Direction side, AEColor newPaintedColor, Player who) {
- if (this.paintedColor == newPaintedColor) {
- return false;
- }
-
- this.paintedColor = newPaintedColor;
- this.saveChanges();
- this.markForUpdate();
- return true;
- }
-
- @Override
- public Object getRenderAttachmentData() {
- return new CraftingMonitorModelData(getUp(), getForward(), getConnections(), getColor());
- }
-
- @Override
- public boolean canBeRotated() {
- return true;
- }
-}
diff --git a/src/main/java/appeng/blockentity/crafting/CraftingMonitorModelData.java b/src/main/java/appeng/blockentity/crafting/CraftingMonitorModelData.java
deleted file mode 100644
index 859ebffc29f..00000000000
--- a/src/main/java/appeng/blockentity/crafting/CraftingMonitorModelData.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.crafting;
-
-import java.util.EnumSet;
-import java.util.Objects;
-
-import net.minecraft.core.Direction;
-
-import appeng.api.util.AEColor;
-
-public class CraftingMonitorModelData extends CraftingCubeModelData {
-
- private final AEColor color;
-
- public CraftingMonitorModelData(Direction up, Direction forward, EnumSet connections, AEColor color) {
- super(up, forward, connections);
- this.color = Objects.requireNonNull(color);
- }
-
- public AEColor getColor() {
- return color;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- if (!super.equals(o)) {
- return false;
- }
- CraftingMonitorModelData that = (CraftingMonitorModelData) o;
- return color == that.color;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), color);
- }
-
-}
diff --git a/src/main/java/appeng/blockentity/crafting/IMolecularAssemblerSupportedPattern.java b/src/main/java/appeng/blockentity/crafting/IMolecularAssemblerSupportedPattern.java
deleted file mode 100644
index f22dee82aee..00000000000
--- a/src/main/java/appeng/blockentity/crafting/IMolecularAssemblerSupportedPattern.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package appeng.blockentity.crafting;
-
-import net.minecraft.core.NonNullList;
-import net.minecraft.world.Container;
-import net.minecraft.world.inventory.CraftingContainer;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-
-import appeng.api.crafting.IPatternDetails;
-import appeng.api.stacks.AEItemKey;
-import appeng.api.stacks.KeyCounter;
-
-/**
- * Implement this on pattern details that support being assembled in the {@link MolecularAssemblerBlockEntity}.
- */
-public interface IMolecularAssemblerSupportedPattern extends IPatternDetails {
- ItemStack assemble(Container container, Level level);
-
- boolean isItemValid(int slot, AEItemKey key, Level level);
-
- boolean isSlotEnabled(int slot);
-
- void fillCraftingGrid(KeyCounter[] table, CraftingGridAccessor gridAccessor);
-
- @FunctionalInterface
- interface CraftingGridAccessor {
- void set(int slot, ItemStack stack);
- }
-
- NonNullList getRemainingItems(CraftingContainer container);
-}
diff --git a/src/main/java/appeng/blockentity/crafting/MolecularAssemblerBlockEntity.java b/src/main/java/appeng/blockentity/crafting/MolecularAssemblerBlockEntity.java
deleted file mode 100644
index e0a8f09df66..00000000000
--- a/src/main/java/appeng/blockentity/crafting/MolecularAssemblerBlockEntity.java
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.crafting;
-
-import java.util.List;
-import java.util.Optional;
-
-import javax.annotation.Nullable;
-
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.network.chat.Component;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.inventory.CraftingContainer;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.entity.BlockEntity;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.config.Actionable;
-import appeng.api.config.PowerMultiplier;
-import appeng.api.crafting.IPatternDetails;
-import appeng.api.crafting.PatternDetailsHelper;
-import appeng.api.implementations.IPowerChannelState;
-import appeng.api.implementations.blockentities.ICraftingMachine;
-import appeng.api.implementations.blockentities.PatternContainerGroup;
-import appeng.api.inventories.ISegmentedInventory;
-import appeng.api.inventories.InternalInventory;
-import appeng.api.networking.IGridNode;
-import appeng.api.networking.IGridNodeListener;
-import appeng.api.networking.ticking.IGridTickable;
-import appeng.api.networking.ticking.TickRateModulation;
-import appeng.api.networking.ticking.TickingRequest;
-import appeng.api.stacks.AEItemKey;
-import appeng.api.stacks.KeyCounter;
-import appeng.api.upgrades.IUpgradeInventory;
-import appeng.api.upgrades.IUpgradeableObject;
-import appeng.api.upgrades.UpgradeInventories;
-import appeng.api.util.AECableType;
-import appeng.blockentity.grid.AENetworkInvBlockEntity;
-import appeng.client.render.crafting.AssemblerAnimationStatus;
-import appeng.core.AELog;
-import appeng.core.AppEng;
-import appeng.core.definitions.AEBlocks;
-import appeng.core.definitions.AEItems;
-import appeng.core.localization.GuiText;
-import appeng.core.localization.Tooltips;
-import appeng.core.sync.network.NetworkHandler;
-import appeng.core.sync.network.TargetPoint;
-import appeng.core.sync.packets.AssemblerAnimationPacket;
-import appeng.crafting.CraftingEvent;
-import appeng.menu.AutoCraftingMenu;
-import appeng.util.inv.AppEngInternalInventory;
-import appeng.util.inv.CombinedInternalInventory;
-import appeng.util.inv.FilteredInternalInventory;
-import appeng.util.inv.filter.IAEItemFilter;
-
-public class MolecularAssemblerBlockEntity extends AENetworkInvBlockEntity
- implements IUpgradeableObject, IGridTickable, ICraftingMachine, IPowerChannelState {
-
- /**
- * Identifies the sub-inventory used by molecular assemblers to store the input items for the crafting process.
- */
- public static final ResourceLocation INV_MAIN = AppEng.makeId("molecular_assembler");
-
- private final CraftingContainer craftingInv;
- private final AppEngInternalInventory gridInv = new AppEngInternalInventory(this, 9 + 1, 1);
- private final AppEngInternalInventory patternInv = new AppEngInternalInventory(this, 1, 1);
- private final InternalInventory gridInvExt = new FilteredInternalInventory(this.gridInv, new CraftingGridFilter());
- private final InternalInventory internalInv = new CombinedInternalInventory(this.gridInv, this.patternInv);
- private final IUpgradeInventory upgrades;
- private boolean isPowered = false;
- private Direction pushDirection = null;
- private ItemStack myPattern = ItemStack.EMPTY;
- private IMolecularAssemblerSupportedPattern myPlan = null;
- private double progress = 0;
- private boolean isAwake = false;
- private boolean forcePlan = false;
- private boolean reboot = true;
-
- @Environment(EnvType.CLIENT)
- private AssemblerAnimationStatus animationStatus;
-
- public MolecularAssemblerBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
-
- this.getMainNode()
- .setIdlePowerUsage(0.0)
- .addService(IGridTickable.class, this);
- this.upgrades = UpgradeInventories.forMachine(AEBlocks.MOLECULAR_ASSEMBLER, getUpgradeSlots(),
- this::saveChanges);
- this.craftingInv = new CraftingContainer(new AutoCraftingMenu(), 3, 3);
-
- }
-
- private int getUpgradeSlots() {
- return 5;
- }
-
- @org.jetbrains.annotations.Nullable
- @Override
- public PatternContainerGroup getCraftingMachineInfo() {
- Component name;
- if (hasCustomInventoryName()) {
- name = getCustomInventoryName();
- } else {
- name = AEBlocks.MOLECULAR_ASSEMBLER.asItem().getDescription();
- }
- var icon = AEItemKey.of(AEBlocks.MOLECULAR_ASSEMBLER);
-
- // List installed upgrades as the tooltip to differentiate assemblers by upgrade count
- List tooltip;
- var accelerationCards = getInstalledUpgrades(AEItems.SPEED_CARD);
- if (accelerationCards == 0) {
- tooltip = List.of();
- } else {
- tooltip = List.of(
- GuiText.CompatibleUpgrade.text(
- Tooltips.of(AEItems.SPEED_CARD.asItem().getDescription()),
- Tooltips.ofUnformattedNumber(accelerationCards)));
- }
-
- return new PatternContainerGroup(icon, name, tooltip);
- }
-
- @Override
- public Optional getDisplayName() {
- if (hasCustomInventoryName()) {
- return Optional.of(getCustomInventoryName());
- } else {
- return Optional.of(getItemFromBlockEntity().getDescription());
- }
- }
-
- @Override
- public boolean pushPattern(IPatternDetails patternDetails, KeyCounter[] table,
- Direction where) {
- if (this.myPattern.isEmpty()) {
- boolean isEmpty = this.gridInv.isEmpty() && this.patternInv.isEmpty();
-
- // Only accept our own crafting patterns!
- if (isEmpty && patternDetails instanceof IMolecularAssemblerSupportedPattern pattern) {
- // We only support fluid and item stacks
-
- this.forcePlan = true;
- this.myPlan = pattern;
- this.pushDirection = where;
-
- this.fillGrid(table, pattern);
-
- this.updateSleepiness();
- this.saveChanges();
- return true;
- }
- }
- return false;
- }
-
- private void fillGrid(KeyCounter[] table, IMolecularAssemblerSupportedPattern adapter) {
- adapter.fillCraftingGrid(table, this.gridInv::setItemDirect);
-
- // Sanity check
- for (var list : table) {
- list.removeZeros();
- if (!list.isEmpty()) {
- throw new RuntimeException("Could not fill grid with some items, including " + list.iterator().next());
- }
- }
- }
-
- private void updateSleepiness() {
- final boolean wasEnabled = this.isAwake;
- this.isAwake = this.myPlan != null && this.hasMats() || this.canPush();
- if (wasEnabled != this.isAwake) {
- getMainNode().ifPresent((grid, node) -> {
- if (this.isAwake) {
- grid.getTickManager().wakeDevice(node);
- } else {
- grid.getTickManager().sleepDevice(node);
- }
- });
- }
- }
-
- private boolean canPush() {
- return !this.gridInv.getStackInSlot(9).isEmpty();
- }
-
- private boolean hasMats() {
- if (this.myPlan == null) {
- return false;
- }
-
- for (int x = 0; x < this.craftingInv.getContainerSize(); x++) {
- this.craftingInv.setItem(x, this.gridInv.getStackInSlot(x));
- }
-
- return !this.myPlan.assemble(this.craftingInv, this.getLevel()).isEmpty();
- }
-
- @Override
- public boolean acceptsPlans() {
- return this.patternInv.isEmpty();
- }
-
- @Override
- protected boolean readFromStream(FriendlyByteBuf data) {
- final boolean c = super.readFromStream(data);
- final boolean oldPower = this.isPowered;
- this.isPowered = data.readBoolean();
- return this.isPowered != oldPower || c;
- }
-
- @Override
- protected void writeToStream(FriendlyByteBuf data) {
- super.writeToStream(data);
- data.writeBoolean(this.isPowered);
- }
-
- @Override
- public void saveAdditional(CompoundTag data) {
- super.saveAdditional(data);
- if (this.forcePlan) {
- // If the plan is null it means the pattern previously loaded from NBT hasn't been decoded yet
- var pattern = myPlan != null ? myPlan.getDefinition().toStack() : myPattern;
- if (!pattern.isEmpty()) {
- var compound = new CompoundTag();
- pattern.save(compound);
- data.put("myPlan", compound);
- data.putInt("pushDirection", this.pushDirection.ordinal());
- }
- }
-
- this.upgrades.writeToNBT(data, "upgrades");
- }
-
- @Override
- public void loadTag(CompoundTag data) {
- super.loadTag(data);
-
- // Reset current state back to defaults
- this.forcePlan = false;
- this.myPattern = ItemStack.EMPTY;
- this.myPlan = null;
-
- if (data.contains("myPlan")) {
- var pattern = ItemStack.of(data.getCompound("myPlan"));
- if (!pattern.isEmpty()) {
- this.forcePlan = true;
- this.myPattern = pattern;
- this.pushDirection = Direction.values()[data.getInt("pushDirection")];
- }
- }
-
- this.upgrades.readFromNBT(data, "upgrades");
- this.recalculatePlan();
- }
-
- private void recalculatePlan() {
- this.reboot = true;
-
- if (this.forcePlan) {
- // If we're in forced mode, and myPattern is not empty, but the plan is null,
- // this indicates that we received an encoded pattern from NBT data, but
- // didn't have a chance to decode it yet
- if (getLevel() != null && myPlan == null) {
- if (!myPattern.isEmpty()) {
- if (PatternDetailsHelper.decodePattern(myPattern, getLevel(),
- false) instanceof IMolecularAssemblerSupportedPattern supportedPlan) {
- this.myPlan = supportedPlan;
- }
- }
-
- // Reset myPattern, so it will accept another job once this one finishes
- this.myPattern = ItemStack.EMPTY;
-
- // If the plan is still null, reset back to non-forced mode
- if (myPlan == null) {
- AELog.warn("Unable to restore auto-crafting pattern after load: %s", myPattern.getTag());
- this.forcePlan = false;
- }
- }
-
- return;
- }
-
- final ItemStack is = this.patternInv.getStackInSlot(0);
-
- boolean reset = true;
-
- if (!is.isEmpty()) {
- if (ItemStack.isSame(is, this.myPattern)) {
- reset = false;
- } else if (PatternDetailsHelper.decodePattern(is, getLevel(),
- false) instanceof IMolecularAssemblerSupportedPattern supportedPattern) {
- reset = false;
- this.progress = 0;
- this.myPattern = is;
- this.myPlan = supportedPattern;
- }
- }
-
- if (reset) {
- this.progress = 0;
- this.forcePlan = false;
- this.myPlan = null;
- this.myPattern = ItemStack.EMPTY;
- this.pushDirection = null;
- }
-
- this.updateSleepiness();
- }
-
- @Override
- public AECableType getCableConnectionType(Direction dir) {
- return AECableType.COVERED;
- }
-
- @Override
- public InternalInventory getSubInventory(ResourceLocation id) {
- if (id.equals(ISegmentedInventory.UPGRADES)) {
- return this.upgrades;
- } else if (id.equals(INV_MAIN)) {
- return this.internalInv;
- }
-
- return super.getSubInventory(id);
- }
-
- @Override
- public InternalInventory getInternalInventory() {
- return this.internalInv;
- }
-
- @Override
- public InternalInventory getExposedInventoryForSide(Direction side) {
- return this.gridInvExt;
- }
-
- @Override
- public void onChangeInventory(InternalInventory inv, int slot) {
- if (inv == this.gridInv || inv == this.patternInv) {
- this.recalculatePlan();
- }
- }
-
- public int getCraftingProgress() {
- return (int) this.progress;
- }
-
- @Override
- public void addAdditionalDrops(Level level, BlockPos pos, List drops) {
- super.addAdditionalDrops(level, pos, drops);
-
- for (var upgrade : upgrades) {
- drops.add(upgrade);
- }
- }
-
- @Override
- public TickingRequest getTickingRequest(IGridNode node) {
- this.recalculatePlan();
- this.updateSleepiness();
- return new TickingRequest(1, 1, !this.isAwake, false);
- }
-
- @Override
- public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
- if (!this.gridInv.getStackInSlot(9).isEmpty()) {
- this.pushOut(this.gridInv.getStackInSlot(9));
-
- // did it eject?
- if (this.gridInv.getStackInSlot(9).isEmpty()) {
- this.saveChanges();
- }
-
- this.ejectHeldItems();
- this.updateSleepiness();
- this.progress = 0;
- return this.isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
- }
-
- if (this.myPlan == null) {
- this.updateSleepiness();
- return TickRateModulation.SLEEP;
- }
-
- if (this.reboot) {
- ticksSinceLastCall = 1;
- }
-
- if (!this.isAwake) {
- return TickRateModulation.SLEEP;
- }
-
- this.reboot = false;
- int speed = 10;
- switch (this.upgrades.getInstalledUpgrades(AEItems.SPEED_CARD)) {
- case 0 -> this.progress += this.userPower(ticksSinceLastCall, speed = 10, 1.0);
- case 1 -> this.progress += this.userPower(ticksSinceLastCall, speed = 13, 1.3);
- case 2 -> this.progress += this.userPower(ticksSinceLastCall, speed = 17, 1.7);
- case 3 -> this.progress += this.userPower(ticksSinceLastCall, speed = 20, 2.0);
- case 4 -> this.progress += this.userPower(ticksSinceLastCall, speed = 25, 2.5);
- case 5 -> this.progress += this.userPower(ticksSinceLastCall, speed = 50, 5.0);
- }
-
- if (this.progress >= 100) {
- for (int x = 0; x < this.craftingInv.getContainerSize(); x++) {
- this.craftingInv.setItem(x, this.gridInv.getStackInSlot(x));
- }
-
- this.progress = 0;
- final ItemStack output = this.myPlan.assemble(this.craftingInv, this.getLevel());
- if (!output.isEmpty()) {
- CraftingEvent.fireAutoCraftingEvent(getLevel(), this.myPlan, output, this.craftingInv);
-
- // pushOut might reset the plan back to null, so get the remaining items before
- var craftingRemainders = this.myPlan.getRemainingItems(this.craftingInv);
-
- this.pushOut(output.copy());
-
- for (int x = 0; x < this.craftingInv.getContainerSize(); x++) {
- this.gridInv.setItemDirect(x, craftingRemainders.get(x));
- }
-
- if (this.patternInv.isEmpty()) {
- this.forcePlan = false;
- this.myPlan = null;
- this.pushDirection = null;
- }
-
- this.ejectHeldItems();
-
- var item = AEItemKey.of(output);
- if (item != null) {
- final TargetPoint where = new TargetPoint(this.worldPosition.getX(), this.worldPosition.getY(),
- this.worldPosition.getZ(), 32,
- this.level);
- NetworkHandler.instance()
- .sendToAllAround(new AssemblerAnimationPacket(this.worldPosition, (byte) speed, item),
- where);
- }
-
- this.saveChanges();
- this.updateSleepiness();
- return this.isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
- }
- }
-
- return TickRateModulation.FASTER;
- }
-
- private void ejectHeldItems() {
- if (this.gridInv.getStackInSlot(9).isEmpty()) {
- for (int x = 0; x < 9; x++) {
- final ItemStack is = this.gridInv.getStackInSlot(x);
- if (!is.isEmpty()
- && (this.myPlan == null || !this.myPlan.isItemValid(x, AEItemKey.of(is), this.level))) {
- this.gridInv.setItemDirect(9, is);
- this.gridInv.setItemDirect(x, ItemStack.EMPTY);
- this.saveChanges();
- return;
- }
- }
- }
- }
-
- private int userPower(int ticksPassed, int bonusValue, double acceleratorTax) {
- var grid = getMainNode().getGrid();
- if (grid != null) {
- return (int) (grid.getEnergyService().extractAEPower(ticksPassed * bonusValue * acceleratorTax,
- Actionable.MODULATE, PowerMultiplier.CONFIG) / acceleratorTax);
- } else {
- return 0;
- }
- }
-
- private void pushOut(ItemStack output) {
- if (this.pushDirection == null) {
- for (Direction d : Direction.values()) {
- output = this.pushTo(output, d);
- }
- } else {
- output = this.pushTo(output, this.pushDirection);
- }
-
- if (output.isEmpty() && this.forcePlan) {
- this.forcePlan = false;
- this.recalculatePlan();
- }
-
- this.gridInv.setItemDirect(9, output);
- }
-
- private ItemStack pushTo(ItemStack output, Direction d) {
- if (output.isEmpty()) {
- return output;
- }
-
- final BlockEntity te = this.getLevel().getBlockEntity(this.worldPosition.relative(d));
-
- if (te == null) {
- return output;
- }
-
- var adaptor = InternalInventory.wrapExternal(te, d.getOpposite());
- if (adaptor == null) {
- return output;
- }
-
- final int size = output.getCount();
- output = adaptor.addItems(output);
- final int newSize = output.isEmpty() ? 0 : output.getCount();
-
- if (size != newSize) {
- this.saveChanges();
- }
-
- return output;
- }
-
- @Override
- public void onMainNodeStateChanged(IGridNodeListener.State reason) {
- if (reason != IGridNodeListener.State.GRID_BOOT) {
- boolean newState = false;
-
- var grid = getMainNode().getGrid();
- if (grid != null) {
- newState = this.getMainNode().isPowered() && grid.getEnergyService().extractAEPower(1,
- Actionable.SIMULATE, PowerMultiplier.CONFIG) > 0.0001;
- }
-
- if (newState != this.isPowered) {
- this.isPowered = newState;
- this.markForUpdate();
- }
- }
- }
-
- @Override
- public boolean isPowered() {
- return this.isPowered;
- }
-
- @Override
- public boolean isActive() {
- return this.isPowered;
- }
-
- @Environment(EnvType.CLIENT)
- public void setAnimationStatus(@Nullable AssemblerAnimationStatus status) {
- this.animationStatus = status;
- }
-
- @Environment(EnvType.CLIENT)
- @Nullable
- public AssemblerAnimationStatus getAnimationStatus() {
- return this.animationStatus;
- }
-
- @Override
- public IUpgradeInventory getUpgrades() {
- return upgrades;
- }
-
- @Nullable
- public IMolecularAssemblerSupportedPattern getCurrentPattern() {
- if (isClientSide()) {
- var patternItem = patternInv.getStackInSlot(0);
- var pattern = PatternDetailsHelper.decodePattern(patternItem, level);
- if (pattern instanceof IMolecularAssemblerSupportedPattern supportedPattern) {
- return supportedPattern;
- }
- return null;
- } else {
- return myPlan;
- }
- }
-
- private class CraftingGridFilter implements IAEItemFilter {
- private boolean hasPattern() {
- return MolecularAssemblerBlockEntity.this.myPlan != null
- && !MolecularAssemblerBlockEntity.this.patternInv.isEmpty();
- }
-
- @Override
- public boolean allowExtract(InternalInventory inv, int slot, int amount) {
- return slot == 9;
- }
-
- @Override
- public boolean allowInsert(InternalInventory inv, int slot, ItemStack stack) {
- if (slot >= 9) {
- return false;
- }
-
- if (this.hasPattern()) {
- return MolecularAssemblerBlockEntity.this.myPlan.isItemValid(slot, AEItemKey.of(stack),
- MolecularAssemblerBlockEntity.this.getLevel());
- }
- return false;
- }
- }
-}
diff --git a/src/main/java/appeng/blockentity/crafting/PatternProviderBlockEntity.java b/src/main/java/appeng/blockentity/crafting/PatternProviderBlockEntity.java
deleted file mode 100644
index 84666d39534..00000000000
--- a/src/main/java/appeng/blockentity/crafting/PatternProviderBlockEntity.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.crafting;
-
-import java.util.EnumSet;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.networking.IGridNodeListener;
-import appeng.api.stacks.AEItemKey;
-import appeng.api.util.AECableType;
-import appeng.blockentity.grid.AENetworkBlockEntity;
-import appeng.core.definitions.AEBlocks;
-import appeng.helpers.iface.PatternProviderLogic;
-import appeng.helpers.iface.PatternProviderLogicHost;
-import appeng.util.Platform;
-import appeng.util.SettingsFrom;
-
-public class PatternProviderBlockEntity extends AENetworkBlockEntity implements PatternProviderLogicHost {
- protected final PatternProviderLogic logic = createLogic();
- private boolean omniDirectional = true;
-
- public PatternProviderBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
- }
-
- protected PatternProviderLogic createLogic() {
- return new PatternProviderLogic(this.getMainNode(), this);
- }
-
- @Override
- public void onMainNodeStateChanged(IGridNodeListener.State reason) {
- this.logic.onMainNodeStateChanged();
- }
-
- public void setSide(Direction facing) {
- Direction newForward;
-
- if (!this.omniDirectional && this.getForward() == facing.getOpposite()) {
- newForward = facing;
- } else if (!this.omniDirectional
- && (this.getForward() == facing || this.getForward() == facing.getOpposite())) {
- newForward = null;
- } else if (this.omniDirectional) {
- newForward = facing.getOpposite();
- } else {
- newForward = Platform.rotateAround(this.getForward(), facing);
- }
-
- setPushDirection(newForward);
- }
-
- public void setPushDirection(@Nullable Direction direction) {
- this.omniDirectional = direction == null;
- if (direction == null) {
- direction = Direction.NORTH;
- }
-
- Direction newUp = Direction.UP;
- if (direction == Direction.UP || direction == Direction.DOWN) {
- newUp = Direction.NORTH;
- }
- this.setOrientation(direction, newUp);
-
- if (!isClientSide()) {
- this.configureNodeSides();
- this.markForUpdate();
- this.saveChanges();
- }
- }
-
- private void configureNodeSides() {
- if (this.omniDirectional) {
- this.getMainNode().setExposedOnSides(EnumSet.allOf(Direction.class));
- } else {
- this.getMainNode().setExposedOnSides(EnumSet.complementOf(EnumSet.of(this.getForward())));
- }
- }
-
- @Override
- public void addAdditionalDrops(Level level, BlockPos pos, List drops) {
- this.logic.addDrops(drops);
- }
-
- @Override
- public void onReady() {
- this.configureNodeSides();
-
- super.onReady();
- this.logic.updatePatterns();
- }
-
- @Override
- public void saveAdditional(CompoundTag data) {
- super.saveAdditional(data);
- data.putBoolean("omniDirectional", this.omniDirectional);
- this.logic.writeToNBT(data);
- }
-
- @Override
- public void loadTag(CompoundTag data) {
- super.loadTag(data);
- this.omniDirectional = data.getBoolean("omniDirectional");
-
- this.logic.readFromNBT(data);
- }
-
- @Override
- protected boolean readFromStream(FriendlyByteBuf data) {
- final boolean c = super.readFromStream(data);
- boolean oldOmniDirectional = this.omniDirectional;
- this.omniDirectional = data.readBoolean();
- return oldOmniDirectional != this.omniDirectional || c;
- }
-
- @Override
- protected void writeToStream(FriendlyByteBuf data) {
- super.writeToStream(data);
- data.writeBoolean(this.omniDirectional);
- }
-
- @Override
- public AECableType getCableConnectionType(Direction dir) {
- return AECableType.SMART;
- }
-
- @Override
- public PatternProviderLogic getLogic() {
- return logic;
- }
-
- @Override
- public EnumSet getTargets() {
- if (this.omniDirectional) {
- return EnumSet.allOf(Direction.class);
- }
- return EnumSet.of(this.getForward());
- }
-
- @Override
- public AEItemKey getTerminalIcon() {
- return AEItemKey.of(AEBlocks.PATTERN_PROVIDER.stack());
- }
-
- @Override
- public void exportSettings(SettingsFrom mode, CompoundTag output,
- @org.jetbrains.annotations.Nullable Player player) {
- super.exportSettings(mode, output, player);
-
- if (mode == SettingsFrom.MEMORY_CARD) {
- logic.exportSettings(output);
- }
- }
-
- @Override
- public void importSettings(SettingsFrom mode, CompoundTag input,
- @org.jetbrains.annotations.Nullable Player player) {
- super.importSettings(mode, input, player);
-
- if (mode == SettingsFrom.MEMORY_CARD) {
- logic.importSettings(input, player);
- }
- }
-
- public boolean isOmniDirectional() {
- return this.omniDirectional;
- }
-
- @Override
- public ItemStack getMainMenuIcon() {
- return AEBlocks.PATTERN_PROVIDER.stack();
- }
-}
diff --git a/src/main/java/appeng/blockentity/grid/AENetworkPowerBlockEntity.java b/src/main/java/appeng/blockentity/grid/AENetworkPowerBlockEntity.java
deleted file mode 100644
index d6ac19defc2..00000000000
--- a/src/main/java/appeng/blockentity/grid/AENetworkPowerBlockEntity.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.grid;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.networking.GridHelper;
-import appeng.api.networking.IGridNode;
-import appeng.api.networking.IInWorldGridNodeHost;
-import appeng.api.networking.IManagedGridNode;
-import appeng.api.networking.energy.IAEPowerStorage;
-import appeng.api.util.AECableType;
-import appeng.blockentity.powersink.AEBasePoweredBlockEntity;
-import appeng.me.helpers.BlockEntityNodeListener;
-import appeng.me.helpers.IGridConnectedBlockEntity;
-
-public abstract class AENetworkPowerBlockEntity extends AEBasePoweredBlockEntity
- implements IInWorldGridNodeHost, IGridConnectedBlockEntity {
-
- private final IManagedGridNode mainNode = createMainNode()
- .setVisualRepresentation(getItemFromBlockEntity())
- .addService(IAEPowerStorage.class, this)
- .setInWorldNode(true)
- .setTagName("proxy");
-
- public AENetworkPowerBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
- }
-
- protected IManagedGridNode createMainNode() {
- return GridHelper.createManagedNode(this, BlockEntityNodeListener.INSTANCE);
- }
-
- @Override
- public void loadTag(CompoundTag data) {
- super.loadTag(data);
- this.getMainNode().loadFromNBT(data);
- }
-
- @Override
- public void saveAdditional(CompoundTag data) {
- super.saveAdditional(data);
- this.getMainNode().saveToNBT(data);
- }
-
- public final IManagedGridNode getMainNode() {
- return this.mainNode;
- }
-
- @Nullable
- public IGridNode getGridNode() {
- return this.mainNode.getNode();
- }
-
- @Override
- public IGridNode getGridNode(Direction dir) {
- var node = this.getMainNode().getNode();
-
- // Check if the proxy exposes the node on this side
- if (node != null && node.isExposedOnSide(dir)) {
- return node;
- }
-
- return null;
- }
-
- @Override
- public AECableType getCableConnectionType(Direction dir) {
- return AECableType.SMART;
- }
-
- @Override
- public void clearRemoved() {
- super.clearRemoved();
- scheduleInit(); // Required for onReady to be called
- }
-
- @Override
- public void setRemoved() {
- super.setRemoved();
- this.getMainNode().destroy();
- }
-
- @Override
- public void onChunkUnloaded() {
- super.onChunkUnloaded();
- this.getMainNode().destroy();
- }
-
- @Override
- public void onReady() {
- super.onReady();
- this.getMainNode().create(getLevel(), getBlockEntity().getBlockPos());
- }
-
-}
diff --git a/src/main/java/appeng/blockentity/inventory/AppEngCellInventory.java b/src/main/java/appeng/blockentity/inventory/AppEngCellInventory.java
deleted file mode 100644
index 27b368d3076..00000000000
--- a/src/main/java/appeng/blockentity/inventory/AppEngCellInventory.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.inventory;
-
-import net.minecraft.world.item.ItemStack;
-
-import appeng.api.inventories.BaseInternalInventory;
-import appeng.api.storage.cells.StorageCell;
-import appeng.util.inv.AppEngInternalInventory;
-import appeng.util.inv.InternalInventoryHost;
-import appeng.util.inv.filter.IAEItemFilter;
-
-public class AppEngCellInventory extends BaseInternalInventory {
- private final AppEngInternalInventory inv;
- private final StorageCell[] handlerForSlot;
-
- public AppEngCellInventory(InternalInventoryHost host, int slots) {
- this.inv = new AppEngInternalInventory(host, slots, 1);
- this.handlerForSlot = new StorageCell[slots];
- }
-
- public void setHandler(int slot, StorageCell handler) {
- this.handlerForSlot[slot] = handler;
- }
-
- public void setFilter(IAEItemFilter filter) {
- this.inv.setFilter(filter);
- }
-
- @Override
- public void setItemDirect(int slot, ItemStack stack) {
- this.persist(slot);
- this.inv.setItemDirect(slot, stack);
- }
-
- @Override
- public int size() {
- return this.inv.size();
- }
-
- @Override
- public ItemStack getStackInSlot(int slot) {
- this.persist(slot);
- return this.inv.getStackInSlot(slot);
- }
-
- @Override
- public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
- this.persist(slot);
- return this.inv.insertItem(slot, stack, simulate);
- }
-
- @Override
- public ItemStack extractItem(int slot, int amount, boolean simulate) {
- this.persist(slot);
- return this.inv.extractItem(slot, amount, simulate);
- }
-
- @Override
- public int getSlotLimit(int slot) {
- return this.inv.getSlotLimit(slot);
- }
-
- @Override
- public boolean isItemValid(int slot, ItemStack stack) {
- return this.inv.isItemValid(slot, stack);
- }
-
- public void persist() {
- for (int i = 0; i < this.size(); ++i) {
- this.persist(i);
- }
- }
-
- private void persist(int slot) {
- if (this.handlerForSlot[slot] != null) {
- this.handlerForSlot[slot].persist();
- }
- }
-
- @Override
- public void sendChangeNotification(int slot) {
- inv.sendChangeNotification(slot);
- }
-}
diff --git a/src/main/java/appeng/blockentity/misc/CellWorkbenchBlockEntity.java b/src/main/java/appeng/blockentity/misc/CellWorkbenchBlockEntity.java
deleted file mode 100644
index 0fdcbea4390..00000000000
--- a/src/main/java/appeng/blockentity/misc/CellWorkbenchBlockEntity.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.misc;
-
-import java.util.List;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.config.CopyMode;
-import appeng.api.config.Settings;
-import appeng.api.inventories.ISegmentedInventory;
-import appeng.api.inventories.InternalInventory;
-import appeng.api.storage.cells.ICellWorkbenchItem;
-import appeng.api.upgrades.IUpgradeInventory;
-import appeng.api.upgrades.IUpgradeableObject;
-import appeng.api.upgrades.UpgradeInventories;
-import appeng.api.util.IConfigManager;
-import appeng.api.util.IConfigurableObject;
-import appeng.blockentity.AEBaseBlockEntity;
-import appeng.helpers.IConfigInvHost;
-import appeng.helpers.externalstorage.GenericStackInv;
-import appeng.util.ConfigInventory;
-import appeng.util.ConfigManager;
-import appeng.util.inv.AppEngInternalInventory;
-import appeng.util.inv.InternalInventoryHost;
-
-public class CellWorkbenchBlockEntity extends AEBaseBlockEntity
- implements IConfigurableObject, IUpgradeableObject, InternalInventoryHost, IConfigInvHost {
-
- private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1);
- private final GenericStackInv config = new GenericStackInv(this::configChanged, GenericStackInv.Mode.CONFIG_TYPES,
- 63);
- private final ConfigManager manager = new ConfigManager(this::saveChanges);
-
- private IUpgradeInventory cacheUpgrades = null;
- private ConfigInventory cacheConfig = null;
- private boolean locked = false;
-
- public CellWorkbenchBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
- this.manager.registerSetting(Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE);
- this.cell.setEnableClientEvents(true);
- }
-
- public ICellWorkbenchItem getCell() {
- if (this.cell.getStackInSlot(0).isEmpty()) {
- return null;
- }
-
- if (this.cell.getStackInSlot(0).getItem() instanceof ICellWorkbenchItem) {
- return (ICellWorkbenchItem) this.cell.getStackInSlot(0).getItem();
- }
-
- return null;
- }
-
- @Override
- public void saveAdditional(CompoundTag data) {
- super.saveAdditional(data);
- this.cell.writeToNBT(data, "cell");
- this.config.writeToChildTag(data, "config");
- this.manager.writeToNBT(data);
- }
-
- @Override
- public void loadTag(CompoundTag data) {
- super.loadTag(data);
- this.cell.readFromNBT(data, "cell");
- this.config.readFromChildTag(data, "config");
- this.manager.readFromNBT(data);
- }
-
- @Override
- public InternalInventory getSubInventory(ResourceLocation id) {
- if (id.equals(ISegmentedInventory.CELLS)) {
- return this.cell;
- }
-
- return super.getSubInventory(id);
- }
-
- @Override
- public void onChangeInventory(InternalInventory inv, int slot) {
- if (inv == this.cell && !this.locked) {
- this.locked = true;
- try {
- this.cacheUpgrades = null;
- this.cacheConfig = null;
-
- var configInventory = this.getCellConfigInventory();
- if (configInventory != null) {
- if (!configInventory.isEmpty()) {
- // Copy cell -> config inventory
- copy(configInventory, this.config);
- } else {
- // Copy config inventory -> cell, when cell's config is empty
- copy(this.config, configInventory);
- // Copy items back. The cell may change the items on insert, for example if a fluid tank gets
- // turned
- // into a dummy fluid item.
- copy(configInventory, this.config);
- }
- } else if (this.manager.getSetting(Settings.COPY_MODE) == CopyMode.CLEAR_ON_REMOVE) {
- this.config.clear();
- this.saveChanges();
- }
- } finally {
- this.locked = false;
- }
- }
- }
-
- private void configChanged() {
- if (locked) {
- return;
- }
-
- this.locked = true;
- try {
- var c = this.getCellConfigInventory();
- if (c != null) {
- copy(this.config, c);
- // Copy items back. The cell may change the items on insert, for example if a fluid tank gets turned
- // into a dummy fluid item.
- copy(c, this.config);
- }
- } finally {
- this.locked = false;
- }
- }
-
- public static void copy(GenericStackInv from, GenericStackInv to) {
- for (int i = 0; i < Math.min(from.size(), to.size()); ++i) {
- to.setStack(i, from.getStack(i));
- }
- for (int i = from.size(); i < to.size(); i++) {
- to.setStack(i, null);
- }
- }
-
- private ConfigInventory getCellConfigInventory() {
- if (this.cacheConfig == null) {
- var cell = this.getCell();
- if (cell == null) {
- return null;
- }
-
- var is = this.cell.getStackInSlot(0);
- if (is.isEmpty()) {
- return null;
- }
-
- var inv = cell.getConfigInventory(is);
- if (inv == null) {
- return null;
- }
-
- this.cacheConfig = inv;
- }
- return this.cacheConfig;
- }
-
- @Override
- public void addAdditionalDrops(Level level, BlockPos pos, List drops) {
- super.addAdditionalDrops(level, pos, drops);
-
- if (!this.cell.getStackInSlot(0).isEmpty()) {
- drops.add(this.cell.getStackInSlot(0));
- }
- }
-
- @Override
- public IConfigManager getConfigManager() {
- return this.manager;
- }
-
- @Override
- public GenericStackInv getConfig() {
- return config;
- }
-
- @Override
- public IUpgradeInventory getUpgrades() {
- if (this.cacheUpgrades == null) {
- final ICellWorkbenchItem cell = this.getCell();
- if (cell == null) {
- return UpgradeInventories.empty();
- }
-
- final ItemStack is = this.cell.getStackInSlot(0);
- if (is.isEmpty()) {
- return UpgradeInventories.empty();
- }
-
- var inv = cell.getUpgrades(is);
- if (inv == null) {
- return UpgradeInventories.empty();
- }
-
- return this.cacheUpgrades = inv;
- }
- return this.cacheUpgrades;
- }
-}
diff --git a/src/main/java/appeng/blockentity/misc/ChargerBlockEntity.java b/src/main/java/appeng/blockentity/misc/ChargerBlockEntity.java
deleted file mode 100644
index 2d9b2be26b4..00000000000
--- a/src/main/java/appeng/blockentity/misc/ChargerBlockEntity.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.misc;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Objects;
-
-import org.jetbrains.annotations.Nullable;
-
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.config.Actionable;
-import appeng.api.config.PowerMultiplier;
-import appeng.api.config.PowerUnits;
-import appeng.api.implementations.blockentities.ICrankable;
-import appeng.api.implementations.items.IAEItemPowerStorage;
-import appeng.api.inventories.InternalInventory;
-import appeng.api.networking.IGridNode;
-import appeng.api.networking.ticking.IGridTickable;
-import appeng.api.networking.ticking.TickRateModulation;
-import appeng.api.networking.ticking.TickingRequest;
-import appeng.api.stacks.AEItemKey;
-import appeng.api.util.AECableType;
-import appeng.api.util.DimensionalBlockPos;
-import appeng.blockentity.grid.AENetworkPowerBlockEntity;
-import appeng.core.AEConfig;
-import appeng.core.settings.TickRates;
-import appeng.util.Platform;
-import appeng.util.inv.AppEngInternalInventory;
-import appeng.util.inv.filter.IAEItemFilter;
-
-public class ChargerBlockEntity extends AENetworkPowerBlockEntity implements IGridTickable {
- public static final int POWER_MAXIMUM_AMOUNT = 1600;
- private static final int POWER_THRESHOLD = POWER_MAXIMUM_AMOUNT - 1;
- private boolean working;
-
- private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 1, 1, new ChargerInvFilter(this));
-
- public ChargerBlockEntity(BlockEntityType> blockEntityType, BlockPos pos, BlockState blockState) {
- super(blockEntityType, pos, blockState);
- this.getMainNode()
- .setExposedOnSides(EnumSet.noneOf(Direction.class))
- .setFlags()
- .setIdlePowerUsage(0)
- .addService(IGridTickable.class, this);
- this.setInternalMaxPower(POWER_MAXIMUM_AMOUNT);
- }
-
- @Override
- public AECableType getCableConnectionType(Direction dir) {
- return AECableType.COVERED;
- }
-
- @Override
- public void onReady() {
- var validSides = EnumSet.allOf(Direction.class);
- validSides.remove(this.getForward());
-
- this.getMainNode().setExposedOnSides(validSides);
- super.onReady();
- }
-
- @Override
- protected boolean readFromStream(FriendlyByteBuf data) {
- var changed = super.readFromStream(data);
-
- this.working = data.readBoolean();
-
- if (data.readBoolean()) {
- var item = AEItemKey.fromPacket(data);
- this.inv.setItemDirect(0, item.toStack());
- } else {
- this.inv.setItemDirect(0, ItemStack.EMPTY);
- }
-
- return changed; // TESR doesn't need updates!
- }
-
- @Override
- protected void writeToStream(FriendlyByteBuf data) {
- super.writeToStream(data);
- data.writeBoolean(working);
- var is = AEItemKey.of(this.inv.getStackInSlot(0));
- data.writeBoolean(is != null);
- if (is != null) {
- is.writeToPacket(data);
- }
- }
-
- @Override
- public void setOrientation(Direction inForward, Direction inUp) {
- super.setOrientation(inForward, inUp);
-
- var validSides = EnumSet.allOf(Direction.class);
- validSides.remove(this.getForward());
-
- this.getMainNode().setExposedOnSides(validSides);
- this.setPowerSides(validSides);
- }
-
- @Override
- public InternalInventory getInternalInventory() {
- return this.inv;
- }
-
- @Override
- public void onChangeInventory(InternalInventory inv, int slot) {
- getMainNode().ifPresent((grid, node) -> {
- grid.getTickManager().wakeDevice(node);
- });
-
- this.markForUpdate();
- }
-
- public void activate(Player player) {
- if (!Platform.hasPermissions(new DimensionalBlockPos(this), player)) {
- return;
- }
-
- final ItemStack myItem = this.inv.getStackInSlot(0);
- if (myItem.isEmpty()) {
- ItemStack held = player.getInventory().getSelected();
-
- if (ChargerRecipes.findRecipe(level, held) != null || Platform.isChargeable(held)) {
- held = player.getInventory().removeItem(player.getInventory().selected, 1);
- this.inv.setItemDirect(0, held);
- }
- } else {
- final List drops = new ArrayList<>();
- drops.add(myItem);
- this.inv.setItemDirect(0, ItemStack.EMPTY);
- Platform.spawnDrops(player.level, this.worldPosition.relative(this.getForward()), drops);
- }
- }
-
- @Override
- public TickingRequest getTickingRequest(IGridNode node) {
- return new TickingRequest(TickRates.Charger, false, true);
- }
-
- @Override
- public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
- doWork(ticksSinceLastCall);
- return TickRateModulation.FASTER;
- }
-
- private void doWork(int ticksSinceLastCall) {
- var wasWorking = this.working;
- this.working = false;
- var changed = false;
-
- var myItem = this.inv.getStackInSlot(0);
-
- if (!myItem.isEmpty()) {
-
- if (Platform.isChargeable(myItem)) {
- var ps = (IAEItemPowerStorage) myItem.getItem();
-
- var currentPower = ps.getAECurrentPower(myItem);
- var maxPower = ps.getAEMaxPower(myItem);
- if (currentPower < maxPower) {
- // Since we specify the charge rate in "per tick", calculate it per tick of the charger,
- // which only ticks once every few actual game ticks.
- var chargeRate = ps.getChargeRate(myItem) * ticksSinceLastCall
- * AEConfig.instance().getChargerChargeRate();
-
- // First charge from the local buffer
- double extractedAmount = this.extractAEPower(chargeRate, Actionable.MODULATE,
- PowerMultiplier.CONFIG);
-
- var missingChargeRate = chargeRate - extractedAmount;
- var missingAEPower = maxPower - currentPower;
- var toExtract = Math.min(missingChargeRate, missingAEPower);
-
- // Then directly extract from the grid
- var grid = getMainNode().getGrid();
- if (grid != null) {
- extractedAmount += grid.getEnergyService().extractAEPower(toExtract, Actionable.MODULATE,
- PowerMultiplier.ONE);
- }
-
- if (extractedAmount > 0) {
- var adjustment = ps.injectAEPower(myItem, extractedAmount, Actionable.MODULATE);
-
- this.setInternalCurrentPower(this.getInternalCurrentPower() + adjustment);
-
- this.working = true;
- changed = true;
- }
- }
- } else if (this.getInternalCurrentPower() > POWER_THRESHOLD
- && ChargerRecipes.findRecipe(level, myItem) != null) {
- this.working = true;
- if (Platform.getRandomFloat() > 0.8f) {
- this.extractAEPower(this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG);
-
- Item charged = Objects.requireNonNull(ChargerRecipes.findRecipe(level, myItem)).result;
- this.inv.setItemDirect(0, new ItemStack(charged));
-
- changed = true;
- }
- }
- }
-
- // charge from the network!
- if (this.getInternalCurrentPower() < POWER_THRESHOLD) {
- getMainNode().ifPresent(grid -> {
- double toExtract = Math.min(800.0, this.getInternalMaxPower() - this.getInternalCurrentPower());
- final double extracted = grid.getEnergyService().extractAEPower(toExtract, Actionable.MODULATE,
- PowerMultiplier.ONE);
-
- this.injectExternalPower(PowerUnits.AE, extracted, Actionable.MODULATE);
- });
-
- changed = true;
- }
-
- if (changed || this.working != wasWorking) {
- this.markForUpdate();
- }
- }
-
- public boolean isWorking() {
- return working;
- }
-
- /**
- * Allow cranking from the top or bottom.
- */
- @Nullable
- public ICrankable getCrankable(Direction direction) {
- var up = getUp();
- if (direction == up || direction == up.getOpposite()) {
- return new Crankable();
- }
- return null;
- }
-
- private record ChargerInvFilter(ChargerBlockEntity chargerBlockEntity) implements IAEItemFilter {
-
- @Override
- public boolean allowInsert(InternalInventory inv, int i, ItemStack itemstack) {
- return Platform.isChargeable(itemstack) || ChargerRecipes.allowInsert(chargerBlockEntity.level, itemstack);
- }
-
- @Override
- public boolean allowExtract(InternalInventory inv, int slotIndex, int amount) {
- ItemStack extractedItem = inv.getStackInSlot(slotIndex);
-
- if (Platform.isChargeable(extractedItem)) {
- final IAEItemPowerStorage ips = (IAEItemPowerStorage) extractedItem.getItem();
- if (ips.getAECurrentPower(extractedItem) >= ips.getAEMaxPower(extractedItem)) {
- return true;
- }
- }
-
- return ChargerRecipes.allowExtract(chargerBlockEntity.level, extractedItem);
- }
- }
-
- class Crankable implements ICrankable {
- @Override
- public boolean canTurn() {
- return getInternalCurrentPower() < getInternalMaxPower();
- }
-
- @Override
- public void applyTurn() {
- injectExternalPower(PowerUnits.AE, CrankBlockEntity.POWER_PER_CRANK_TURN, Actionable.MODULATE);
- }
- }
-}
diff --git a/src/main/java/appeng/blockentity/misc/ChargerRecipes.java b/src/main/java/appeng/blockentity/misc/ChargerRecipes.java
deleted file mode 100644
index 4d7c2295ac2..00000000000
--- a/src/main/java/appeng/blockentity/misc/ChargerRecipes.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package appeng.blockentity.misc;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.Level;
-
-import appeng.recipes.handlers.ChargerRecipe;
-
-public class ChargerRecipes {
-
- public static Iterable getRecipes(Level level) {
- return level.getRecipeManager().byType(ChargerRecipe.TYPE).values();
- }
-
- @Nullable
- public static ChargerRecipe findRecipe(Level level, ItemStack input) {
- for (ChargerRecipe recipe : getRecipes(level)) {
- if (recipe.ingredient.test(input)) {
- return recipe;
- }
- }
-
- return null;
- }
-
- public static boolean allowInsert(Level level, ItemStack stack) {
- return findRecipe(level, stack) != null;
- }
-
- public static boolean allowExtract(Level level, ItemStack stack) {
- return findRecipe(level, stack) == null;
- }
-
-}
diff --git a/src/main/java/appeng/blockentity/misc/CondenserBlockEntity.java b/src/main/java/appeng/blockentity/misc/CondenserBlockEntity.java
deleted file mode 100644
index a91907aebf9..00000000000
--- a/src/main/java/appeng/blockentity/misc/CondenserBlockEntity.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.blockentity.misc;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import javax.annotation.Nullable;
-
-import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
-import net.fabricmc.fabric.api.transfer.v1.storage.Storage;
-import net.fabricmc.fabric.api.transfer.v1.storage.StorageView;
-import net.fabricmc.fabric.api.transfer.v1.storage.base.InsertionOnlyStorage;
-import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
-import net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant;
-import net.minecraft.core.BlockPos;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
-
-import appeng.api.config.CondenserOutput;
-import appeng.api.config.Settings;
-import appeng.api.implementations.items.IStorageComponent;
-import appeng.api.inventories.BaseInternalInventory;
-import appeng.api.inventories.InternalInventory;
-import appeng.api.networking.security.IActionSource;
-import appeng.api.stacks.AEFluidKey;
-import appeng.api.stacks.AEKeyType;
-import appeng.api.storage.IStorageMonitorableAccessor;
-import appeng.api.storage.MEStorage;
-import appeng.api.util.IConfigManager;
-import appeng.api.util.IConfigurableObject;
-import appeng.blockentity.AEBaseInvBlockEntity;
-import appeng.core.definitions.AEItems;
-import appeng.util.ConfigManager;
-import appeng.util.inv.AppEngInternalInventory;
-import appeng.util.inv.CombinedInternalInventory;
-import appeng.util.inv.FilteredInternalInventory;
-import appeng.util.inv.filter.AEItemFilters;
-
-public class CondenserBlockEntity extends AEBaseInvBlockEntity implements IConfigurableObject {
-
- public static final int BYTE_MULTIPLIER = 8;
-
- private final ConfigManager cm = new ConfigManager(() -> {
- saveChanges();
- addPower(0);
- });
-
- private final AppEngInternalInventory outputSlot = new AppEngInternalInventory(this, 1);
- private final AppEngInternalInventory storageSlot = new AppEngInternalInventory(this, 1);
- private final InternalInventory inputSlot = new CondenseItemHandler();
- private final Storage