Reformatted, and ported back some enhancements from the Forge version.
This commit is contained in:
@@ -19,11 +19,7 @@
|
||||
package appeng.parts;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -45,7 +41,6 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -55,16 +50,8 @@ import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.parts.*;
|
||||
import appeng.api.util.*;
|
||||
import appeng.core.Api;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
@@ -335,7 +322,6 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
* null means nothing to store...
|
||||
*
|
||||
* @param from source of settings
|
||||
*
|
||||
* @return compound of source
|
||||
*/
|
||||
private CompoundTag downloadSettings(final SettingsFrom from) {
|
||||
|
||||
@@ -19,11 +19,7 @@
|
||||
package appeng.parts;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -52,15 +48,7 @@ import appeng.api.exceptions.FailedConnectionException;
|
||||
import appeng.api.implementations.parts.ICablePart;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.LayerFlags;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.parts.*;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
@@ -21,30 +21,22 @@ package appeng.parts.automation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ToolMaterials;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -75,6 +67,8 @@ import appeng.hooks.TickHandler;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.MachineSource;
|
||||
import appeng.mixins.tags.BlockTagsAccessor;
|
||||
import appeng.mixins.tags.ItemTagsAccessor;
|
||||
import appeng.parts.BasicStatePart;
|
||||
import appeng.util.FakePlayer;
|
||||
import appeng.util.IWorldCallable;
|
||||
@@ -85,6 +79,10 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
|
||||
public static final Identifier TAG_BLACKLIST = new Identifier(AppEng.MOD_ID, "blacklisted/annihilation_plane");
|
||||
|
||||
private static final Tag.Identified<Block> BLOCK_BLACKLIST = BlockTagsAccessor.register(TAG_BLACKLIST.toString());
|
||||
|
||||
private static final Tag.Identified<Item> ITEM_BLACKLIST = ItemTagsAccessor.register(TAG_BLACKLIST.toString());
|
||||
|
||||
private static final PlaneModels MODELS = new PlaneModels("part/annihilation_plane", "part/annihilation_plane_on");
|
||||
|
||||
@PartModels
|
||||
@@ -234,7 +232,6 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
* Stores an {@link ItemStack} inside the network.
|
||||
*
|
||||
* @param item {@link ItemStack} to store
|
||||
*
|
||||
* @return the leftover items, which could not be stored inside the network
|
||||
*/
|
||||
private IAEItemStack storeItemStack(final ItemStack item) {
|
||||
@@ -263,7 +260,6 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
*
|
||||
* @param entityItem the entity to update or destroy
|
||||
* @param overflow the leftover {@link IAEItemStack}
|
||||
*
|
||||
* @return true, if the entity was changed otherwise false.
|
||||
*/
|
||||
private boolean handleOverflow(final ItemEntity entityItem, final IAEItemStack overflow) {
|
||||
@@ -434,11 +430,10 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
|
||||
/**
|
||||
* Checks if the network can store the possible drops.
|
||||
*
|
||||
* <p>
|
||||
* It also sets isAccepting to false, if the item can not be stored.
|
||||
*
|
||||
* @param itemStacks an array of {@link ItemStack} to test
|
||||
*
|
||||
* @return true, if the network can store at least a single item of all drops or
|
||||
* no drops are reported
|
||||
*/
|
||||
@@ -526,13 +521,11 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklisted(Block b) {
|
||||
Tag<Block> tag = BlockTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
|
||||
return b.isIn(tag);
|
||||
return BLOCK_BLACKLIST.contains(b);
|
||||
}
|
||||
|
||||
public static boolean isItemBlacklisted(Item i) {
|
||||
Tag<Item> tag = ItemTags.getTagGroup().getTagOrEmpty(TAG_BLACKLIST);
|
||||
return i.isIn(tag);
|
||||
return ITEM_BLACKLIST.contains(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,14 +28,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
|
||||
@@ -45,13 +45,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
|
||||
@@ -25,7 +25,6 @@ import javax.annotation.Nonnull;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -25,11 +25,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
|
||||
@@ -35,18 +35,8 @@ import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.LevelType;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.crafting.ICraftingWatcher;
|
||||
import appeng.api.networking.crafting.ICraftingWatcherHost;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.crafting.*;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergyWatcher;
|
||||
import appeng.api.networking.energy.IEnergyWatcherHost;
|
||||
|
||||
@@ -18,11 +18,7 @@
|
||||
|
||||
package appeng.parts.automation;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class SharedItemBusPart extends UpgradeablePart implements IGrid
|
||||
|
||||
/**
|
||||
* Checks if the bus can actually do something.
|
||||
*
|
||||
* <p>
|
||||
* Currently this tests if the chunk for the target is actually loaded.
|
||||
*
|
||||
* @return true, if the the bus should do its work.
|
||||
|
||||
@@ -37,12 +37,7 @@ import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.*;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@@ -18,12 +18,7 @@
|
||||
|
||||
package appeng.parts.misc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -35,16 +34,10 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attributes;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import alexiil.mc.lib.attributes.item.ItemAttributes;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -59,12 +52,7 @@ import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.api.storage.*;
|
||||
import appeng.api.storage.cells.ICellContainer;
|
||||
import appeng.api.storage.cells.ICellInventory;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
|
||||
@@ -26,7 +26,7 @@ import appeng.items.parts.PartModels;
|
||||
|
||||
/**
|
||||
* A more sophisticated part overlapping all 3 textures.
|
||||
*
|
||||
* <p>
|
||||
* Subclass this if you need want a new part and need all 3 textures. For more
|
||||
* concrete implementations, the direct abstract subclasses might be a better
|
||||
* alternative.
|
||||
|
||||
@@ -57,7 +57,7 @@ import appeng.util.item.AEItemStack;
|
||||
/**
|
||||
* A basic subclass for any item monitor like display with an item icon and an
|
||||
* amount.
|
||||
*
|
||||
* <p>
|
||||
* It can also be used to extract items from somewhere and spawned into the
|
||||
* world.
|
||||
*
|
||||
|
||||
@@ -27,7 +27,7 @@ import appeng.items.parts.PartModels;
|
||||
|
||||
/**
|
||||
* A very simple part for emitting light.
|
||||
*
|
||||
* <p>
|
||||
* Opposed to the other subclass of {@link AbstractReportingPart}, it will only
|
||||
* use the bright front texture.
|
||||
*
|
||||
|
||||
@@ -48,10 +48,10 @@ import appeng.util.Platform;
|
||||
/**
|
||||
* The most basic class for any part reporting information, like terminals or
|
||||
* monitors. This can also include basic panels which just provide light.
|
||||
*
|
||||
* <p>
|
||||
* It deals with the most basic functionalities like network data, grid
|
||||
* registration or the rotation of the actual part.
|
||||
*
|
||||
* <p>
|
||||
* The direct abstract subclasses are usually a better entry point for adding
|
||||
* new concrete ones. But this might be an ideal starting point to completely
|
||||
* new type, which does not resemble any existing one.
|
||||
|
||||
@@ -51,7 +51,7 @@ import appeng.util.inv.InvOperation;
|
||||
|
||||
/**
|
||||
* Anything resembling an network terminal with view cells can reuse this.
|
||||
*
|
||||
* <p>
|
||||
* Note this applies only to terminals like the ME Terminal. It does not apply
|
||||
* for more specialized terminals like the Interface Terminal.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user