Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bb23bcac8 | |||
| 06735f5c39 | |||
| e8143d3618 | |||
| 0d43ca15be | |||
| d18eabe1fc | |||
| d9d491d51c | |||
| 9a5bd114a4 | |||
| 30cc8c8abc | |||
| 815094e5bf | |||
| 1eaddef694 | |||
| 450299cb67 | |||
| 235fc2e81f |
@@ -12,10 +12,9 @@
|
||||
* [Downloads](#downloads)
|
||||
* [Installation](#installation)
|
||||
* [Issues](#issues)
|
||||
* [API](#applied-energistics-2-api)
|
||||
* [Building](#building)
|
||||
* [Contribution](#contribution)
|
||||
* [API](#applied-energistics-2-api)
|
||||
* [CraftTweaker](#applied-energistics-2-crafttweaker)
|
||||
* [Localization](#applied-energistics-2-localization)
|
||||
* [Credits](#credits)
|
||||
|
||||
@@ -67,6 +66,38 @@ Providing as many details as possible does help us to find and resolve the issue
|
||||
|
||||
Please note that we might close any issue not matching these requirements.
|
||||
|
||||
## Applied Energistics 2 API
|
||||
|
||||
The API for Applied Energistics 2. It is open source to discuss changes, improve documentation, and provide better add-on support in general.
|
||||
|
||||
### Maven
|
||||
|
||||
We use Github Packages as maven repository now. You can use the following snippet as example on how to add a repository to your gradle build file.
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name "AE2"
|
||||
url "https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2"
|
||||
}
|
||||
}
|
||||
|
||||
When compiling against the AE2 API you can use gradle dependencies, just add
|
||||
|
||||
dependencies {
|
||||
compileOnly "appeng:appliedenergistics2:VERSION:api"
|
||||
}
|
||||
|
||||
or add the `compileOnly` line to your existing dependencies task to your build.gradle.
|
||||
|
||||
Replace `VERSION` with the desired one. With 1.15+ we switched to using [semver](https://semver.org/).
|
||||
It is highly recommended following its specification and further considering an upper bound for the dependency version.
|
||||
A change of the `MAJOR` version will be an API break and can lead to various crashes. Better to inform a player about the addon not supporting the new version until it could be tested or updated.
|
||||
|
||||
An example string would be `appeng:appliedenergistics2:7.0.0-alpha.6:api` for the API only or `appeng:appliedenergistics2:7.0.0-alpha.6` for the whole mod.
|
||||
|
||||
Builds obtained [here](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases) or via [maven](https://github.com/AppliedEnergistics/Applied-Energistics-2/packages) should work in a development environment.
|
||||
However the dependency might need to be wrapped in `fg.deobf()` like `runtimeOnly fg.deobf("appeng:appliedenergistics2:VERSION:api")`
|
||||
|
||||
## Building
|
||||
|
||||
1. Clone this repository via
|
||||
@@ -110,66 +141,6 @@ Here are a few things to keep in mind that will help get your PR approved.
|
||||
|
||||
If you are only doing single file pull requests, GitHub supports using a quick way without the need of cloning your fork. Also read up about [synching](https://help.github.com/articles/syncing-a-fork) if you plan to contribute on regular basis.
|
||||
|
||||
## Applied Energistics 2 API
|
||||
|
||||
The API for Applied Energistics 2. It is open source to discuss changes, improve documentation, and provide better add-on support in general.
|
||||
|
||||
Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work in a development environment.
|
||||
|
||||
### Maven
|
||||
|
||||
When compiling against the AE2 API you can use gradle dependencies, just add
|
||||
|
||||
dependencies {
|
||||
compile "appeng:appliedenergistics2:rv_-_____-__:api"
|
||||
}
|
||||
|
||||
or add the compile line to your existing dependencies task to your build.gradle
|
||||
|
||||
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
|
||||
|
||||
An example string would be `appeng:appliedenergistics2:rv5-stable-1:api` for the API only or `appeng:appliedenergistics2:rv5-stable-1` for the whole mod.
|
||||
|
||||
## Applied Energistics 2 CraftTweaker
|
||||
|
||||
### Inscriber
|
||||
|
||||
The inscriber uses the vanilla recipe system with a custom `type` of `appliedenergistics2:inscriber`.
|
||||
See the [inscriber recipe folder](src/main/resources/data/appliedenergistics2/recipes/inscriber) for some examples.
|
||||
|
||||
### Grindstone
|
||||
|
||||
The grindstone uses the vanilla recipe system with a custom `type` of `appliedenergistics2:grinder`.
|
||||
See the [grinder recipe folder](src/main/resources/data/appliedenergistics2/recipes/grinder) for some examples.
|
||||
|
||||
### Spatial
|
||||
Whitelist a TileEntity class for Spatial IO.
|
||||
|
||||
mods.appliedenergistics2.Spatial.whitelistEntity( String fullEntityClassName );
|
||||
|
||||
### Attunement
|
||||
Attune a ItemStack or ModID to a specific P2P-Tunnel type. ModID's are used as fallback when no ItemStack was found.
|
||||
|
||||
mods.appliedenergistics2.Attunement.attuneME( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneME( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneItem( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneItem( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneFluid( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneFluid( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneRedstone( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneRedstone( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneRF( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneRF( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneIC2( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneIC2( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneLight( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneLight( String modID );
|
||||
|
||||
### Cannon
|
||||
Add ammo types for the matter cannon.
|
||||
|
||||
mods.appliedenergistics2.Cannon.registerAmmo( ItemStack itemStack, double weight );
|
||||
|
||||
## Applied Energistics 2 Localization
|
||||
|
||||
### English Text
|
||||
|
||||
@@ -26,12 +26,16 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Use this annotation on a class in your Mod to have it instantiated during the
|
||||
* initialization phase of Applied Energistics. AE expects your class to have a
|
||||
* single constructor and can supply certain arguments to your constructor using
|
||||
* dependency injection.
|
||||
* initialization phase of Applied Energistics.
|
||||
*
|
||||
* The class also needs to implement {@link IAEAddon}.
|
||||
*
|
||||
* AE expects your class to have a single constructor without any parameters.
|
||||
*
|
||||
* This is the only way to get access to the public {@link IAppEngApi} instance.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Documented
|
||||
public @interface AEPlugin {
|
||||
public @interface AEAddon {
|
||||
}
|
||||
@@ -1,67 +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;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import appeng.api.exceptions.CoreInaccessibleException;
|
||||
|
||||
/**
|
||||
* Entry point for api.
|
||||
*/
|
||||
public enum AEApi {
|
||||
;
|
||||
|
||||
private static final String CORE_API_FQN = "appeng.core.Api";
|
||||
private static final String CORE_API_FIELD = "INSTANCE";
|
||||
private static final IAppEngApi HELD_API;
|
||||
|
||||
static {
|
||||
try {
|
||||
final Class<?> apiClass = Class.forName(CORE_API_FQN);
|
||||
final Field apiField = apiClass.getField(CORE_API_FIELD);
|
||||
|
||||
HELD_API = (IAppEngApi) apiField.get(apiClass);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
throw new CoreInaccessibleException(
|
||||
"AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared.");
|
||||
} catch (final NoSuchFieldException e) {
|
||||
throw new CoreInaccessibleException("AE2 API tried to access the " + CORE_API_FIELD + " field in "
|
||||
+ CORE_API_FQN + " without it being declared.");
|
||||
} catch (final IllegalAccessException e) {
|
||||
throw new CoreInaccessibleException("AE2 API tried to access the " + CORE_API_FIELD + " field in "
|
||||
+ CORE_API_FQN + " without enough access permissions.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API Entry Point.
|
||||
*
|
||||
* @return the {@link IAppEngApi}
|
||||
*/
|
||||
public static IAppEngApi instance() {
|
||||
return HELD_API;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +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 <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.api;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Marks interfaces that can be used as injectable constructor arguments for an
|
||||
* {@link AEPlugin}.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AEInjectable {
|
||||
}
|
||||
+20
-16
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
* Copyright (c) 2020 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
|
||||
@@ -21,26 +21,30 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.implementations;
|
||||
package appeng.api;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
/**
|
||||
* Implemented on {@link Item}
|
||||
* Every AE2 addon requiring access to {@link IAppEngApi}, needs to provide at
|
||||
* least one class implementing this interface.
|
||||
*
|
||||
* Further it requires the class to be annotated with {@link AEAddon}.
|
||||
*
|
||||
*/
|
||||
public interface ICraftingPatternItem {
|
||||
public interface IAEAddon {
|
||||
|
||||
/**
|
||||
* Access Details about a pattern
|
||||
*
|
||||
* @param is pattern
|
||||
* @param w crafting world
|
||||
*
|
||||
* @return details of pattern
|
||||
* This gets called once the API is successfully constructed and ready to be
|
||||
* used.
|
||||
*
|
||||
* For now this happens during {@link FMLCommonSetupEvent}.
|
||||
*
|
||||
* Each addon is responsible to maintain a reference to {@link IAppEngApi} for
|
||||
* future use. Otherwise there is no alternative to access it later.
|
||||
*
|
||||
* @param api The API instance when ready.
|
||||
*/
|
||||
ICraftingPatternDetails getPatternForItem(ItemStack is, World w);
|
||||
void onAPIAvailable(IAppEngApi api);
|
||||
|
||||
}
|
||||
@@ -23,16 +23,22 @@
|
||||
|
||||
package appeng.api;
|
||||
|
||||
import appeng.api.client.IClientHelper;
|
||||
import appeng.api.crafting.ICraftingHelper;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.IClientHelper;
|
||||
|
||||
@AEInjectable
|
||||
public interface IAppEngApi {
|
||||
|
||||
/**
|
||||
* @return An accessible list of all AE definitions
|
||||
*/
|
||||
IDefinitions definitions();
|
||||
|
||||
/**
|
||||
* @return Registry Container for the numerous registries in AE2.
|
||||
*/
|
||||
@@ -43,6 +49,11 @@ public interface IAppEngApi {
|
||||
*/
|
||||
IStorageHelper storage();
|
||||
|
||||
/**
|
||||
* @return A helper for working with crafting related tasks.
|
||||
*/
|
||||
ICraftingHelper crafting();
|
||||
|
||||
/**
|
||||
* @return A helper to create {@link IGridNode} and other grid related objects.
|
||||
*/
|
||||
@@ -53,11 +64,6 @@ public interface IAppEngApi {
|
||||
*/
|
||||
IPartHelper partHelper();
|
||||
|
||||
/**
|
||||
* @return An accessible list of all AE definitions
|
||||
*/
|
||||
IDefinitions definitions();
|
||||
|
||||
/**
|
||||
* @return Utility methods primarily useful for client side stuff
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 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.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* A registry for 3D models used to render storage cells in the world, when they
|
||||
* are inserted into a drive or similar machines.
|
||||
*/
|
||||
public interface ICellModelRegistry {
|
||||
|
||||
/**
|
||||
* Register a new model for a storage cell item.
|
||||
*
|
||||
* <p>
|
||||
* You are responsible for ensuring that the given model is actually loaded by
|
||||
* the game. See
|
||||
* {@see net.minecraftforge.client.model.ModelLoader#addSpecialModel}.
|
||||
*
|
||||
* This method only maps an {@link Item} to a {@link ResourceLocation} which can
|
||||
* be looked up from the {@link ModelBakery}. No validation about missing models
|
||||
* will be done.
|
||||
*
|
||||
* Will throw an exception in case a model is already registered for an item.
|
||||
*
|
||||
* For examples look at our cell part models within the drive model directory.
|
||||
*
|
||||
* @param item The cell item
|
||||
* @param model The {@link ResourceLocation} representing the model.
|
||||
* @return
|
||||
*/
|
||||
void registerModel(@Nonnull Item item, @Nonnull ResourceLocation model);
|
||||
|
||||
/**
|
||||
* The {@link ResourceLocation} of the model used to render the given storage
|
||||
* cell {@link Item} when inserted into a drive or similar.
|
||||
*
|
||||
* @param item
|
||||
* @return null, if no model is registered.
|
||||
*/
|
||||
@Nullable
|
||||
ResourceLocation model(@Nonnull Item item);
|
||||
|
||||
/**
|
||||
* An unmodifiable map of all registered mappings.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
Map<Item, ResourceLocation> models();
|
||||
|
||||
/**
|
||||
* Returns the default model, which can be used when no explicit model is
|
||||
* registered.
|
||||
*/
|
||||
@Nonnull
|
||||
ResourceLocation getDefaultModel();
|
||||
|
||||
}
|
||||
+8
-1
@@ -21,7 +21,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.util;
|
||||
package appeng.api.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,4 +39,11 @@ public interface IClientHelper {
|
||||
*/
|
||||
<T extends IAEStack<T>> void addCellInformation(ICellInventoryHandler<T> handler, List<ITextComponent> lines);
|
||||
|
||||
/**
|
||||
* A helper to work with clientside related tasks for cells.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ICellModelRegistry cells();
|
||||
|
||||
}
|
||||
@@ -23,7 +23,11 @@
|
||||
|
||||
package appeng.api.config;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -34,6 +38,7 @@ import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
public enum Upgrades {
|
||||
/**
|
||||
@@ -72,11 +77,11 @@ public enum Upgrades {
|
||||
* @param item machine in which this upgrade can be installed
|
||||
* @param maxSupported amount how many upgrades can be installed
|
||||
* @param tooltipGroup If more than one item of the same group are supported,
|
||||
* the tooltip will show this group name instead. If the
|
||||
* items have different maxSupported values, the highest
|
||||
* the tooltip will show this translation key instead. If
|
||||
* the items have different maxSupported values, the highest
|
||||
* will be shown.
|
||||
*/
|
||||
public void registerItem(final IItemProvider item, final int maxSupported, @Nullable ITextComponent tooltipGroup) {
|
||||
public void registerItem(final IItemProvider item, final int maxSupported, @Nullable String tooltipGroup) {
|
||||
Preconditions.checkNotNull(item);
|
||||
this.supported.add(new Supported(item.asItem(), maxSupported, tooltipGroup));
|
||||
supportedTooltipLines = null; // Reset tooltip
|
||||
@@ -95,17 +100,17 @@ public enum Upgrades {
|
||||
ITextComponent name = supported.item.getName();
|
||||
|
||||
// If the group was already added by a previous item, skip this
|
||||
if (supported.tooltipGroup != null && namesAdded.contains(supported.tooltipGroup)) {
|
||||
if (supported.getTooltipGroup() != null && namesAdded.contains(supported.getTooltipGroup())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If any of the following items would be of the same group, use the group name
|
||||
// instead
|
||||
if (supported.tooltipGroup != null) {
|
||||
if (supported.getTooltipGroup() != null) {
|
||||
for (int j = i + 1; j < this.supported.size(); j++) {
|
||||
ITextComponent otherGroup = this.supported.get(j).tooltipGroup;
|
||||
if (supported.tooltipGroup.equals(otherGroup)) {
|
||||
name = supported.tooltipGroup;
|
||||
ITextComponent otherGroup = this.supported.get(j).getTooltipGroup();
|
||||
if (supported.getTooltipGroup().equals(otherGroup)) {
|
||||
name = supported.getTooltipGroup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -132,10 +137,11 @@ public enum Upgrades {
|
||||
private final Item item;
|
||||
private final Block block;
|
||||
private final int maxCount;
|
||||
// Translation key of the tooltip group
|
||||
@Nullable
|
||||
private final ITextComponent tooltipGroup;
|
||||
private final String tooltipGroup;
|
||||
|
||||
public Supported(Item item, int maxCount, @Nullable ITextComponent tooltipGroup) {
|
||||
public Supported(Item item, int maxCount, @Nullable String tooltipGroup) {
|
||||
this.item = item;
|
||||
if (item.getItem() instanceof BlockItem) {
|
||||
this.block = ((BlockItem) item.getItem()).getBlock();
|
||||
@@ -158,6 +164,10 @@ public enum Upgrades {
|
||||
return item != null && this.item == item;
|
||||
}
|
||||
|
||||
public ITextComponent getTooltipGroup() {
|
||||
return this.tooltipGroup != null ? new TranslationTextComponent(this.tooltipGroup) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 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.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
public interface ICraftingHelper {
|
||||
|
||||
/**
|
||||
* Checks that the given item stack is an encoded pattern.
|
||||
*/
|
||||
boolean isEncodedPattern(@Nullable IAEItemStack item);
|
||||
|
||||
/**
|
||||
* Checks that the given item stack is an encoded pattern.
|
||||
*/
|
||||
boolean isEncodedPattern(ItemStack item);
|
||||
|
||||
/**
|
||||
* 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 stack If null, a new item will be created to hold the encoded pattern.
|
||||
* Otherwise the given item must already contains an encoded
|
||||
* pattern that will be overwritten.
|
||||
* @return A new encoded pattern, or the given stack with the pattern encoded in
|
||||
* it.
|
||||
*/
|
||||
ItemStack encodeProcessingPattern(@Nullable ItemStack stack, ItemStack[] in, ItemStack[] out);
|
||||
|
||||
/**
|
||||
* Encodes a crafting pattern which represents a Vanilla crafting recipe.
|
||||
*
|
||||
* @param stack If null, a new item will be created to hold the
|
||||
* encoded pattern. Otherwise the given item must
|
||||
* already contains an encoded pattern that will be
|
||||
* overwritten.
|
||||
* @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.
|
||||
*/
|
||||
ItemStack encodeCraftingPattern(@Nullable ItemStack stack, ICraftingRecipe recipe, ItemStack[] in, ItemStack out,
|
||||
boolean allowSubstitutes);
|
||||
|
||||
/**
|
||||
* Same as {@link #decodePattern(ItemStack, World, boolean)} with no auto
|
||||
* recovery of changed recipe ids.
|
||||
*/
|
||||
@Nullable
|
||||
default ICraftingPatternDetails decodePattern(@Nonnull ItemStack itemStack, @Nonnull World world) {
|
||||
return decodePattern(itemStack, world, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes an encoded crafting pattern and returns the pattern details.
|
||||
* <p>
|
||||
* The item backing the {@link ItemStack} needs to be an item returned by the
|
||||
* encode methods of this class.
|
||||
*
|
||||
* @param itemStack pattern
|
||||
* @param world world used to access the
|
||||
* {@link net.minecraft.item.crafting.RecipeManager}.
|
||||
* @param autoRecovery If true, the method will try to recover from changed
|
||||
* recipe ids by searching the entire recipe manager for a
|
||||
* recipe matching the inputs. If this is successful, the
|
||||
* given item stack will be changed to reflect the new
|
||||
* recipe id.
|
||||
* @return The pattern details if the pattern could be decoded. Otherwise null.
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingPatternDetails decodePattern(@Nonnull ItemStack itemStack, @Nonnull World world, boolean autoRecovery);
|
||||
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
package appeng.api.features;
|
||||
|
||||
import appeng.api.AEInjectable;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.parts.IPartModels;
|
||||
@@ -36,7 +35,6 @@ import appeng.api.storage.ICellRegistry;
|
||||
* @version 7
|
||||
* @since rv0
|
||||
*/
|
||||
@AEInjectable
|
||||
public interface IRegistryContainer {
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,18 +28,25 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.cells.ICellHandler;
|
||||
import appeng.api.storage.cells.ICellInventory;
|
||||
import appeng.api.storage.cells.ICellWorkbenchItem;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
/**
|
||||
* Any item which implements this can be treated as an IMEInventory via
|
||||
* Util.getCell / Util.isCell It automatically handles the internals and NBT
|
||||
* data, which is both nice, and bad for you!
|
||||
* {@link ICellHandler#getCellInventory(ItemStack, appeng.api.storage.cells.ISaveProvider, IStorageChannel)}
|
||||
* or {@link ICellHandler#isCell(ItemStack)}. It automatically handles the
|
||||
* internals and NBT data, which is both nice, and bad for you!
|
||||
*
|
||||
* Good cause it means you don't have to do anything, bad because you have
|
||||
* little to no control over it.
|
||||
*
|
||||
* The standard AE implementation only provides 1-63 Types
|
||||
*
|
||||
* Limited to {@link Integer} internally for most calculations. E.g. if the used
|
||||
* or remaining bytes would overflow {@link Integer#MAX_VALUE} the behaviour is
|
||||
* no longer specified. Even if {@link ICellInventory} is using {@link Long}.
|
||||
*
|
||||
* The standard AE implementation also only provides 1-63 Types.
|
||||
*/
|
||||
public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem {
|
||||
|
||||
|
||||
@@ -91,16 +91,6 @@ public interface IGridBlock {
|
||||
*/
|
||||
void onGridNotification(@Nonnull GridNotification notification);
|
||||
|
||||
/**
|
||||
* Update Blocks network/connection/booting status. grid,
|
||||
*
|
||||
* @param grid grid
|
||||
* @param channelsInUse used channels
|
||||
* @deprecated to be removed in rv7
|
||||
*/
|
||||
@Deprecated
|
||||
void setNetworkStatus(IGrid grid, int channelsInUse);
|
||||
|
||||
/**
|
||||
* Determine which sides of the block can be connected too, only used when
|
||||
* isWorldAccessible returns true, not used for {@link IPart} implementations.
|
||||
|
||||
@@ -27,18 +27,19 @@ import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
/**
|
||||
* do not implement provided by {@link ICraftingPatternItem}
|
||||
*
|
||||
* caching this INSTANCE will increase performance of validation and checks.
|
||||
* Describes a crafting or processing pattern decoded by
|
||||
* {@link appeng.api.crafting.ICraftingHelper}.
|
||||
* <p>
|
||||
* Do not cache instances of this class unless you handle recipe reloads on the
|
||||
* server and client correctly.
|
||||
*/
|
||||
public interface ICraftingPatternDetails {
|
||||
|
||||
/**
|
||||
* @return source item.
|
||||
* @return encodes this crafting pattern into a new item stack.
|
||||
*/
|
||||
ItemStack getPattern();
|
||||
|
||||
@@ -52,7 +53,9 @@ public interface ICraftingPatternDetails {
|
||||
boolean isValidItemForSlot(int slotIndex, ItemStack itemStack, World world);
|
||||
|
||||
/**
|
||||
* @return if this pattern is a crafting pattern ( work bench )
|
||||
* @return if this pattern is for a Vanilla
|
||||
* {@link net.minecraft.item.crafting.IRecipeType#CRAFTING crafting
|
||||
* recipe}.
|
||||
*/
|
||||
boolean isCraftable();
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
package appeng.api.networking.crafting;
|
||||
|
||||
import appeng.api.crafting.ICraftingHelper;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
/**
|
||||
@@ -33,6 +34,9 @@ public interface ICraftingProviderHelper {
|
||||
|
||||
/**
|
||||
* Add new Pattern to AE's crafting cache.
|
||||
*
|
||||
* This will only accept instances created by
|
||||
* {@link ICraftingHelper#decodePattern(net.minecraft.item.ItemStack, net.minecraft.world.World)}
|
||||
*/
|
||||
void addCraftingOption(ICraftingMedium medium, ICraftingPatternDetails api);
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
package appeng.api.networking.security;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
@@ -31,6 +31,6 @@ public interface ICustomCableConnection {
|
||||
* @return This controls the cable connection to the node. -1 to render
|
||||
* connection yourself.
|
||||
*/
|
||||
public float getCableConnectionLength(AECableType cable);
|
||||
float getCableConnectionLength(AECableType cable);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
package appeng.api.parts;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ public interface IPart extends ICustomCableConnection {
|
||||
* the node. -1 to render connection yourself.
|
||||
*/
|
||||
@Override
|
||||
public float getCableConnectionLength(AECableType cable);
|
||||
float getCableConnectionLength(AECableType cable);
|
||||
|
||||
/**
|
||||
* same as Block.animateTick, for but parts.
|
||||
@@ -376,7 +376,7 @@ public interface IPart extends ICustomCableConnection {
|
||||
* This will be used by the core to add information about this part to a crash
|
||||
* report if it is attached to a host that caused a crash during tick
|
||||
* processing.
|
||||
*
|
||||
*
|
||||
* @param section The crash report section the information will be added to.
|
||||
*/
|
||||
default void addEntityCrashInfo(final CrashReportCategory section) {
|
||||
|
||||
@@ -23,13 +23,10 @@ import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.AEInjectable;
|
||||
|
||||
/**
|
||||
* Allows registration of part models that can then be used in
|
||||
* {@link IPart#getStaticModels()}.
|
||||
*/
|
||||
@AEInjectable
|
||||
public interface IPartModels {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,54 +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.recipes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RecipeException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
@Deprecated
|
||||
public interface ICraftHandler {
|
||||
|
||||
/**
|
||||
* Called when your recipe handler receives a newly parsed list of
|
||||
* inputs/outputs.
|
||||
*
|
||||
* @param input parsed inputs
|
||||
* @param output parsed outputs
|
||||
*
|
||||
* @throws RecipeException
|
||||
*/
|
||||
void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeException;
|
||||
|
||||
/**
|
||||
* called when all recipes are parsed, and your required to register your
|
||||
* recipe.
|
||||
*
|
||||
* @throws RegistrationException
|
||||
* @throws MissingIngredientException
|
||||
*/
|
||||
void register() throws RegistrationException, MissingIngredientException;
|
||||
}
|
||||
@@ -1,92 +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.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
@Deprecated
|
||||
public interface IIngredient {
|
||||
|
||||
/**
|
||||
* Acquire a single input stack for the current recipe, if more then one
|
||||
* ItemStack is possible a RegistrationError exception will be thrown, ignore
|
||||
* these and let the system handle the error.
|
||||
*
|
||||
* @return a single ItemStack for the recipe handler.
|
||||
*
|
||||
* @throws RegistrationException
|
||||
* @throws MissingIngredientException
|
||||
*/
|
||||
ItemStack getItemStack() throws RegistrationException, MissingIngredientException;
|
||||
|
||||
/**
|
||||
* Acquire a list of all the input stacks for the current recipe, this is for
|
||||
* handlers that support multiple inputs per slot.
|
||||
*
|
||||
* @return an array of ItemStacks for the recipe handler.
|
||||
*
|
||||
* @throws RegistrationException
|
||||
* @throws MissingIngredientException
|
||||
*/
|
||||
ItemStack[] getItemStackSet() throws RegistrationException, MissingIngredientException;
|
||||
|
||||
/**
|
||||
* If you wish to support air, you must test before getting the ItemStack, or
|
||||
* ItemStackSet
|
||||
*
|
||||
* @return true if this slot contains no ItemStack, this is passed as "_"
|
||||
*/
|
||||
boolean isAir();
|
||||
|
||||
/**
|
||||
* @return The Name Space of the item. Prefer getItemStack or getItemStackSet
|
||||
*/
|
||||
String getNameSpace();
|
||||
|
||||
/**
|
||||
* @return The Name of the item. Prefer getItemStack or getItemStackSet
|
||||
*/
|
||||
String getItemName();
|
||||
|
||||
/**
|
||||
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
|
||||
*/
|
||||
int getDamageValue();
|
||||
|
||||
/**
|
||||
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
|
||||
*/
|
||||
int getQty();
|
||||
|
||||
/**
|
||||
* Bakes the lists in for faster runtime look-ups.
|
||||
*
|
||||
* @throws MissingIngredientException
|
||||
* @throws RegistrationException
|
||||
*/
|
||||
void bake() throws RegistrationException, MissingIngredientException;
|
||||
}
|
||||
@@ -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.recipes;
|
||||
|
||||
/**
|
||||
* Represents the AE2 Recipe Loading/Reading Class
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IRecipeHandler {
|
||||
|
||||
/**
|
||||
* Call when you want to read recipes in from a file based on a loader
|
||||
*
|
||||
* @param loader recipe loader
|
||||
* @param path path of file
|
||||
*/
|
||||
void parseRecipes(IRecipeLoader loader, String path);
|
||||
|
||||
/**
|
||||
* this loads the read recipes into minecraft, should be called in Init.
|
||||
*/
|
||||
void injectRecipes();
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 - 2015 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.recipes;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@Deprecated
|
||||
public interface IRecipeLoader {
|
||||
/**
|
||||
* @param filePath the path to the to be loaded file
|
||||
*
|
||||
* @return reader handler of the file
|
||||
*
|
||||
* @throws Exception if reading goes wrong
|
||||
*/
|
||||
BufferedReader getFile(@Nonnull String filePath) throws Exception;
|
||||
}
|
||||
@@ -1,45 +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.recipes;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
public class ResolverResult {
|
||||
|
||||
public final String itemName;
|
||||
public final int damageValue;
|
||||
public final CompoundNBT compound;
|
||||
|
||||
public ResolverResult(final String name, final int damage) {
|
||||
this.itemName = name;
|
||||
this.damageValue = damage;
|
||||
this.compound = null;
|
||||
}
|
||||
|
||||
public ResolverResult(final String name, final int damage, final CompoundNBT data) {
|
||||
this.itemName = name;
|
||||
this.damageValue = damage;
|
||||
this.compound = data;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +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.recipes;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ResolverResultSet {
|
||||
|
||||
public final String name;
|
||||
public final List<ItemStack> results;
|
||||
|
||||
public ResolverResultSet(final String myName, final ItemStack... set) {
|
||||
this.results = Arrays.asList(set);
|
||||
this.name = myName;
|
||||
}
|
||||
}
|
||||
@@ -179,17 +179,7 @@ public interface IAEStack<T extends IAEStack<T>> {
|
||||
T empty();
|
||||
|
||||
/**
|
||||
* @return true if the stack is a {@link IAEItemStack}
|
||||
*/
|
||||
boolean isItem();
|
||||
|
||||
/**
|
||||
* @return true if the stack is a {@link IAEFluidStack}
|
||||
*/
|
||||
boolean isFluid();
|
||||
|
||||
/**
|
||||
* @return ITEM or FLUID
|
||||
* @return The {@link IStorageChannel} backing this stack.
|
||||
*/
|
||||
IStorageChannel<T> getChannel();
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage {
|
||||
@@ -123,7 +123,7 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
|
||||
|
||||
private double getMaxEnergyCapacity() {
|
||||
final Block blockID = Block.getBlockFromItem(this);
|
||||
final IBlockDefinition energyCell = AEApi.instance().definitions().blocks().energyCell();
|
||||
final IBlockDefinition energyCell = Api.instance().definitions().blocks().energyCell();
|
||||
|
||||
return energyCell.maybeBlock().map(block -> {
|
||||
if (blockID == block) {
|
||||
|
||||
@@ -21,10 +21,10 @@ package appeng.block.crafting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.block.AEBaseBlockItem;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
|
||||
public class CraftingStorageItem extends AEBaseBlockItem {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CraftingStorageItem extends AEBaseBlockItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
||||
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack(1).orElse(ItemStack.EMPTY);
|
||||
return Api.instance().definitions().blocks().craftingUnit().maybeStack(1).orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,13 +49,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.misc.ChargerTileEntity;
|
||||
import appeng.util.Platform;
|
||||
@@ -101,7 +101,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerTileEntity> {
|
||||
|
||||
final ChargerTileEntity tile = this.getTileEntity(w, pos);
|
||||
if (tile != null) {
|
||||
if (AEApi.instance().definitions().materials().certusQuartzCrystalCharged()
|
||||
if (Api.instance().definitions().materials().certusQuartzCrystalCharged()
|
||||
.isSameAs(tile.getInternalInventory().getStackInSlot(0))) {
|
||||
final double xOff = 0.0;
|
||||
final double yOff = 0.0;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -44,8 +43,11 @@ import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.data.IDynamicBakedModel;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.qnb.QuantumBridgeTileEntity;
|
||||
|
||||
@@ -73,7 +73,7 @@ class QnbFormedBakedModel implements IDynamicBakedModel {
|
||||
this.coveredCableTexture = bakedTextureGetter.apply(TEXTURE_COVERED_CABLE);
|
||||
this.lightTexture = bakedTextureGetter.apply(TEXTURE_RING_LIGHT);
|
||||
this.lightCornerTexture = bakedTextureGetter.apply(TEXTURE_RING_LIGHT_CORNER);
|
||||
this.linkBlock = AEApi.instance().definitions().blocks().quantumLink().maybeBlock().orElse(null);
|
||||
this.linkBlock = Api.instance().definitions().blocks().quantumLink().maybeBlock().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,45 +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 <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.block.storage;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
/**
|
||||
* Describes the type of cell present in a slot.
|
||||
*/
|
||||
public enum DriveSlotCellType implements IStringSerializable {
|
||||
|
||||
EMPTY("empty"),
|
||||
|
||||
ITEM("item"),
|
||||
|
||||
FLUID("fluid");
|
||||
|
||||
private final String name;
|
||||
|
||||
DriveSlotCellType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,10 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.effects.*;
|
||||
import appeng.client.render.effects.EnergyParticleData;
|
||||
import appeng.client.render.effects.LightningArcFX;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
@@ -18,6 +17,7 @@ import appeng.container.implementations.CraftingTermContainer;
|
||||
import appeng.container.implementations.MEMonitorableContainer;
|
||||
import appeng.container.implementations.PatternTermContainer;
|
||||
import appeng.container.implementations.WirelessTermContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.SwitchGuisPacket;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
@@ -44,7 +44,7 @@ final class AESubScreen {
|
||||
public AESubScreen(AEBaseScreen<?> gui, Object containerTarget) {
|
||||
this.gui = gui;
|
||||
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
if (containerTarget instanceof ChestTileEntity) {
|
||||
|
||||
@@ -33,13 +33,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.widgets.Scrollbar;
|
||||
import appeng.container.implementations.CraftConfirmContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
@@ -51,11 +51,11 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
|
||||
|
||||
private final int rows = 5;
|
||||
|
||||
private final IItemList<IAEItemStack> storage = AEApi.instance().storage()
|
||||
private final IItemList<IAEItemStack> storage = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final IItemList<IAEItemStack> pending = AEApi.instance().storage()
|
||||
private final IItemList<IAEItemStack> pending = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage()
|
||||
private final IItemList<IAEItemStack> missing = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
|
||||
private final List<IAEItemStack> visual = new ArrayList<>();
|
||||
|
||||
@@ -34,7 +34,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
@@ -47,6 +46,7 @@ import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.Scrollbar;
|
||||
import appeng.container.implementations.CraftingCPUContainer;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
@@ -79,11 +79,11 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
|
||||
private static final int ITEMSTACK_LEFT_OFFSET = 9;
|
||||
private static final int ITEMSTACK_TOP_OFFSET = 22;
|
||||
|
||||
private IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
private IItemList<IAEItemStack> storage = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
private IItemList<IAEItemStack> active = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
private IItemList<IAEItemStack> active = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
private IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
private IItemList<IAEItemStack> pending = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
|
||||
private List<IAEItemStack> visual = new ArrayList<>();
|
||||
@@ -100,9 +100,9 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
|
||||
}
|
||||
|
||||
public void clearItems() {
|
||||
this.storage = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.active = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.pending = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.storage = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.active = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.pending = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.visual = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.client.gui.implementations;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FullnessMode;
|
||||
import appeng.api.config.OperationMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -30,6 +29,7 @@ import appeng.api.definitions.IDefinitions;
|
||||
import appeng.client.gui.widgets.ServerSettingToggleButton;
|
||||
import appeng.client.gui.widgets.SettingToggleButton;
|
||||
import appeng.container.implementations.IOPortContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
|
||||
@@ -78,7 +78,7 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
|
||||
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
|
||||
definitions.items().cell1k().maybeStack(1)
|
||||
.ifPresent(cell1kStack -> this.drawItem(offsetX + 66 - 8, offsetY + 17, cell1kStack));
|
||||
|
||||
@@ -40,7 +40,6 @@ import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.client.ActionKey;
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
@@ -49,6 +48,7 @@ import appeng.client.gui.widgets.Scrollbar;
|
||||
import appeng.client.me.ClientDCInternalInv;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.container.implementations.InterfaceTerminalContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.Platform;
|
||||
@@ -321,7 +321,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
|
||||
|
||||
final ItemStack parsedItemStack = ItemStack.read(outTag.getCompound(i));
|
||||
if (!parsedItemStack.isEmpty()) {
|
||||
final String displayName = Platform.getItemDisplayName(AEApi.instance().storage()
|
||||
final String displayName = Platform.getItemDisplayName(Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack)).getString()
|
||||
.toLowerCase();
|
||||
if (displayName.contains(searchTerm)) {
|
||||
|
||||
@@ -28,7 +28,12 @@ import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
@@ -37,7 +42,11 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.ActionKey;
|
||||
import appeng.client.gui.AEBaseMEScreen;
|
||||
import appeng.client.gui.widgets.*;
|
||||
import appeng.client.gui.widgets.AETextField;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.Scrollbar;
|
||||
import appeng.client.gui.widgets.SettingToggleButton;
|
||||
import appeng.client.gui.widgets.TabButton;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.container.implementations.CraftingStatusContainer;
|
||||
|
||||
@@ -27,8 +27,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.config.YesNo;
|
||||
@@ -38,6 +36,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.fluids.util.FluidSorters;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
@@ -48,8 +47,8 @@ import appeng.util.prioritylist.IPartitionList;
|
||||
* @since rv6 22/05/2018
|
||||
*/
|
||||
public class FluidRepo {
|
||||
private final IItemList<IAEFluidStack> list = AEApi.instance().storage()
|
||||
.getStorageChannel(IFluidStorageChannel.class).createList();
|
||||
private final IItemList<IAEFluidStack> list = Api.instance().storage().getStorageChannel(IFluidStorageChannel.class)
|
||||
.createList();
|
||||
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
|
||||
@@ -28,7 +28,6 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
@@ -39,6 +38,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.integration.abstraction.JEIFacade;
|
||||
import appeng.items.storage.ViewCellItem;
|
||||
import appeng.util.ItemSorters;
|
||||
@@ -47,7 +47,7 @@ import appeng.util.prioritylist.IPartitionList;
|
||||
|
||||
public class ItemRepo {
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
private final IItemList<IAEItemStack> list = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
|
||||
@@ -24,7 +24,12 @@ import java.util.function.Function;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IModelTransform;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelConfiguration;
|
||||
|
||||
@@ -49,8 +49,8 @@ import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.core.Api;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.thirdparty.codechicken.lib.model.CachedFormat;
|
||||
import appeng.thirdparty.codechicken.lib.model.Quad;
|
||||
@@ -108,7 +108,7 @@ public class FacadeBuilder {
|
||||
Function<ResourceLocation, IBakedModel> modelLookup) {
|
||||
BakedPipeline pipeline = this.pipelines.get();
|
||||
Quad collectorQuad = this.collectors.get();
|
||||
boolean transparent = AEApi.instance().partHelper().getCableRenderMode().transparentFacades;
|
||||
boolean transparent = Api.instance().partHelper().getCableRenderMode().transparentFacades;
|
||||
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
|
||||
List<AxisAlignedBB> partBoxes = renderState.getBoundingBoxes();
|
||||
Set<Direction> sidesWithParts = renderState.getAttachments().keySet();
|
||||
|
||||
@@ -28,8 +28,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ChargedOreFX extends RedstoneParticle {
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class CraftingFx extends SpriteTexturedParticle {
|
||||
|
||||
|
||||
@@ -20,15 +20,17 @@ package appeng.client.render.effects;
|
||||
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.particle.IAnimatedSprite;
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.SpriteTexturedParticle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class EnergyFx extends SpriteTexturedParticle {
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class LightningArcFX extends LightningFX {
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class LightningFX extends SpriteTexturedParticle {
|
||||
|
||||
|
||||
@@ -18,14 +18,17 @@
|
||||
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.particle.IAnimatedSprite;
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.SpriteTexturedParticle;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class MatterCannonFX extends SpriteTexturedParticle {
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class VibrantFX extends SpriteTexturedParticle {
|
||||
|
||||
|
||||
@@ -31,22 +31,22 @@ import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
|
||||
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.block.storage.DriveSlotCellType;
|
||||
import appeng.block.storage.DriveSlotsState;
|
||||
import appeng.client.render.DelegateBakedModel;
|
||||
import appeng.core.Api;
|
||||
|
||||
public class DriveBakedModel extends DelegateBakedModel {
|
||||
private final Map<DriveSlotCellType, IBakedModel> bakedCells;
|
||||
private final Map<Item, IBakedModel> bakedCells;
|
||||
private final IBakedModel defaultCell;
|
||||
|
||||
public DriveBakedModel(IBakedModel bakedBase, Map<DriveSlotCellType, IBakedModel> bakedCells) {
|
||||
public DriveBakedModel(IBakedModel bakedBase, Map<Item, IBakedModel> cellModels, IBakedModel defaultCell) {
|
||||
super(bakedBase);
|
||||
this.bakedCells = bakedCells;
|
||||
this.bakedCells = cellModels;
|
||||
this.defaultCell = defaultCell;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -92,23 +92,18 @@ public class DriveBakedModel extends DelegateBakedModel {
|
||||
public boolean isAmbientOcclusion() {
|
||||
// We have faces inside the chassis that are facing east, but should not receive
|
||||
// ambient occlusion from the east-side, but sadly this cannot be fine-tuned on
|
||||
// a
|
||||
// face-by-face basis.
|
||||
// a face-by-face basis.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine which drive chassis to show based on the used cell
|
||||
private IBakedModel getCellChassisModel(Item cell) {
|
||||
IItems items = Api.INSTANCE.definitions().items();
|
||||
if (cell == null) {
|
||||
return bakedCells.get(DriveSlotCellType.EMPTY);
|
||||
} else if (items.fluidCell1k().item() == cell || items.fluidCell4k().item() == cell
|
||||
|| items.fluidCell16k().item() == cell || items.fluidCell64k().item() == cell) {
|
||||
return bakedCells.get(DriveSlotCellType.FLUID);
|
||||
} else {
|
||||
// Fall back to an item model
|
||||
return bakedCells.get(DriveSlotCellType.ITEM);
|
||||
return bakedCells.get(Items.AIR);
|
||||
}
|
||||
final IBakedModel model = bakedCells.get(cell);
|
||||
|
||||
return model != null ? model : defaultCell;
|
||||
}
|
||||
|
||||
private static void addModel(@Nullable BlockState state, @Nonnull Random rand, @Nonnull IModelData extraData,
|
||||
|
||||
@@ -20,13 +20,12 @@ package appeng.client.render.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
@@ -36,39 +35,41 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModelConfiguration;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometry;
|
||||
|
||||
import appeng.block.storage.DriveSlotCellType;
|
||||
import appeng.api.client.ICellModelRegistry;
|
||||
import appeng.core.Api;
|
||||
|
||||
public class DriveModel implements IModelGeometry<DriveModel> {
|
||||
|
||||
private static final ResourceLocation MODEL_BASE = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/drive_base");
|
||||
|
||||
private static final Map<DriveSlotCellType, ResourceLocation> MODELS_CELLS = ImmutableMap.of(
|
||||
DriveSlotCellType.EMPTY, new ResourceLocation("appliedenergistics2:block/drive/drive_cell_empty"),
|
||||
DriveSlotCellType.ITEM, new ResourceLocation("appliedenergistics2:block/drive/drive_cell_items"),
|
||||
DriveSlotCellType.FLUID, new ResourceLocation("appliedenergistics2:block/drive/drive_cell_fluids"));
|
||||
|
||||
public static final Set<ResourceLocation> DEPENDENCIES = ImmutableSet.<ResourceLocation>builder()
|
||||
.addAll(MODELS_CELLS.values()).add(MODEL_BASE).build();
|
||||
private static final ResourceLocation MODEL_CELL_EMPTY = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/drive_cell_empty");
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
|
||||
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
|
||||
ItemOverrideList overrides, ResourceLocation modelLocation) {
|
||||
EnumMap<DriveSlotCellType, IBakedModel> cellModels = new EnumMap<>(DriveSlotCellType.class);
|
||||
final ICellModelRegistry cellRegistry = Api.instance().client().cells();
|
||||
final Map<Item, IBakedModel> cellModels = new IdentityHashMap<>();
|
||||
|
||||
// Load the base model and the model for each cell state.
|
||||
for (DriveSlotCellType cellType : MODELS_CELLS.keySet()) {
|
||||
IBakedModel cellModel = bakery.getBakedModel(MODELS_CELLS.get(cellType), modelTransform, spriteGetter);
|
||||
cellModels.put(cellType, cellModel);
|
||||
// Load the base model and the model for each cell model.
|
||||
for (Entry<Item, ResourceLocation> entry : cellRegistry.models().entrySet()) {
|
||||
IBakedModel cellModel = bakery.getBakedModel(entry.getValue(), modelTransform, spriteGetter);
|
||||
cellModels.put(entry.getKey(), cellModel);
|
||||
}
|
||||
|
||||
IBakedModel baseModel = bakery.getBakedModel(MODEL_BASE, modelTransform, spriteGetter);
|
||||
return new DriveBakedModel(baseModel, cellModels);
|
||||
final IBakedModel baseModel = bakery.getBakedModel(MODEL_BASE, modelTransform, spriteGetter);
|
||||
final IBakedModel defaultCell = bakery.getBakedModel(cellRegistry.getDefaultModel(), modelTransform,
|
||||
spriteGetter);
|
||||
cellModels.put(Items.AIR, bakery.getBakedModel(MODEL_CELL_EMPTY, modelTransform, spriteGetter));
|
||||
|
||||
return new DriveBakedModel(baseModel, cellModels, defaultCell);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,14 +19,12 @@
|
||||
package appeng.client.render.spatial;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class SpatialPylonRendering extends BlockRenderingCustomizer {
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
@@ -64,6 +63,7 @@ import appeng.container.slot.InaccessibleSlot;
|
||||
import appeng.container.slot.PlayerHotBarSlot;
|
||||
import appeng.container.slot.PlayerInvSlot;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.InventoryActionPacket;
|
||||
@@ -658,7 +658,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
final ItemStack isg = player.inventory.getItemStack();
|
||||
|
||||
if (!isg.isEmpty() && releaseQty > 0) {
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
IAEItemStack ais = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(isg);
|
||||
ais.setStackSize(1);
|
||||
final IAEItemStack extracted = ais.copy();
|
||||
@@ -737,7 +737,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
this.updateHeld(player);
|
||||
}
|
||||
} else {
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
IAEItemStack ais = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(player.inventory.getItemStack());
|
||||
ais = Platform.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais,
|
||||
this.getActionSource());
|
||||
@@ -777,7 +777,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
this.updateHeld(player);
|
||||
}
|
||||
} else {
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
IAEItemStack ais = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(player.inventory.getItemStack());
|
||||
ais.setStackSize(1);
|
||||
ais = Platform.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais,
|
||||
@@ -855,7 +855,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
return input;
|
||||
}
|
||||
final IAEItemStack ais = Platform.poweredInsert(this.getPowerSource(), this.getCellInventory(),
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(input),
|
||||
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(input),
|
||||
this.getActionSource());
|
||||
if (ais == null) {
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.CopyMode;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -47,6 +46,7 @@ import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.FakeTypeOnlySlot;
|
||||
import appeng.container.slot.OptionalRestrictedInputSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.tile.misc.CellWorkbenchTileEntity;
|
||||
import appeng.util.EnumCycler;
|
||||
import appeng.util.Platform;
|
||||
@@ -208,9 +208,9 @@ public class CellWorkbenchContainer extends UpgradeableContainer {
|
||||
final ItemStack is = this.getUpgradeable().getInventoryByName("cell").getStackInSlot(0);
|
||||
final IStorageChannel channel = is.getItem() instanceof IStorageCell
|
||||
? ((IStorageCell) is.getItem()).getChannel()
|
||||
: AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
: Api.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
|
||||
final IMEInventory cellInv = AEApi.instance().registries().cell().getCellInventory(is, null, channel);
|
||||
final IMEInventory cellInv = Api.instance().registries().cell().getCellInventory(is, null, channel);
|
||||
|
||||
Iterator<IAEStack> i = new NullIterator<>();
|
||||
if (cellInv != null) {
|
||||
|
||||
@@ -15,7 +15,6 @@ import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
@@ -25,6 +24,7 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.util.Platform;
|
||||
@@ -182,7 +182,7 @@ public final class ContainerHelper<C extends AEBaseContainer, I> {
|
||||
}
|
||||
|
||||
if (interfaceClass.isAssignableFrom(WirelessTerminalGuiObject.class)) {
|
||||
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler(it);
|
||||
final IWirelessTermHandler wh = Api.instance().registries().wireless().getWirelessTerminalHandler(it);
|
||||
if (wh != null) {
|
||||
return interfaceClass.cast(new WirelessTerminalGuiObject(wh, it, player, locator.getItemIndex()));
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -58,6 +57,7 @@ import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.MEInventoryUpdatePacket;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
@@ -197,7 +197,7 @@ public class CraftConfirmContainer extends AEBaseContainer {
|
||||
final MEInventoryUpdatePacket c = this.result.isSimulation() ? new MEInventoryUpdatePacket((byte) 2)
|
||||
: null;
|
||||
|
||||
final IItemList<IAEItemStack> plan = AEApi.instance().storage()
|
||||
final IItemList<IAEItemStack> plan = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.result.populatePlan(plan);
|
||||
|
||||
@@ -215,7 +215,7 @@ public class CraftConfirmContainer extends AEBaseContainer {
|
||||
|
||||
final IStorageGrid sg = this.getGrid().getCache(IStorageGrid.class);
|
||||
final IMEInventory<IAEItemStack> items = sg
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
|
||||
IAEItemStack m = null;
|
||||
if (c != null && this.result.isSimulation()) {
|
||||
|
||||
@@ -28,7 +28,6 @@ import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.CraftingItemList;
|
||||
@@ -43,6 +42,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.MEInventoryUpdatePacket;
|
||||
@@ -60,7 +60,7 @@ public class CraftingCPUContainer extends AEBaseContainer
|
||||
private static final ContainerHelper<CraftingCPUContainer, CraftingTileEntity> helper = new ContainerHelper<>(
|
||||
CraftingCPUContainer::new, CraftingTileEntity.class, SecurityPermissions.CRAFT);
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
private final IItemList<IAEItemStack> list = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
private IGrid network;
|
||||
private CraftingCPUCluster monitor = null;
|
||||
|
||||
@@ -26,13 +26,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.interfaces.IProgressProvider;
|
||||
import appeng.container.slot.OutputSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.tile.misc.InscriberRecipes;
|
||||
import appeng.tile.misc.InscriberTileEntity;
|
||||
import appeng.util.Platform;
|
||||
@@ -131,7 +131,7 @@ public class InscriberContainer extends UpgradeableContainer implements IProgres
|
||||
final ItemStack bot = this.ti.getInternalInventory().getStackInSlot(1);
|
||||
|
||||
if (s == this.middle) {
|
||||
IItemDefinition press = AEApi.instance().definitions().materials().namePress();
|
||||
IItemDefinition press = Api.instance().definitions().materials().namePress();
|
||||
if (press.isSameAs(top) || press.isSameAs(bot)) {
|
||||
return !press.isSameAs(is);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class InscriberContainer extends UpgradeableContainer implements IProgres
|
||||
}
|
||||
|
||||
// name presses
|
||||
final IItemDefinition namePress = AEApi.instance().definitions().materials().namePress();
|
||||
final IItemDefinition namePress = Api.instance().definitions().materials().namePress();
|
||||
if (namePress.isSameAs(otherSlot)) {
|
||||
return namePress.isSameAs(is);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -67,6 +66,7 @@ import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.MEInventoryUpdatePacket;
|
||||
@@ -93,8 +93,8 @@ public class MEMonitorableContainer extends AEBaseContainer
|
||||
|
||||
private final RestrictedInputSlot[] cellView = new RestrictedInputSlot[5];
|
||||
private final IMEMonitor<IAEItemStack> monitor;
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final IItemList<IAEItemStack> items = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync(99)
|
||||
@@ -126,7 +126,7 @@ public class MEMonitorableContainer extends AEBaseContainer
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
|
||||
this.monitor = monitorable
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
if (this.monitor != null) {
|
||||
this.monitor.addListener(this, null);
|
||||
|
||||
@@ -185,7 +185,7 @@ public class MEMonitorableContainer extends AEBaseContainer
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
if (this.monitor != this.host
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class))) {
|
||||
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class))) {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.MolecularAssemblerPatternSlot;
|
||||
import appeng.container.slot.OutputSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.items.misc.EncodedPatternItem;
|
||||
import appeng.tile.crafting.MolecularAssemblerTileEntity;
|
||||
import appeng.util.Platform;
|
||||
@@ -79,8 +80,7 @@ public class MolecularAssemblerContainer extends UpgradeableContainer implements
|
||||
|
||||
if (is.getItem() instanceof EncodedPatternItem) {
|
||||
final World w = this.getTileEntity().getWorld();
|
||||
final EncodedPatternItem iep = (EncodedPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails ph = iep.getPatternForItem(is, w);
|
||||
final ICraftingPatternDetails ph = Api.instance().crafting().decodePattern(is, w);
|
||||
if (ph.isCraftable()) {
|
||||
return ph.isValidItemForSlot(slotIndex, i, w);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
@@ -41,6 +40,7 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.MEInventoryUpdatePacket;
|
||||
import appeng.util.Platform;
|
||||
@@ -115,7 +115,7 @@ public class NetworkStatusContainer extends AEBaseContainer {
|
||||
final MEInventoryUpdatePacket piu = new MEInventoryUpdatePacket();
|
||||
|
||||
for (final Class<? extends IGridHost> machineClass : this.network.getMachinesClasses()) {
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage()
|
||||
final IItemList<IAEItemStack> list = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
for (final IGridNode machine : this.network.getMachines(machineClass)) {
|
||||
final IGridBlock blk = machine.getGridBlock();
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.container.implementations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -32,19 +31,17 @@ import net.minecraft.inventory.container.CraftingResultSlot;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.crafting.ICraftingHelper;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
@@ -60,6 +57,7 @@ import appeng.container.slot.OptionalFakeSlot;
|
||||
import appeng.container.slot.PatternOutputsSlot;
|
||||
import appeng.container.slot.PatternTermSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.packets.PatternSlotPacket;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.items.storage.ViewCellItem;
|
||||
@@ -98,8 +96,9 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
private final PatternTermSlot craftSlot;
|
||||
private final RestrictedInputSlot patternSlotIN;
|
||||
private final RestrictedInputSlot patternSlotOUT;
|
||||
private final ICraftingHelper craftingHelper = Api.INSTANCE.crafting();
|
||||
|
||||
private IRecipe<CraftingInventory> currentRecipe;
|
||||
private ICraftingRecipe currentRecipe;
|
||||
@GuiSync(97)
|
||||
public boolean craftingMode = true;
|
||||
@GuiSync(96)
|
||||
@@ -206,17 +205,17 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
final ItemStack[] out = this.getOutputs();
|
||||
|
||||
// if there is no input, this would be silly.
|
||||
if (in == null || out == null) {
|
||||
if (in == null || out == null || isCraftingMode() && currentRecipe == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// first check the output slots, should either be null, or a pattern
|
||||
if (!output.isEmpty() && !this.isPattern(output)) {
|
||||
if (!output.isEmpty() && !craftingHelper.isEncodedPattern(output)) {
|
||||
return;
|
||||
} // if nothing is there we should snag a new pattern.
|
||||
else if (output.isEmpty()) {
|
||||
output = this.patternSlotIN.getStack();
|
||||
if (output.isEmpty() || !this.isPattern(output)) {
|
||||
if (output.isEmpty() || !isPattern(output)) {
|
||||
return; // no blanks.
|
||||
}
|
||||
|
||||
@@ -226,34 +225,17 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
// add a new encoded pattern.
|
||||
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
||||
if (maybePattern.isPresent()) {
|
||||
output = maybePattern.get();
|
||||
this.patternSlotOUT.putStack(output);
|
||||
}
|
||||
// let the crafting helper create a new encoded pattern
|
||||
output = null;
|
||||
}
|
||||
|
||||
// encode the slot.
|
||||
final CompoundNBT encodedValue = new CompoundNBT();
|
||||
|
||||
final ListNBT tagIn = new ListNBT();
|
||||
final ListNBT tagOut = new ListNBT();
|
||||
|
||||
for (final ItemStack i : in) {
|
||||
tagIn.add(this.createItemTag(i));
|
||||
if (this.isCraftingMode()) {
|
||||
output = craftingHelper.encodeCraftingPattern(output, this.currentRecipe, in, out[0], isSubstitute());
|
||||
} else {
|
||||
output = craftingHelper.encodeProcessingPattern(output, in, out);
|
||||
}
|
||||
this.patternSlotOUT.putStack(output);
|
||||
|
||||
for (final ItemStack i : out) {
|
||||
tagOut.add(this.createItemTag(i));
|
||||
}
|
||||
|
||||
encodedValue.put("in", tagIn);
|
||||
encodedValue.put("out", tagOut);
|
||||
encodedValue.putBoolean("crafting", this.isCraftingMode());
|
||||
encodedValue.putBoolean("substitute", this.isSubstitute());
|
||||
|
||||
output.setTag(encodedValue);
|
||||
}
|
||||
|
||||
private ItemStack[] getInputs() {
|
||||
@@ -307,22 +289,8 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
return false;
|
||||
}
|
||||
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
|
||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
||||
|
||||
return isPattern;
|
||||
}
|
||||
|
||||
private INBT createItemTag(final ItemStack i) {
|
||||
final CompoundNBT c = new CompoundNBT();
|
||||
|
||||
if (!i.isEmpty()) {
|
||||
i.write(c);
|
||||
}
|
||||
|
||||
return c;
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
return definitions.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -380,7 +348,7 @@ public class PatternTermContainer extends MEMonitorableContainer
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal()
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||
|
||||
final ItemStack is = r.getCraftingResult(ic);
|
||||
|
||||
@@ -30,11 +30,11 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.slot.OutputSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.items.materials.MaterialItem;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
@@ -119,7 +119,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
|
||||
|
||||
if (RestrictedInputSlot.isMetalIngot(input)) {
|
||||
if (QuartzKnifeContainer.this.myName.length() > 0) {
|
||||
return AEApi.instance().definitions().materials().namePress().maybeStack(1).map(namePressStack -> {
|
||||
return Api.instance().definitions().materials().namePress().maybeStack(1).map(namePressStack -> {
|
||||
final CompoundNBT compound = namePressStack.getOrCreateTag();
|
||||
compound.putString(MaterialItem.TAG_INSCRIBE_NAME, QuartzKnifeContainer.this.myName);
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.features.INetworkEncodable;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
@@ -36,6 +35,7 @@ import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.OutputSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.misc.SecurityStationTileEntity;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
@@ -150,7 +150,7 @@ public class SecurityStationContainer extends MEMonitorableContainer implements
|
||||
networkEncodable = (INetworkEncodable) term.getItem();
|
||||
}
|
||||
|
||||
final IWirelessTermHandler wTermHandler = AEApi.instance().registries().wireless()
|
||||
final IWirelessTermHandler wTermHandler = Api.instance().registries().wireless()
|
||||
.getWirelessTerminalHandler(term);
|
||||
if (wTermHandler != null) {
|
||||
networkEncodable = wTermHandler;
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -43,6 +42,7 @@ import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.FakeTypeOnlySlot;
|
||||
import appeng.container.slot.OptionalTypeOnlyFakeSlot;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.parts.misc.StorageBusPart;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
@@ -155,7 +155,7 @@ public class StorageBusContainer extends UpgradeableContainer {
|
||||
Iterator<IAEItemStack> i = new NullIterator<>();
|
||||
if (cellInv != null) {
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems(
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
@@ -44,6 +43,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.implementations.CraftingTermContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.storage.ViewCellItem;
|
||||
@@ -100,7 +100,7 @@ public class CraftingTermSlot extends AppEngCraftingSlot {
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> inv = this.storage
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
final int howManyPerCraft = this.getStack().getCount();
|
||||
int maxTimesToCraft = 0;
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.BasePacket;
|
||||
import appeng.core.sync.packets.PatternSlotPacket;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
@@ -48,7 +48,7 @@ public class PatternTermSlot extends CraftingTermSlot {
|
||||
|
||||
public BasePacket getRequest(final boolean shift) {
|
||||
return new PatternSlotPacket(this.getPattern(),
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(this.getStack()),
|
||||
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(this.getStack()),
|
||||
shift);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,18 +33,18 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.crafting.ICraftingHelper;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.features.INetworkEncodable;
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.implementations.items.ISpatialStorageCell;
|
||||
import appeng.api.implementations.items.IStorageComponent;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.cells.ICellWorkbenchItem;
|
||||
import appeng.core.Api;
|
||||
import appeng.items.misc.EncodedPatternItem;
|
||||
import appeng.recipes.handlers.GrinderRecipes;
|
||||
import appeng.tile.misc.InscriberRecipes;
|
||||
@@ -88,10 +88,7 @@ public class RestrictedInputSlot extends AppEngSlot {
|
||||
|
||||
public boolean isValid(final ItemStack is, final World theWorld) {
|
||||
if (this.which == PlacableItemType.VALID_ENCODED_PATTERN_W_OUTPUT) {
|
||||
final ICraftingPatternDetails ap = is.getItem() instanceof ICraftingPatternItem
|
||||
? ((ICraftingPatternItem) is.getItem()).getPatternForItem(is, theWorld)
|
||||
: null;
|
||||
return ap != null;
|
||||
return Api.instance().crafting().decodePattern(is, theWorld) != null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -123,42 +120,27 @@ public class RestrictedInputSlot extends AppEngSlot {
|
||||
return false;
|
||||
}
|
||||
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
final IMaterials materials = definitions.materials();
|
||||
final IItems items = definitions.items();
|
||||
final ICraftingHelper crafting = Api.instance().crafting();
|
||||
|
||||
switch (this.which) {
|
||||
case ENCODED_CRAFTING_PATTERN:
|
||||
if (i.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
|
||||
final ICraftingPatternDetails de = b.getPatternForItem(i, this.p.player.world);
|
||||
if (de != null) {
|
||||
return de.isCraftable();
|
||||
}
|
||||
final ICraftingPatternDetails de = crafting.decodePattern(i, this.p.player.world);
|
||||
if (de != null) {
|
||||
return de.isCraftable();
|
||||
}
|
||||
return false;
|
||||
case VALID_ENCODED_PATTERN_W_OUTPUT:
|
||||
case ENCODED_PATTERN_W_OUTPUT:
|
||||
case ENCODED_PATTERN: {
|
||||
if (i.getItem() instanceof ICraftingPatternItem) {
|
||||
return true;
|
||||
}
|
||||
// ICraftingPatternDetails pattern = i.getItem() instanceof ICraftingPatternItem
|
||||
// ?
|
||||
// ((ICraftingPatternItem)
|
||||
// i.getItem()).getPatternForItem( i ) : null;
|
||||
return false;// pattern != null;
|
||||
}
|
||||
case ENCODED_PATTERN:
|
||||
return crafting.isEncodedPattern(i);
|
||||
case BLANK_PATTERN:
|
||||
return materials.blankPattern().isSameAs(i);
|
||||
|
||||
case PATTERN:
|
||||
|
||||
if (i.getItem() instanceof ICraftingPatternItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return materials.blankPattern().isSameAs(i);
|
||||
return materials.blankPattern().isSameAs(i) || crafting.isEncodedPattern(i);
|
||||
|
||||
case INSCRIBER_PLATE:
|
||||
if (materials.namePress().isSameAs(i)) {
|
||||
@@ -195,14 +177,14 @@ public class RestrictedInputSlot extends AppEngSlot {
|
||||
return i.getItem() instanceof ISpatialStorageCell
|
||||
&& ((ISpatialStorageCell) i.getItem()).isSpatialStorage(i);
|
||||
case STORAGE_CELLS:
|
||||
return AEApi.instance().registries().cell().isCellHandled(i);
|
||||
return Api.instance().registries().cell().isCellHandled(i);
|
||||
case WORKBENCH_CELL:
|
||||
return i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable(i);
|
||||
case STORAGE_COMPONENT:
|
||||
return i.getItem() instanceof IStorageComponent
|
||||
&& ((IStorageComponent) i.getItem()).isStorageComponent(i);
|
||||
case TRASH:
|
||||
if (AEApi.instance().registries().cell().isCellHandled(i)) {
|
||||
if (Api.instance().registries().cell().isCellHandled(i)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,7 +192,7 @@ public class RestrictedInputSlot extends AppEngSlot {
|
||||
&& ((IStorageComponent) i.getItem()).isStorageComponent(i));
|
||||
case ENCODABLE_ITEM:
|
||||
return i.getItem() instanceof INetworkEncodable
|
||||
|| AEApi.instance().registries().wireless().isWirelessTerminal(i);
|
||||
|| Api.instance().registries().wireless().isWirelessTerminal(i);
|
||||
case BIOMETRIC_CARD:
|
||||
return i.getItem() instanceof IBiometricCard;
|
||||
case UPGRADES:
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
@@ -22,7 +21,7 @@ public class AEItemGroup extends ItemGroup {
|
||||
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
return blocks.controller().stack(1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2020, 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 <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData.AnnotationData;
|
||||
|
||||
import appeng.api.AEAddon;
|
||||
import appeng.api.IAEAddon;
|
||||
import appeng.api.IAppEngApi;
|
||||
|
||||
/**
|
||||
* Loads AE addons on startup and provides them with an {@link IAppEngApi}
|
||||
* instance.
|
||||
*/
|
||||
class AddonLoader {
|
||||
|
||||
public static void loadAddons(IAppEngApi api) {
|
||||
final Type annotationType = Type.getType(AEAddon.class);
|
||||
final Collection<ModFileScanData> allScanData = ModList.get().getAllScanData();
|
||||
|
||||
allScanData.stream().map(ModFileScanData::getAnnotations).flatMap(Set::stream)
|
||||
.filter(a -> Objects.equals(a.getAnnotationType(), annotationType)).map(AnnotationData::getMemberName)
|
||||
.forEach(className -> {
|
||||
try {
|
||||
final Class<?> clazz = Class.forName(className);
|
||||
final Class<? extends IAEAddon> instanceClass = clazz.asSubclass(IAEAddon.class);
|
||||
final IAEAddon instance = instanceClass.newInstance();
|
||||
|
||||
instance.onAPIAvailable(api);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
|
||||
| LinkageError e) {
|
||||
AELog.error("Failed to load: %s", className, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,15 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import appeng.api.AEAddon;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.client.IClientHelper;
|
||||
import appeng.api.crafting.ICraftingHelper;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.IClientHelper;
|
||||
import appeng.core.api.ApiClientHelper;
|
||||
import appeng.core.api.ApiCrafting;
|
||||
import appeng.core.api.ApiGrid;
|
||||
import appeng.core.api.ApiPart;
|
||||
import appeng.core.api.ApiStorage;
|
||||
@@ -31,8 +34,26 @@ import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.features.registries.RegistryContainer;
|
||||
|
||||
public final class Api implements IAppEngApi {
|
||||
|
||||
/**
|
||||
* While permitting public access, directly using {@link Api#instance()} is not
|
||||
* recommended except in very special cases.
|
||||
*/
|
||||
public static final Api INSTANCE = new Api();
|
||||
|
||||
/**
|
||||
* Use primarily to access the API.
|
||||
*
|
||||
* Using {@link IAppEngApi} intentionally to avoid using functionality not
|
||||
* exposed by accident.
|
||||
*
|
||||
* In some cases we might have to access the API before it is announced via
|
||||
* {@link AEAddon}, otherwise we could just inject it into AE2 itself.
|
||||
*/
|
||||
public static IAppEngApi instance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ApiPart partHelper;
|
||||
|
||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||
@@ -40,6 +61,7 @@ public final class Api implements IAppEngApi {
|
||||
private final IStorageHelper storageHelper;
|
||||
private final IGridHelper networkHelper;
|
||||
private final ApiDefinitions definitions;
|
||||
private final ICraftingHelper craftingHelper;
|
||||
private final IClientHelper client;
|
||||
|
||||
private Api() {
|
||||
@@ -48,7 +70,8 @@ public final class Api implements IAppEngApi {
|
||||
this.registryContainer = new RegistryContainer();
|
||||
this.partHelper = new ApiPart();
|
||||
this.definitions = new ApiDefinitions((PartModels) this.registryContainer.partModels());
|
||||
this.client = new ApiClientHelper();
|
||||
this.craftingHelper = new ApiCrafting(this.definitions);
|
||||
this.client = new ApiClientHelper(this.definitions);
|
||||
}
|
||||
|
||||
public PartModels getPartModels() {
|
||||
@@ -65,6 +88,11 @@ public final class Api implements IAppEngApi {
|
||||
return this.storageHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingHelper crafting() {
|
||||
return this.craftingHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridHelper grid() {
|
||||
return this.networkHelper;
|
||||
|
||||
@@ -71,14 +71,24 @@ import appeng.client.render.cablebus.CableBusModelLoader;
|
||||
import appeng.client.render.cablebus.P2PTunnelFrequencyModel;
|
||||
import appeng.client.render.crafting.CraftingCubeModelLoader;
|
||||
import appeng.client.render.crafting.EncodedPatternModelLoader;
|
||||
import appeng.client.render.model.*;
|
||||
import appeng.client.render.model.BiometricCardModel;
|
||||
import appeng.client.render.model.ColorApplicatorModel;
|
||||
import appeng.client.render.model.DriveModel;
|
||||
import appeng.client.render.model.GlassModel;
|
||||
import appeng.client.render.model.MemoryCardModel;
|
||||
import appeng.client.render.model.SkyCompassModel;
|
||||
import appeng.client.render.model.UVLModelLoader;
|
||||
import appeng.client.render.spatial.SpatialPylonModel;
|
||||
import appeng.core.crash.ModCrashEnhancement;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.stats.AdvancementTriggers;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.entity.*;
|
||||
import appeng.entity.ChargedQuartzEntity;
|
||||
import appeng.entity.GrowingCrystalEntity;
|
||||
import appeng.entity.SingularityEntity;
|
||||
import appeng.entity.TinyTNTPrimedEntity;
|
||||
import appeng.entity.TinyTNTPrimedRenderer;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.parts.PartPlacement;
|
||||
@@ -157,6 +167,7 @@ public final class AppEng {
|
||||
|
||||
registerNetworkHandler();
|
||||
|
||||
AddonLoader.loadAddons(Api.INSTANCE);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -253,10 +264,6 @@ public final class AppEng {
|
||||
//
|
||||
// AELog.info( "Pre Initialization ( ended after " + watch.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
|
||||
//
|
||||
// // Instantiate all Plugins
|
||||
// List<Object> injectables = Lists.newArrayList(
|
||||
// AEApi.instance() );
|
||||
// new PluginLoader().loadPlugins( injectables, event.getAsmData() );
|
||||
// }
|
||||
|
||||
private void startService(final String serviceName, final Thread thread) {
|
||||
|
||||
@@ -1,148 +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 <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
|
||||
import appeng.api.AEInjectable;
|
||||
import appeng.api.AEPlugin;
|
||||
|
||||
/**
|
||||
* Loads AE plugins on startup and provides them with access to various
|
||||
* components of the AE API.
|
||||
*/
|
||||
class PluginLoader {
|
||||
|
||||
public void loadPlugins(Collection<Object> injectables) {
|
||||
Map<Class<?>, Object> injectableMap = mapInjectables(injectables);
|
||||
findAndInstantiatePlugins(injectableMap);
|
||||
}
|
||||
|
||||
private static void findAndInstantiatePlugins(Map<Class<?>, Object> injectableMap) {
|
||||
Type aType = Type.getType(AEPlugin.class);
|
||||
Set<ModFileScanData.AnnotationData> allAnnotated = ModList.get().getAllScanData().stream()
|
||||
.map(ModFileScanData::getAnnotations).flatMap(Collection::stream)
|
||||
.filter(a -> a.getAnnotationType().equals(aType)).filter(a -> a.getTargetType() == ElementType.TYPE)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (ModFileScanData.AnnotationData candidate : allAnnotated) {
|
||||
|
||||
String cName = candidate.getMemberName();
|
||||
Class<?> aClass;
|
||||
try {
|
||||
aClass = Class.forName(cName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
AELog.error(e, "Couldn't find annotated AE plugin class " + cName);
|
||||
throw new RuntimeException("Couldn't find annotated AE plugin class " + cName, e);
|
||||
}
|
||||
|
||||
// Try instantiating the plugin
|
||||
try {
|
||||
Object plugin = instantiatePlugin(aClass, injectableMap);
|
||||
AELog.info("Loaded AE2 Plugin {}", plugin.getClass());
|
||||
} catch (Exception e) {
|
||||
AELog.error(e, "Unable to instantiate AE plugin " + cName);
|
||||
throw new RuntimeException("Unable to instantiate AE plugin " + cName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Object instantiatePlugin(Class<?> aClass, Map<Class<?>, Object> injectableMap) throws Exception {
|
||||
|
||||
Constructor<?>[] constructors = aClass.getDeclaredConstructors();
|
||||
|
||||
if (constructors.length == 0) {
|
||||
// This is the default no-arg constructor, although it seems pointless to
|
||||
// instantiate anything but not take
|
||||
// any AE dependencies as parameters
|
||||
return aClass.newInstance();
|
||||
} else if (constructors.length != 1) {
|
||||
throw new IllegalArgumentException("Expected a single constructor, but found: " + constructors.length);
|
||||
}
|
||||
|
||||
Constructor<?> constructor = constructors[0];
|
||||
constructor.setAccessible(true);
|
||||
|
||||
Object[] args = findInjectables(constructor, injectableMap);
|
||||
|
||||
return constructor.newInstance(args);
|
||||
}
|
||||
|
||||
private static Object[] findInjectables(Constructor<?> constructor, Map<Class<?>, Object> injectableMap) {
|
||||
|
||||
Class<?>[] types = constructor.getParameterTypes();
|
||||
Object[] args = new Object[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
args[i] = injectableMap.get(types[i]);
|
||||
if (args[i] == null) {
|
||||
throw new IllegalArgumentException("Constructor has parameter of type " + types[i]
|
||||
+ " which is not an injectable type." + " Please see the documentation for @AEPlugin.");
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
private static Map<Class<?>, Object> mapInjectables(Collection<Object> injectables) {
|
||||
ImmutableMap.Builder<Class<?>, Object> builder = ImmutableMap.builder();
|
||||
|
||||
for (Object injectable : injectables) {
|
||||
// Get all super-interfaces that were annotated with @AEInjectable
|
||||
Set<Class<?>> injectableIfs = getInjectableInterfaces(injectable.getClass());
|
||||
for (Class<?> injectableIf : injectableIfs) {
|
||||
builder.put(injectableIf, injectable);
|
||||
}
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static Set<Class<?>> getInjectableInterfaces(Class<?> aClass) {
|
||||
Set<Class<?>> hierarchy = new HashSet<>();
|
||||
getFullHierarchy(aClass, hierarchy);
|
||||
|
||||
return hierarchy.stream().filter(c -> c.getAnnotation(AEInjectable.class) != null).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
// Recursively gather all superclasses and superinterfaces of the given class
|
||||
// and put them into the given collection
|
||||
private static void getFullHierarchy(Class<?> aClass, Set<Class<?>> classes) {
|
||||
classes.add(aClass);
|
||||
for (Class<?> anIf : aClass.getInterfaces()) {
|
||||
getFullHierarchy(anIf, classes);
|
||||
}
|
||||
if (aClass.getSuperclass() != null) {
|
||||
getFullHierarchy(aClass.getSuperclass(), classes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
@@ -43,7 +42,11 @@ import net.minecraft.world.gen.placement.IPlacementConfig;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.*;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.ModDimension;
|
||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||
@@ -57,7 +60,6 @@ import net.minecraftforge.fml.network.IContainerFactory;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItems;
|
||||
@@ -75,18 +77,94 @@ import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.bootstrap.components.*;
|
||||
import appeng.client.gui.implementations.*;
|
||||
import appeng.client.render.effects.*;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemColorRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelBakeComponent;
|
||||
import appeng.bootstrap.components.ITileEntityRegistrationComponent;
|
||||
import appeng.client.gui.implementations.CellWorkbenchScreen;
|
||||
import appeng.client.gui.implementations.ChestScreen;
|
||||
import appeng.client.gui.implementations.CondenserScreen;
|
||||
import appeng.client.gui.implementations.CraftAmountScreen;
|
||||
import appeng.client.gui.implementations.CraftConfirmScreen;
|
||||
import appeng.client.gui.implementations.CraftingCPUScreen;
|
||||
import appeng.client.gui.implementations.CraftingStatusScreen;
|
||||
import appeng.client.gui.implementations.CraftingTermScreen;
|
||||
import appeng.client.gui.implementations.DriveScreen;
|
||||
import appeng.client.gui.implementations.FormationPlaneScreen;
|
||||
import appeng.client.gui.implementations.GrinderScreen;
|
||||
import appeng.client.gui.implementations.IOPortScreen;
|
||||
import appeng.client.gui.implementations.InscriberScreen;
|
||||
import appeng.client.gui.implementations.InterfaceScreen;
|
||||
import appeng.client.gui.implementations.InterfaceTerminalScreen;
|
||||
import appeng.client.gui.implementations.LevelEmitterScreen;
|
||||
import appeng.client.gui.implementations.MEMonitorableScreen;
|
||||
import appeng.client.gui.implementations.MEPortableCellScreen;
|
||||
import appeng.client.gui.implementations.MolecularAssemblerScreen;
|
||||
import appeng.client.gui.implementations.NetworkStatusScreen;
|
||||
import appeng.client.gui.implementations.NetworkToolScreen;
|
||||
import appeng.client.gui.implementations.PatternTermScreen;
|
||||
import appeng.client.gui.implementations.PriorityScreen;
|
||||
import appeng.client.gui.implementations.QNBScreen;
|
||||
import appeng.client.gui.implementations.QuartzKnifeScreen;
|
||||
import appeng.client.gui.implementations.SecurityStationScreen;
|
||||
import appeng.client.gui.implementations.SkyChestScreen;
|
||||
import appeng.client.gui.implementations.SpatialIOPortScreen;
|
||||
import appeng.client.gui.implementations.StorageBusScreen;
|
||||
import appeng.client.gui.implementations.UpgradeableScreen;
|
||||
import appeng.client.gui.implementations.VibrationChamberScreen;
|
||||
import appeng.client.gui.implementations.WirelessScreen;
|
||||
import appeng.client.gui.implementations.WirelessTermScreen;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.client.render.effects.CraftingFx;
|
||||
import appeng.client.render.effects.EnergyFx;
|
||||
import appeng.client.render.effects.LightningArcFX;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.MatterCannonFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.client.render.effects.VibrantFX;
|
||||
import appeng.client.render.model.BiometricCardModel;
|
||||
import appeng.client.render.model.DriveModel;
|
||||
import appeng.client.render.model.MemoryCardModel;
|
||||
import appeng.client.render.model.SkyCompassModel;
|
||||
import appeng.client.render.tesr.InscriberTESR;
|
||||
import appeng.client.render.tesr.SkyChestTESR;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.*;
|
||||
import appeng.container.implementations.CellWorkbenchContainer;
|
||||
import appeng.container.implementations.ChestContainer;
|
||||
import appeng.container.implementations.CondenserContainer;
|
||||
import appeng.container.implementations.CraftAmountContainer;
|
||||
import appeng.container.implementations.CraftConfirmContainer;
|
||||
import appeng.container.implementations.CraftingCPUContainer;
|
||||
import appeng.container.implementations.CraftingStatusContainer;
|
||||
import appeng.container.implementations.CraftingTermContainer;
|
||||
import appeng.container.implementations.DriveContainer;
|
||||
import appeng.container.implementations.FormationPlaneContainer;
|
||||
import appeng.container.implementations.GrinderContainer;
|
||||
import appeng.container.implementations.IOPortContainer;
|
||||
import appeng.container.implementations.InscriberContainer;
|
||||
import appeng.container.implementations.InterfaceContainer;
|
||||
import appeng.container.implementations.InterfaceTerminalContainer;
|
||||
import appeng.container.implementations.LevelEmitterContainer;
|
||||
import appeng.container.implementations.MEMonitorableContainer;
|
||||
import appeng.container.implementations.MEPortableCellContainer;
|
||||
import appeng.container.implementations.MolecularAssemblerContainer;
|
||||
import appeng.container.implementations.NetworkStatusContainer;
|
||||
import appeng.container.implementations.NetworkToolContainer;
|
||||
import appeng.container.implementations.PatternTermContainer;
|
||||
import appeng.container.implementations.PriorityContainer;
|
||||
import appeng.container.implementations.QNBContainer;
|
||||
import appeng.container.implementations.QuartzKnifeContainer;
|
||||
import appeng.container.implementations.SecurityStationContainer;
|
||||
import appeng.container.implementations.SkyChestContainer;
|
||||
import appeng.container.implementations.SpatialIOPortContainer;
|
||||
import appeng.container.implementations.StorageBusContainer;
|
||||
import appeng.container.implementations.UpgradeableContainer;
|
||||
import appeng.container.implementations.VibrationChamberContainer;
|
||||
import appeng.container.implementations.WirelessContainer;
|
||||
import appeng.container.implementations.WirelessTermContainer;
|
||||
import appeng.core.api.client.ApiCellModelRegistry;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.features.registries.cell.BasicCellHandler;
|
||||
@@ -95,11 +173,28 @@ import appeng.core.features.registries.cell.CreativeCellHandler;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.stats.AdvancementTriggers;
|
||||
import appeng.core.stats.AeStats;
|
||||
import appeng.fluids.client.gui.*;
|
||||
import appeng.fluids.container.*;
|
||||
import appeng.fluids.client.gui.FluidFormationPlaneScreen;
|
||||
import appeng.fluids.client.gui.FluidIOScreen;
|
||||
import appeng.fluids.client.gui.FluidInterfaceScreen;
|
||||
import appeng.fluids.client.gui.FluidLevelEmitterScreen;
|
||||
import appeng.fluids.client.gui.FluidStorageBusScreen;
|
||||
import appeng.fluids.client.gui.FluidTerminalScreen;
|
||||
import appeng.fluids.container.FluidFormationPlaneContainer;
|
||||
import appeng.fluids.container.FluidIOContainer;
|
||||
import appeng.fluids.container.FluidInterfaceContainer;
|
||||
import appeng.fluids.container.FluidLevelEmitterContainer;
|
||||
import appeng.fluids.container.FluidStorageBusContainer;
|
||||
import appeng.fluids.container.FluidTerminalContainer;
|
||||
import appeng.fluids.registries.BasicFluidCellGuiHandler;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import appeng.me.cache.*;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cache.EnergyGridCache;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
import appeng.me.cache.P2PCache;
|
||||
import appeng.me.cache.PathGridCache;
|
||||
import appeng.me.cache.SecurityCache;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.recipes.game.DisassembleRecipe;
|
||||
import appeng.recipes.game.FacadeRecipe;
|
||||
import appeng.recipes.handlers.GrinderRecipe;
|
||||
@@ -161,7 +256,7 @@ final class Registration {
|
||||
SkyCompassModel.DEPENDENCIES.forEach(ModelLoader::addSpecialModel);
|
||||
ModelLoader.addSpecialModel(BiometricCardModel.MODEL_BASE);
|
||||
ModelLoader.addSpecialModel(MemoryCardModel.MODEL_BASE);
|
||||
DriveModel.DEPENDENCIES.forEach(ModelLoader::addSpecialModel);
|
||||
ApiCellModelRegistry.registerModels();
|
||||
ModelLoader.addSpecialModel(MolecularAssemblerRenderer.LIGHTS_MODEL);
|
||||
|
||||
PartModels partModels = (PartModels) Api.INSTANCE.registries().partModels();
|
||||
@@ -374,7 +469,7 @@ final class Registration {
|
||||
|
||||
// FIXME LATER
|
||||
public static void postInit() {
|
||||
final IRegistryContainer registries = AEApi.instance().registries();
|
||||
final IRegistryContainer registries = Api.instance().registries();
|
||||
// TODO: Do not use the internal API
|
||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
@@ -383,10 +478,10 @@ final class Registration {
|
||||
|
||||
// Block and part interface have different translation keys, but support the
|
||||
// same upgrades
|
||||
ITextComponent interfaceGroup = parts.iface().asItem().getName();
|
||||
ITextComponent itemIoBusGroup = GuiText.IOBuses.textComponent();
|
||||
ITextComponent fluidIoBusGroup = GuiText.IOBusesFluids.textComponent();
|
||||
ITextComponent storageCellGroup = GuiText.IOBusesFluids.textComponent();
|
||||
String interfaceGroup = parts.iface().asItem().getTranslationKey();
|
||||
String itemIoBusGroup = GuiText.IOBuses.getTranslationKey();
|
||||
String fluidIoBusGroup = GuiText.IOBusesFluids.getTranslationKey();
|
||||
String storageCellGroup = GuiText.IOBusesFluids.getTranslationKey();
|
||||
|
||||
// default settings..
|
||||
((P2PTunnelRegistry) registries.p2pTunnel()).configure();
|
||||
@@ -573,7 +668,7 @@ final class Registration {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState quartzOre = AEApi.instance().definitions().blocks().quartzOre().block().getDefaultState();
|
||||
BlockState quartzOre = Api.instance().definitions().blocks().quartzOre().block().getDefaultState();
|
||||
b.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES,
|
||||
Feature.ORE
|
||||
.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE,
|
||||
@@ -583,7 +678,7 @@ final class Registration {
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHARGED_CERTUS_ORE)) {
|
||||
|
||||
BlockState chargedQuartzOre = AEApi.instance().definitions().blocks().quartzOreCharged().block()
|
||||
BlockState chargedQuartzOre = Api.instance().definitions().blocks().quartzOreCharged().block()
|
||||
.getDefaultState();
|
||||
b.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION,
|
||||
ChargedQuartzOreFeature.INSTANCE
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
*
|
||||
* Copyright (c) 2013 - 2020, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
@@ -23,14 +24,24 @@ import java.util.List;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import appeng.api.client.ICellModelRegistry;
|
||||
import appeng.api.client.IClientHelper;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.storage.cells.ICellInventory;
|
||||
import appeng.api.storage.cells.ICellInventoryHandler;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IClientHelper;
|
||||
import appeng.core.ApiDefinitions;
|
||||
import appeng.core.api.client.ApiCellModelRegistry;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class ApiClientHelper implements IClientHelper {
|
||||
|
||||
private final ICellModelRegistry cells;
|
||||
|
||||
public ApiClientHelper(ApiDefinitions definitions) {
|
||||
this.cells = new ApiCellModelRegistry(definitions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>> void addCellInformation(ICellInventoryHandler<T> handler,
|
||||
List<ITextComponent> lines) {
|
||||
@@ -65,4 +76,9 @@ public class ApiClientHelper implements IClientHelper {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICellModelRegistry cells() {
|
||||
return this.cells;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2020, 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 <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.RecipeManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.crafting.ICraftingHelper;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.ApiDefinitions;
|
||||
import appeng.helpers.CraftingPatternDetails;
|
||||
import appeng.items.misc.EncodedPatternItem;
|
||||
|
||||
public class ApiCrafting implements ICraftingHelper {
|
||||
|
||||
private final IItemDefinition encodedPattern;
|
||||
|
||||
public ApiCrafting(ApiDefinitions definitions) {
|
||||
this.encodedPattern = definitions.items().encodedPattern();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEncodedPattern(@Nullable IAEItemStack item) {
|
||||
return item != null && item.getItem() instanceof EncodedPatternItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEncodedPattern(ItemStack item) {
|
||||
return !item.isEmpty() && item.getItem() instanceof EncodedPatternItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack encodeCraftingPattern(@Nullable ItemStack stack, ICraftingRecipe recipe, ItemStack[] in,
|
||||
ItemStack out, boolean allowSubstitutes) {
|
||||
if (stack == null) {
|
||||
stack = encodedPattern.stack(1);
|
||||
} else {
|
||||
Preconditions.checkArgument(isEncodedPattern(stack));
|
||||
}
|
||||
|
||||
EncodedPatternItem.encodeCraftingPattern(stack, in, new ItemStack[] { out }, recipe.getId(), allowSubstitutes);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack encodeProcessingPattern(@Nullable ItemStack stack, ItemStack[] in, ItemStack[] out) {
|
||||
if (stack == null) {
|
||||
stack = encodedPattern.stack(1);
|
||||
} else {
|
||||
Preconditions.checkArgument(isEncodedPattern(stack));
|
||||
}
|
||||
|
||||
EncodedPatternItem.encodeProcessingPattern(stack, in, out);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingPatternDetails decodePattern(final ItemStack is, final World world, boolean autoRecovery) {
|
||||
if (is == null || world == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EncodedPatternItem patternItem = getPatternItem(is);
|
||||
if (patternItem == null || !patternItem.isEncodedPattern(is)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// The recipe ids encoded in a pattern can go stale. This code attempts to find
|
||||
// the new id
|
||||
// based on the stored inputs/outputs if that happens.
|
||||
ResourceLocation recipeId = patternItem.getCraftingRecipeId(is);
|
||||
if (recipeId != null) {
|
||||
IRecipe<?> recipe = world.getRecipeManager().getRecipes(IRecipeType.CRAFTING).get(recipeId);
|
||||
if (!(recipe instanceof ICraftingRecipe)) {
|
||||
if (!autoRecovery || !attemptRecovery(patternItem, is, world)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We use the shared itemstack for an identity lookup.
|
||||
IAEItemStack ais = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(is);
|
||||
|
||||
return new CraftingPatternDetails(ais, world);
|
||||
}
|
||||
|
||||
private boolean attemptRecovery(EncodedPatternItem patternItem, ItemStack itemStack, World world) {
|
||||
|
||||
RecipeManager recipeManager = world.getRecipeManager();
|
||||
|
||||
List<IAEItemStack> ingredients = patternItem.getIngredients(itemStack);
|
||||
List<IAEItemStack> products = patternItem.getProducts(itemStack);
|
||||
if (ingredients.size() < 9 || products.size() < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ResourceLocation currentRecipeId = patternItem.getCraftingRecipeId(itemStack);
|
||||
|
||||
// Fill a crafting inventory with the ingredients to find a suitable recipe
|
||||
CraftingInventory testInventory = new CraftingInventory(new ContainerNull(), 3, 3);
|
||||
for (int x = 0; x < 9; x++) {
|
||||
final IAEItemStack ais = ingredients.get(x);
|
||||
final ItemStack gs = ais != null ? ais.createItemStack() : ItemStack.EMPTY;
|
||||
testInventory.setInventorySlotContents(x, gs);
|
||||
}
|
||||
|
||||
ICraftingRecipe potentialRecipe = recipeManager.getRecipe(IRecipeType.CRAFTING, testInventory, world)
|
||||
.orElse(null);
|
||||
|
||||
if (potentialRecipe != null) {
|
||||
// Check that it matches the expected output
|
||||
if (products.get(0).isSameType(potentialRecipe.getCraftingResult(testInventory))) {
|
||||
// Yay we found a match, reencode the pattern
|
||||
AELog.debug("Re-Encoding pattern from %s -> %s", currentRecipeId, potentialRecipe.getId());
|
||||
ItemStack[] in = ingredients.stream().map(ais -> ais != null ? ais.createItemStack() : ItemStack.EMPTY)
|
||||
.toArray(ItemStack[]::new);
|
||||
ItemStack out = products.get(0).createItemStack();
|
||||
encodeCraftingPattern(itemStack, potentialRecipe, in, out, patternItem.allowsSubstitution(itemStack));
|
||||
}
|
||||
}
|
||||
|
||||
AELog.debug("Failed to recover encoded crafting pattern for recipe %s", currentRecipeId);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static EncodedPatternItem getPatternItem(ItemStack itemStack) {
|
||||
if (itemStack.getItem() instanceof EncodedPatternItem) {
|
||||
return (EncodedPatternItem) itemStack.getItem();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
*
|
||||
* Copyright (c) 2020, 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 <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.core.api.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import appeng.api.client.ICellModelRegistry;
|
||||
import appeng.core.ApiDefinitions;
|
||||
|
||||
public class ApiCellModelRegistry implements ICellModelRegistry {
|
||||
|
||||
private static final ResourceLocation MODEL_BASE = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/drive_base");
|
||||
private static final ResourceLocation MODEL_CELL_EMPTY = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/drive_cell_empty");
|
||||
private static final ResourceLocation MODEL_CELL_DEFAULT = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/drive_cell");
|
||||
private static final ResourceLocation MODEL_CELL_ITEMS_1K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/1k_item_cell");
|
||||
private static final ResourceLocation MODEL_CELL_ITEMS_4K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/4k_item_cell");
|
||||
private static final ResourceLocation MODEL_CELL_ITEMS_16K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/16k_item_cell");
|
||||
private static final ResourceLocation MODEL_CELL_ITEMS_64K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/64k_item_cell");
|
||||
private static final ResourceLocation MODEL_CELL_FLUIDS_1K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/1k_fluid_cell");
|
||||
private static final ResourceLocation MODEL_CELL_FLUIDS_4K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/4k_fluid_cell");
|
||||
private static final ResourceLocation MODEL_CELL_FLUIDS_16K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/16k_fluid_cell");
|
||||
private static final ResourceLocation MODEL_CELL_FLUIDS_64K = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/64k_fluid_cell");
|
||||
private static final ResourceLocation MODEL_CELL_CREATIVE = new ResourceLocation(
|
||||
"appliedenergistics2:block/drive/cells/creative_cell");
|
||||
|
||||
private static final ResourceLocation[] MODELS = { MODEL_BASE, MODEL_CELL_EMPTY, MODEL_CELL_DEFAULT,
|
||||
MODEL_CELL_ITEMS_1K, MODEL_CELL_ITEMS_4K, MODEL_CELL_ITEMS_16K, MODEL_CELL_ITEMS_64K, MODEL_CELL_FLUIDS_1K,
|
||||
MODEL_CELL_FLUIDS_4K, MODEL_CELL_FLUIDS_16K, MODEL_CELL_FLUIDS_64K, MODEL_CELL_CREATIVE };
|
||||
|
||||
public static void registerModels() {
|
||||
Arrays.stream(MODELS).forEach(ModelLoader::addSpecialModel);
|
||||
}
|
||||
|
||||
private final Map<Item, ResourceLocation> registry;
|
||||
|
||||
public ApiCellModelRegistry(ApiDefinitions definitions) {
|
||||
this.registry = new IdentityHashMap<>();
|
||||
this.registry.put(definitions.items().cell1k().item(), MODEL_CELL_ITEMS_1K);
|
||||
this.registry.put(definitions.items().cell4k().item(), MODEL_CELL_ITEMS_4K);
|
||||
this.registry.put(definitions.items().cell16k().item(), MODEL_CELL_ITEMS_16K);
|
||||
this.registry.put(definitions.items().cell64k().item(), MODEL_CELL_ITEMS_64K);
|
||||
this.registry.put(definitions.items().fluidCell1k().item(), MODEL_CELL_FLUIDS_1K);
|
||||
this.registry.put(definitions.items().fluidCell4k().item(), MODEL_CELL_FLUIDS_4K);
|
||||
this.registry.put(definitions.items().fluidCell16k().item(), MODEL_CELL_FLUIDS_16K);
|
||||
this.registry.put(definitions.items().fluidCell64k().item(), MODEL_CELL_FLUIDS_64K);
|
||||
this.registry.put(definitions.items().fluidCell64k().item(), MODEL_CELL_FLUIDS_64K);
|
||||
this.registry.put(definitions.items().cellCreative().item(), MODEL_CELL_CREATIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModel(Item item, ResourceLocation model) {
|
||||
Preconditions.checkNotNull(item);
|
||||
Preconditions.checkNotNull(model);
|
||||
Preconditions.checkArgument(!this.registry.containsKey(item), "Cannot register an item twice.");
|
||||
|
||||
this.registry.put(item, model);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ResourceLocation model(@Nonnull Item item) {
|
||||
Preconditions.checkNotNull(item);
|
||||
|
||||
return this.registry.get(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public Map<Item, ResourceLocation> models() {
|
||||
return Collections.unmodifiableMap(this.registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ResourceLocation getDefaultModel() {
|
||||
return MODEL_CELL_DEFAULT;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,16 +33,50 @@ import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.fluids.parts.FluidAnnihilationPlanePart;
|
||||
import appeng.fluids.parts.FluidExportBusPart;
|
||||
import appeng.fluids.parts.FluidFormationPlanePart;
|
||||
import appeng.fluids.parts.FluidImportBusPart;
|
||||
import appeng.fluids.parts.FluidInterfacePart;
|
||||
import appeng.fluids.parts.FluidLevelEmitterPart;
|
||||
import appeng.fluids.parts.FluidStorageBusPart;
|
||||
import appeng.fluids.parts.FluidTerminalPart;
|
||||
import appeng.items.parts.ColoredPartItem;
|
||||
import appeng.items.parts.PartItem;
|
||||
import appeng.items.parts.PartItemRendering;
|
||||
import appeng.items.parts.PartModelsHelper;
|
||||
import appeng.parts.automation.*;
|
||||
import appeng.parts.misc.*;
|
||||
import appeng.parts.networking.*;
|
||||
import appeng.parts.p2p.*;
|
||||
import appeng.parts.reporting.*;
|
||||
import appeng.parts.automation.AnnihilationPlanePart;
|
||||
import appeng.parts.automation.ExportBusPart;
|
||||
import appeng.parts.automation.FormationPlanePart;
|
||||
import appeng.parts.automation.IdentityAnnihilationPlanePart;
|
||||
import appeng.parts.automation.ImportBusPart;
|
||||
import appeng.parts.automation.LevelEmitterPart;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.parts.misc.InterfacePart;
|
||||
import appeng.parts.misc.InvertedToggleBusPart;
|
||||
import appeng.parts.misc.StorageBusPart;
|
||||
import appeng.parts.misc.ToggleBusPart;
|
||||
import appeng.parts.networking.CoveredCablePart;
|
||||
import appeng.parts.networking.CoveredDenseCablePart;
|
||||
import appeng.parts.networking.GlassCablePart;
|
||||
import appeng.parts.networking.QuartzFiberPart;
|
||||
import appeng.parts.networking.SmartCablePart;
|
||||
import appeng.parts.networking.SmartDenseCablePart;
|
||||
import appeng.parts.p2p.FEP2PTunnelPart;
|
||||
import appeng.parts.p2p.FluidP2PTunnelPart;
|
||||
import appeng.parts.p2p.ItemP2PTunnelPart;
|
||||
import appeng.parts.p2p.LightP2PTunnelPart;
|
||||
import appeng.parts.p2p.MEP2PTunnelPart;
|
||||
import appeng.parts.p2p.RedstoneP2PTunnelPart;
|
||||
import appeng.parts.reporting.ConversionMonitorPart;
|
||||
import appeng.parts.reporting.CraftingTerminalPart;
|
||||
import appeng.parts.reporting.DarkPanelPart;
|
||||
import appeng.parts.reporting.InterfaceTerminalPart;
|
||||
import appeng.parts.reporting.PanelPart;
|
||||
import appeng.parts.reporting.PatternTerminalPart;
|
||||
import appeng.parts.reporting.SemiDarkPanelPart;
|
||||
import appeng.parts.reporting.StorageMonitorPart;
|
||||
import appeng.parts.reporting.TerminalPart;
|
||||
|
||||
/**
|
||||
* Internal implementation for the API parts
|
||||
|
||||
@@ -29,7 +29,6 @@ import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.IGridCacheFactory;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.core.AELog;
|
||||
|
||||
public final class GridCacheRegistry implements IGridCacheRegistry {
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
@@ -44,6 +43,7 @@ import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.core.Api;
|
||||
|
||||
public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
|
||||
private static final int INITIAL_CAPACITY = 40;
|
||||
@@ -54,7 +54,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
|
||||
|
||||
public void configure() {
|
||||
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.ILocatable;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.features.IWirelessTermRegistry;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.WirelessTermContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry {
|
||||
}
|
||||
|
||||
final long parsedKey = Long.parseLong(unparsedKey);
|
||||
final ILocatable securityStation = AEApi.instance().registries().locatable().getLocatableBy(parsedKey);
|
||||
final ILocatable securityStation = Api.instance().registries().locatable().getLocatableBy(parsedKey);
|
||||
if (securityStation == null) {
|
||||
player.sendMessage(PlayerMessages.StationCanNotBeLocated.get());
|
||||
return;
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.HashSet;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
|
||||
import appeng.api.features.IWorldGen;
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
@@ -16,11 +15,12 @@ import appeng.api.storage.data.IAEStack;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.MEMonitorableContainer;
|
||||
import appeng.core.Api;
|
||||
|
||||
public class BasicItemCellGuiHandler implements ICellGuiHandler {
|
||||
@Override
|
||||
public <T extends IAEStack<T>> boolean isHandlerFor(final IStorageChannel<T> channel) {
|
||||
return channel == AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
return channel == Api.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,13 +20,13 @@ package appeng.core.features.registries.cell;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.cells.CellState;
|
||||
import appeng.api.storage.cells.ICellHandler;
|
||||
import appeng.api.storage.cells.ICellInventoryHandler;
|
||||
import appeng.api.storage.cells.ISaveProvider;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.core.Api;
|
||||
import appeng.items.storage.CreativeStorageCellItem;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class CreativeCellHandler implements ICellHandler {
|
||||
@Override
|
||||
public ICellInventoryHandler getCellInventory(final ItemStack is, final ISaveProvider container,
|
||||
final IStorageChannel channel) {
|
||||
if (channel == AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class) && !is.isEmpty()
|
||||
if (channel == Api.instance().storage().getStorageChannel(IItemStorageChannel.class) && !is.isEmpty()
|
||||
&& is.getItem() instanceof CreativeStorageCellItem) {
|
||||
return CreativeCellInventory.getCell(is);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,32 @@ import java.util.function.Function;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
import appeng.core.sync.packets.*;
|
||||
import appeng.core.sync.packets.AssemblerAnimationPacket;
|
||||
import appeng.core.sync.packets.BlockTransitionEffectPacket;
|
||||
import appeng.core.sync.packets.ClickPacket;
|
||||
import appeng.core.sync.packets.CompassRequestPacket;
|
||||
import appeng.core.sync.packets.CompassResponsePacket;
|
||||
import appeng.core.sync.packets.CompressedNBTPacket;
|
||||
import appeng.core.sync.packets.ConfigButtonPacket;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.CraftRequestPacket;
|
||||
import appeng.core.sync.packets.FluidSlotPacket;
|
||||
import appeng.core.sync.packets.InventoryActionPacket;
|
||||
import appeng.core.sync.packets.ItemTransitionEffectPacket;
|
||||
import appeng.core.sync.packets.JEIRecipePacket;
|
||||
import appeng.core.sync.packets.LightningPacket;
|
||||
import appeng.core.sync.packets.MEFluidInventoryUpdatePacket;
|
||||
import appeng.core.sync.packets.MEInventoryUpdatePacket;
|
||||
import appeng.core.sync.packets.MatterCannonPacket;
|
||||
import appeng.core.sync.packets.MockExplosionPacket;
|
||||
import appeng.core.sync.packets.PaintedEntityPacket;
|
||||
import appeng.core.sync.packets.PartPlacementPacket;
|
||||
import appeng.core.sync.packets.PatternSlotPacket;
|
||||
import appeng.core.sync.packets.ProgressBarPacket;
|
||||
import appeng.core.sync.packets.SwapSlotsPacket;
|
||||
import appeng.core.sync.packets.SwitchGuisPacket;
|
||||
import appeng.core.sync.packets.TargetFluidStackPacket;
|
||||
import appeng.core.sync.packets.TargetItemStackPacket;
|
||||
|
||||
public class BasePacketHandler {
|
||||
private static final Map<Class<? extends BasePacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<>();
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IComparableDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
@@ -40,6 +39,7 @@ import appeng.block.networking.CableBusBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.NetworkToolContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.BasePacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.items.tools.NetworkToolItem;
|
||||
@@ -123,7 +123,7 @@ public class ClickPacket extends BasePacket {
|
||||
final BlockPos pos = new BlockPos(this.x, this.y, this.z);
|
||||
|
||||
final ItemStack is = player.getHeldItem(hand);
|
||||
final IItems items = AEApi.instance().definitions().items();
|
||||
final IItems items = Api.instance().definitions().items();
|
||||
final IComparableDefinition maybeMemoryCard = items.memoryCard();
|
||||
final IComparableDefinition maybeColorApplicator = items.colorApplicator();
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CraftRequestPacket extends BasePacket {
|
||||
if (futureJob != null) {
|
||||
futureJob.cancel(true);
|
||||
}
|
||||
AELog.debug(e);
|
||||
AELog.info(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -41,6 +40,7 @@ import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.BasePacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
@@ -113,7 +113,7 @@ public class JEIRecipePacket extends BasePacket {
|
||||
|
||||
if (inv != null && this.recipe != null && security != null) {
|
||||
final IMEMonitor<IAEItemStack> storage = inv
|
||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
final IPartitionList<IAEItemStack> filter = ViewCellItem.createFilter(cct.getViewCells());
|
||||
|
||||
for (int x = 0; x < craftMatrix.getSlots(); x++) {
|
||||
|
||||
@@ -25,10 +25,10 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.PatternTermContainer;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.BasePacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.util.item.AEItemStack;
|
||||
@@ -76,7 +76,7 @@ public class PatternSlotPacket extends BasePacket {
|
||||
|
||||
this.writeItem(slotItem, data);
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.pattern[x] = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
this.pattern[x] = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(pat.getStackInSlot(x));
|
||||
this.writeItem(this.pattern[x], data);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
@@ -44,6 +43,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.hooks.TickHandler;
|
||||
|
||||
public class CraftingJob implements Runnable, ICraftingJob {
|
||||
@@ -52,9 +52,9 @@ public class CraftingJob implements Runnable, ICraftingJob {
|
||||
|
||||
private final MECraftingInventory original;
|
||||
private final World world;
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage()
|
||||
private final IItemList<IAEItemStack> crafting = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage()
|
||||
private final IItemList<IAEItemStack> missing = Api.instance().storage()
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
|
||||
private final Object monitor = new Object();
|
||||
@@ -85,7 +85,7 @@ public class CraftingJob implements Runnable, ICraftingJob {
|
||||
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
|
||||
final IStorageGrid sg = grid.getCache(IStorageGrid.class);
|
||||
this.original = new MECraftingInventory(
|
||||
sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)), actionSrc,
|
||||
sg.getInventory(Api.instance().storage().getStorageChannel(IItemStorageChannel.class)), actionSrc,
|
||||
false, false, false);
|
||||
|
||||
this.setTree(this.getCraftingTree(cc, what));
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
@@ -35,6 +34,7 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.Api;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
|
||||
public class CraftingTreeNode {
|
||||
@@ -42,7 +42,7 @@ public class CraftingTreeNode {
|
||||
// what slot!
|
||||
private final int slot;
|
||||
private final CraftingJob job;
|
||||
private final IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
private final IItemList<IAEItemStack> used = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
// parent node.
|
||||
private final CraftingTreeProcess parent;
|
||||
|
||||
@@ -28,7 +28,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.fml.hooks.BasicEventHooks;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
@@ -37,6 +36,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.core.Api;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -180,7 +180,7 @@ public class CraftingTreeProcess {
|
||||
ItemStack is = ic.getStackInSlot(x);
|
||||
is = Platform.getContainerItem(is);
|
||||
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
final IAEItemStack o = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(is);
|
||||
if (o != null) {
|
||||
this.bytes++;
|
||||
@@ -195,7 +195,7 @@ public class CraftingTreeProcess {
|
||||
|
||||
if (this.containerItems) {
|
||||
final ItemStack is = Platform.getContainerItem(stack.createItemStack());
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
final IAEItemStack o = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createStack(is);
|
||||
if (o != null) {
|
||||
this.bytes++;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.crafting;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
@@ -27,6 +26,7 @@ import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.Api;
|
||||
import appeng.util.inv.ItemListIgnoreCrafting;
|
||||
|
||||
public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
@@ -47,7 +47,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
|
||||
public MECraftingInventory() {
|
||||
this.localCache = new ItemListIgnoreCrafting<>(
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
this.extractedCache = null;
|
||||
this.injectedCache = null;
|
||||
this.missingCache = null;
|
||||
@@ -65,25 +65,25 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
this.logMissing = parent.logMissing;
|
||||
|
||||
if (this.logMissing) {
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.missingCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.missingCache = null;
|
||||
}
|
||||
|
||||
if (this.logExtracted) {
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.extractedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.extractedCache = null;
|
||||
}
|
||||
|
||||
if (this.logInjections) {
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.injectedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = this.target.getAvailableItems(new ItemListIgnoreCrafting<>(
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList()));
|
||||
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList()));
|
||||
|
||||
this.par = parent;
|
||||
}
|
||||
@@ -96,25 +96,25 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
this.logMissing = logMissing;
|
||||
|
||||
if (logMissing) {
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.missingCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.missingCache = null;
|
||||
}
|
||||
|
||||
if (logExtracted) {
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.extractedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.extractedCache = null;
|
||||
}
|
||||
|
||||
if (logInjections) {
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.injectedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = new ItemListIgnoreCrafting<>(
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
for (final IAEItemStack is : target.getStorageList()) {
|
||||
this.localCache.add(target.extractItems(is, Actionable.SIMULATE, src));
|
||||
}
|
||||
@@ -130,25 +130,25 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
this.logMissing = logMissing;
|
||||
|
||||
if (logMissing) {
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.missingCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.missingCache = null;
|
||||
}
|
||||
|
||||
if (logExtracted) {
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.extractedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.extractedCache = null;
|
||||
}
|
||||
|
||||
if (logInjections) {
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
this.injectedCache = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
} else {
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = target.getAvailableItems(
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
this.localCache = target
|
||||
.getAvailableItems(Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createList());
|
||||
this.par = null;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
|
||||
@Override
|
||||
public IStorageChannel getChannel() {
|
||||
return AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
return Api.instance().storage().getStorageChannel(IItemStorageChannel.class);
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getItemList() {
|
||||
@@ -222,9 +222,9 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack> {
|
||||
}
|
||||
|
||||
public boolean commit(final IActionSource src) {
|
||||
final IItemList<IAEItemStack> added = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
final IItemList<IAEItemStack> added = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
final IItemList<IAEItemStack> pulled = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
|
||||
.createList();
|
||||
boolean failed = false;
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -92,7 +92,7 @@ public final class ChargedQuartzEntity extends AEBaseItemEntity {
|
||||
|
||||
private boolean transform() {
|
||||
final ItemStack item = this.getItem();
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
final IMaterials materials = Api.instance().definitions().materials();
|
||||
|
||||
if (materials.certusQuartzCrystalCharged().isSameAs(item)) {
|
||||
final AxisAlignedBB region = new AxisAlignedBB(this.getPosX() - 1, this.getPosY() - 1, this.getPosZ() - 1,
|
||||
|
||||
@@ -30,10 +30,10 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public final class SingularityEntity extends AEBaseItemEntity {
|
||||
@@ -71,7 +71,7 @@ public final class SingularityEntity extends AEBaseItemEntity {
|
||||
|
||||
final ItemStack item = this.getItem();
|
||||
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
final IMaterials materials = Api.instance().definitions().materials();
|
||||
|
||||
if (materials.singularity().isSameAs(item)) {
|
||||
final AxisAlignedBB region = new AxisAlignedBB(this.getPosX() - 4, this.getPosY() - 4, this.getPosZ() - 4,
|
||||
|
||||
@@ -45,9 +45,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.packets.MockExplosionPacket;
|
||||
import appeng.util.Platform;
|
||||
@@ -102,7 +102,7 @@ public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAddit
|
||||
|
||||
if (this.isInWater() && Platform.isServer()) // put out the fuse.
|
||||
{
|
||||
AEApi.instance().definitions().blocks().tinyTNT().maybeStack(1).ifPresent(tntStack -> {
|
||||
Api.instance().definitions().blocks().tinyTNT().maybeStack(1).ifPresent(tntStack -> {
|
||||
final ItemEntity item = new ItemEntity(this.world, this.getPosX(), this.getPosY(), this.getPosZ(),
|
||||
tntStack);
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.Api;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import appeng.parts.CableBusStorage;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class FacadeContainer implements IFacadeContainer {
|
||||
if ((facadeSides & ix) == ix) {
|
||||
final int id = Math.abs(out.readInt());
|
||||
|
||||
Optional<net.minecraft.item.Item> maybeFacadeItem = AEApi.instance().definitions().items().facade()
|
||||
Optional<net.minecraft.item.Item> maybeFacadeItem = Api.instance().definitions().items().facade()
|
||||
.maybeItem();
|
||||
if (maybeFacadeItem.isPresent()) {
|
||||
final FacadeItem ifa = (FacadeItem) maybeFacadeItem.get();
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -41,6 +40,7 @@ import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.implementations.ContainerHelper;
|
||||
import appeng.container.slot.RestrictedInputSlot;
|
||||
import appeng.core.Api;
|
||||
import appeng.fluids.parts.FluidStorageBusPart;
|
||||
import appeng.fluids.util.IAEFluidTank;
|
||||
import appeng.util.Platform;
|
||||
@@ -162,7 +162,7 @@ public class FluidStorageBusContainer extends FluidConfigurableContainer {
|
||||
Iterator<IAEFluidStack> i = new NullIterator<>();
|
||||
if (cellInv != null) {
|
||||
final IItemList<IAEFluidStack> list = cellInv.getAvailableItems(
|
||||
AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class).createList());
|
||||
Api.instance().storage().getStorageChannel(IFluidStorageChannel.class).createList());
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user