Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff1091d252 | |||
| dd2f1c6dc7 | |||
| f14407b87a | |||
| 04f006695e | |||
| 4f36ccf64d | |||
| d9b4410c94 | |||
| 9bbd0ad61b | |||
| 662a7805dd | |||
| c46eadec08 | |||
| 148207f5c3 | |||
| 3ae251f098 | |||
| 82a906886f | |||
| 5b2c6658c0 | |||
| 653557bc65 | |||
| dde87448a9 | |||
| 8c29eeecdc | |||
| d852d0c216 | |||
| f9bb00a7e7 | |||
| 9f7e42ca7d | |||
| b76c18fedf | |||
| 98ce8235bb | |||
| e1ea4ae22f | |||
| 20ba83c529 | |||
| 225a4d5ab6 | |||
| bd4f03652e | |||
| d6650f9617 | |||
| c5607bda4e | |||
| 11af1f2111 | |||
| 7748f7c92d | |||
| 801fec3eaa | |||
| de324aad91 | |||
| 16ccb2ee46 | |||
| bd0d2a1f28 | |||
| 9abd53a8e8 | |||
| 1f12fc5e91 | |||
| 87fcc6c267 | |||
| e301459dfa | |||
| bf802f1c6f | |||
| 7ba4ca6923 | |||
| 53ed861e23 | |||
| 833f8aca2a | |||
| 9bcf45b7e2 | |||
| b2847677ed | |||
| 95845d5a6c | |||
| 286a3631be | |||
| 6506301049 | |||
| 422543f205 | |||
| 1eec160b74 | |||
| de23b62493 | |||
| 2b6299f2b0 | |||
| b495c972c4 | |||
| 7722dcc720 | |||
| c4d5add5f1 | |||
| 348e6436b8 | |||
| 92457ac680 | |||
| 9e53737635 | |||
| 0e0729166f | |||
| 15a1e8f150 | |||
| b443f1ce57 | |||
| 486a68d06b | |||
| 9b263c5501 | |||
| daf4910548 | |||
| 4f5bdfefe8 | |||
| c9f1387098 | |||
| 1f1d6d041a | |||
| 403a6e8b4a | |||
| 0a0c23c190 | |||
| d28cd798e9 | |||
| 3dedb7eefb | |||
| ae3295d3c9 | |||
| 4bac5f43db | |||
| 2e9a5dc8ea | |||
| 9ac4ea4e6e | |||
| 601faf5087 | |||
| 88e3df897e | |||
| f57a8cefda | |||
| d3fdac2b81 |
@@ -1,17 +1,21 @@
|
|||||||
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
|
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
|
||||||
|
|
||||||
See https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory branch for commits
|
See [AE2-Omnifactory](https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory) branch for commits and [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
|
||||||
and
|
|
||||||
https://github.com/PrototypeTrousers/Applied-Energistics-2/releases for the compiled jars.
|
|
||||||
|
|
||||||
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
|
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
A Mod about Matter, Energy and using them to conquer the world.
|
||||||
|
|
||||||
A Mod about Matter, Energy and using them to conquer the world..
|
## RecipeStages
|
||||||
|
You need to add the following into a CraftTweaker script:
|
||||||
|
```
|
||||||
|
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
|
||||||
|
```
|
||||||
|
|
||||||
|
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Idk why would you like to restrict any, but you can.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
* Applied Energistics 2 API
|
* Applied Energistics 2 API
|
||||||
- (c) 2013 - 2018 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](http://opensource.org/licenses/MIT)
|
- [](http://opensource.org/licenses/MIT)
|
||||||
@@ -25,7 +29,6 @@ A Mod about Matter, Energy and using them to conquer the world..
|
|||||||
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Thanks to
|
Thanks to
|
||||||
|
|
||||||
* Notch et al for Minecraft
|
* Notch et al for Minecraft
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ buildscript {
|
|||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "http://files.minecraftforge.net/maven"
|
url = "http://files.minecraftforge.net/maven"
|
||||||
@@ -65,6 +66,8 @@ archivesBaseName = aebasename
|
|||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'FMLAT': 'appeng_at.cfg'
|
attributes 'FMLAT': 'appeng_at.cfg'
|
||||||
|
attributes "FMLCorePlugin": "appeng.core.AE2ELCore"
|
||||||
|
attributes "FMLCorePluginContainsFMLMod": "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
from sourceSets.api.output
|
from sourceSets.api.output
|
||||||
|
|||||||
+1
-3
@@ -4,7 +4,7 @@ aebuild=7
|
|||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
extended=extended_life
|
extended=extended_life
|
||||||
extendedversion=v0.53.8
|
extendedversion=v0.54.20
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
@@ -24,8 +24,6 @@ ic2_version=2.8.73-ex112
|
|||||||
top_version=1.12-1.4.23-16
|
top_version=1.12-1.4.23-16
|
||||||
cofhcore_version=1.12.2-4.5.2.19
|
cofhcore_version=1.12.2-4.5.2.19
|
||||||
crafttweaker_version=4.1.8.9
|
crafttweaker_version=4.1.8.9
|
||||||
inventorytweaks_version=1.63
|
|
||||||
bogosorter_version=1.1.0
|
|
||||||
ctm_version=MC1.12.2-0.3.1.16
|
ctm_version=MC1.12.2-0.3.1.16
|
||||||
forestry_version=5.8.2.387
|
forestry_version=5.8.2.387
|
||||||
#########################################################
|
#########################################################
|
||||||
|
|||||||
@@ -60,8 +60,16 @@ task sourceJar(type: Jar, overwrite: true) {
|
|||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task devJar(type: Jar, overwrite: true) {
|
||||||
|
from sourceSets.api.output
|
||||||
|
from sourceSets.main.output
|
||||||
|
|
||||||
|
classifier = 'dev'
|
||||||
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives apiJar
|
archives apiJar
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
archives sourceJar
|
archives sourceJar
|
||||||
|
archives devJar
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,17 @@
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url "https://cursemaven.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
maven {
|
||||||
|
name = "CurseForge"
|
||||||
|
url = "https://minecraft.curseforge.com/api/maven/"
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name "Mobius"
|
name "Mobius"
|
||||||
url "http://mobiusstrip.eu/maven"
|
url "http://mobiusstrip.eu/maven"
|
||||||
@@ -29,11 +40,6 @@ repositories {
|
|||||||
url "http://dvs1.progwml6.com/files/maven"
|
url "http://dvs1.progwml6.com/files/maven"
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
|
||||||
name = "Tesla repo"
|
|
||||||
url "https://maven.mcmoddev.com"
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name "Ellpeck"
|
name "Ellpeck"
|
||||||
url "https://maven.ellpeck.de"
|
url "https://maven.ellpeck.de"
|
||||||
@@ -68,11 +74,6 @@ repositories {
|
|||||||
// name 'modmaven'
|
// name 'modmaven'
|
||||||
// url "https://modmaven.k-4u.nl/"
|
// url "https://modmaven.k-4u.nl/"
|
||||||
//}
|
//}
|
||||||
|
|
||||||
maven {
|
|
||||||
name = "CurseForge"
|
|
||||||
url = "https://minecraft.curseforge.com/api/maven/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -80,27 +81,38 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||||
// installable runtime dependencies
|
// installable runtime dependencies
|
||||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
deobfCompile "curse.maven:gregtechceu-557242:3949406"
|
||||||
|
|
||||||
|
compileOnly "curse.maven:chisel-235279:2915375"
|
||||||
|
|
||||||
|
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
|
mods "curse.maven:hwyla-253449:2568751"
|
||||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||||
|
|
||||||
// compile against provided APIs
|
// compile against provided APIs
|
||||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
|
compileOnly "curse.maven:hwyla-253449:2568751"
|
||||||
|
//Code chicken lib, GTCE dependency
|
||||||
|
deobfCompile "curse.maven:CCL-242818:2779848"
|
||||||
|
|
||||||
|
compileOnly "curse.maven:recipe-stages-280554:3405072"
|
||||||
|
compileOnly "curse.maven:item-stages-280316:2696769"
|
||||||
|
compileOnly "curse.maven:game-stages-268655:2951844"
|
||||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||||
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||||
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||||
compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
|
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
||||||
compileOnly "inventory-bogo-sorter:bogosorter:${bogosorter_version}"
|
compileOnly "curse.maven:inventory-bogo-sorter-632327:3975184"
|
||||||
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
||||||
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
||||||
deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:$forestry_version"
|
deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:$forestry_version"
|
||||||
|
|
||||||
|
|
||||||
// at runtime, use the full JEI jar
|
// at runtime, use the full JEI jar
|
||||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
|
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
|
||||||
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
|
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
|
||||||
*/
|
*/
|
||||||
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>, Cloneable
|
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,9 +85,4 @@ public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Ite
|
|||||||
* resets stack sizes to 0.
|
* resets stack sizes to 0.
|
||||||
*/
|
*/
|
||||||
void resetStatus();
|
void resetStatus();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* create a copy of this list.
|
|
||||||
*/
|
|
||||||
IItemList<T> clone();
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.enderio.core.common.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public interface IOverlayRenderAware {
|
||||||
|
|
||||||
|
public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -301,7 +301,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
|||||||
final NBTTagCompound data = memoryCard.getData(heldItem);
|
final NBTTagCompound data = memoryCard.getData(heldItem);
|
||||||
|
|
||||||
if (this.getUnlocalizedName().equals(savedName)) {
|
if (this.getUnlocalizedName().equals(savedName)) {
|
||||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data);
|
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
||||||
} else {
|
} else {
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import appeng.tile.networking.TileCableBusTESR;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -413,6 +414,30 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
return world.getBlockState(pos);
|
return world.getBlockState(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
|
||||||
|
IFacadeContainer container = this.fc(world, pos);
|
||||||
|
if (container != null) {
|
||||||
|
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
|
||||||
|
if (facade != null) {
|
||||||
|
return BlockFaceShape.SOLID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BlockFaceShape.UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEntityWalk(World world, BlockPos pos, Entity entityIn) {
|
||||||
|
IFacadeContainer container = this.fc(world, pos);
|
||||||
|
if (container != null) {
|
||||||
|
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(EnumFacing.UP));
|
||||||
|
if (facade != null) {
|
||||||
|
facade.getBlockState().getBlock().onEntityWalk(world, pos, entityIn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onEntityWalk(world, pos, entityIn);
|
||||||
|
}
|
||||||
|
|
||||||
public static Class<? extends AEBaseTile> getNoTesrTile() {
|
public static Class<? extends AEBaseTile> getNoTesrTile() {
|
||||||
return noTesrTile;
|
return noTesrTile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import appeng.api.parts.CableRenderMode;
|
|||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.render.crafting.ItemEncodedPatternBakedModel;
|
||||||
import appeng.client.render.effects.*;
|
import appeng.client.render.effects.*;
|
||||||
import appeng.client.render.model.UVLModelLoader;
|
import appeng.client.render.model.UVLModelLoader;
|
||||||
import appeng.client.render.tesr.InscriberTESR;
|
import appeng.client.render.tesr.InscriberTESR;
|
||||||
@@ -30,6 +31,7 @@ import appeng.client.render.textures.ParticleTextures;
|
|||||||
import appeng.container.interfaces.IJEIGhostIngredients;
|
import appeng.container.interfaces.IJEIGhostIngredients;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||||
@@ -96,6 +98,9 @@ public class ClientHelper extends ServerHelper {
|
|||||||
ClientRegistry.registerKeyBinding(binding);
|
ClientRegistry.registerKeyBinding(binding);
|
||||||
this.bindings.put(key, binding);
|
this.bindings.put(key, binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Api.INSTANCE.definitions().items().encodedPattern().maybeItem().ifPresent(pattern ->
|
||||||
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(ItemEncodedPatternBakedModel.PATTERN_ITEM_COLOR_HANDLER, pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ import appeng.core.sync.packets.PacketSwapSlots;
|
|||||||
import appeng.fluids.client.render.FluidStackSizeRenderer;
|
import appeng.fluids.client.render.FluidStackSizeRenderer;
|
||||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.items.misc.ItemEncodedPattern;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -66,11 +68,13 @@ import net.minecraftforge.fluids.Fluid;
|
|||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.fml.common.Optional;
|
import net.minecraftforge.fml.common.Optional;
|
||||||
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import yalter.mousetweaks.api.IMTModGuiContainer2;
|
import yalter.mousetweaks.api.IMTModGuiContainer2;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -720,8 +724,14 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
if (slot instanceof SlotFake) {
|
if (slot instanceof SlotFake) {
|
||||||
final ItemStack stack = slot.getStack();
|
final ItemStack stack = slot.getStack();
|
||||||
if (stack != ItemStack.EMPTY) {
|
if (stack != ItemStack.EMPTY) {
|
||||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
final PacketInventoryAction p;
|
||||||
final PacketInventoryAction p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.DOUBLE : InventoryAction.HALVE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||||
|
} else {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||||
|
}
|
||||||
NetworkHandler.instance().sendToServer(p);
|
NetworkHandler.instance().sendToServer(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -887,10 +897,58 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
this.itemRender.zLevel = 0.0F;
|
this.itemRender.zLevel = 0.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (s instanceof SlotPlayerInv || s instanceof SlotPlayerHotBar) {
|
||||||
|
if (!is.isEmpty() && is.getItem() instanceof ItemEncodedPattern) {
|
||||||
|
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||||
|
final ItemStack out = iep.getOutput(is);
|
||||||
|
if (!out.isEmpty()) {
|
||||||
|
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
||||||
|
appEngSlot.setDisplay(true);
|
||||||
|
appEngSlot.setReturnAsSingleStack(true);
|
||||||
|
|
||||||
if (s instanceof AppEngSlot) {
|
this.zLevel = 100.0F;
|
||||||
((AppEngSlot) s).setDisplay(true);
|
this.itemRender.zLevel = 100.0F;
|
||||||
|
|
||||||
|
if (!this.isPowered()) {
|
||||||
|
drawRect(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zLevel = 0.0F;
|
||||||
|
this.itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
// Annoying but easier than trying to splice into render item
|
||||||
|
super.drawSlot(s);
|
||||||
|
|
||||||
|
if (isShiftKeyDown()) {
|
||||||
|
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(out), s.xPos, s.yPos);
|
||||||
|
} else {
|
||||||
|
super.drawSlot(s);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.drawSlot(s);
|
||||||
|
}
|
||||||
|
} else if (s instanceof AppEngSlot) {
|
||||||
|
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
||||||
|
appEngSlot.setDisplay(true);
|
||||||
|
appEngSlot.setReturnAsSingleStack(true);
|
||||||
|
|
||||||
|
this.zLevel = 100.0F;
|
||||||
|
this.itemRender.zLevel = 100.0F;
|
||||||
|
|
||||||
|
if (!this.isPowered()) {
|
||||||
|
drawRect(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zLevel = 0.0F;
|
||||||
|
this.itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
// Annoying but easier than trying to splice into render item
|
||||||
super.drawSlot(s);
|
super.drawSlot(s);
|
||||||
|
|
||||||
|
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(appEngSlot.getDisplayStack()), s.xPos, s.yPos);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
super.drawSlot(s);
|
super.drawSlot(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ package appeng.client.gui;
|
|||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.localization.ButtonToolTips;
|
import appeng.core.localization.ButtonToolTips;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@@ -43,11 +46,12 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
|
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
|
||||||
final Slot s = this.getSlot(x, y);
|
final Slot s = this.getSlot(x, y);
|
||||||
|
|
||||||
|
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||||
|
final List<String> currentToolTip = this.getItemToolTip(stack);
|
||||||
|
|
||||||
if (s instanceof SlotME && !stack.isEmpty()) {
|
if (s instanceof SlotME && !stack.isEmpty()) {
|
||||||
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
|
||||||
|
|
||||||
IAEItemStack myStack = null;
|
IAEItemStack myStack = null;
|
||||||
final List<String> currentToolTip = this.getItemToolTip(stack);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final SlotME theSlotField = (SlotME) s;
|
final SlotME theSlotField = (SlotME) s;
|
||||||
@@ -56,7 +60,7 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (myStack != null) {
|
if (myStack != null) {
|
||||||
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
|
if (myStack.getStackSize() > 1) {
|
||||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
|
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
|
||||||
final String format = String.format(local, formattedAmount);
|
final String format = String.format(local, formattedAmount);
|
||||||
@@ -86,6 +90,15 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (s instanceof AppEngSlot) {
|
||||||
|
if (!(s instanceof SlotPlayerInv) && !(s instanceof SlotPlayerHotBar)) {
|
||||||
|
if (!s.getStack().isEmpty()) {
|
||||||
|
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(s.getStack().getCount());
|
||||||
|
currentToolTip.add(TextFormatting.GRAY + formattedAmount);
|
||||||
|
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.renderToolTip(stack, x, y);
|
super.renderToolTip(stack, x, y);
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class GuiCraftConfirm extends AEBaseGui {
|
|||||||
this.setScrollBar(scrollbar);
|
this.setScrollBar(scrollbar);
|
||||||
|
|
||||||
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
|
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
|
||||||
|
this.ccc.setGui(this);
|
||||||
|
|
||||||
if (te instanceof WirelessTerminalGuiObject) {
|
if (te instanceof WirelessTerminalGuiObject) {
|
||||||
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource {
|
|||||||
protected GuiCraftingCPU(final ContainerCraftingCPU container) {
|
protected GuiCraftingCPU(final ContainerCraftingCPU container) {
|
||||||
super(container);
|
super(container);
|
||||||
this.craftingCpu = container;
|
this.craftingCpu = container;
|
||||||
|
this.craftingCpu.setGui(this);
|
||||||
this.ySize = GUI_HEIGHT;
|
this.ySize = GUI_HEIGHT;
|
||||||
this.xSize = GUI_WIDTH;
|
this.xSize = GUI_WIDTH;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import appeng.api.config.ActionItems;
|
|||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.me.ItemRepo;
|
||||||
import appeng.container.implementations.ContainerCraftingTerm;
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
@@ -81,4 +82,8 @@ public class GuiCraftingTerm extends GuiMEMonitorable {
|
|||||||
protected String getBackground() {
|
protected String getBackground() {
|
||||||
return "guis/crafting.png";
|
return "guis/crafting.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemRepo getRepo() {
|
||||||
|
return this.repo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-10
@@ -19,10 +19,8 @@
|
|||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.ActionItems;
|
import appeng.api.config.ActionItems;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
@@ -37,6 +35,7 @@ import appeng.core.localization.GuiText;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
import appeng.fluids.client.gui.widgets.GuiFluidTank;
|
import appeng.fluids.client.gui.widgets.GuiFluidTank;
|
||||||
|
import appeng.fluids.helper.DualityFluidInterface;
|
||||||
import appeng.fluids.util.AEFluidStack;
|
import appeng.fluids.util.AEFluidStack;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
import appeng.parts.reporting.PartFluidInterfaceConfigurationTerminal;
|
import appeng.parts.reporting.PartFluidInterfaceConfigurationTerminal;
|
||||||
@@ -89,6 +88,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
|
private final Set<ClientDCInternalFluidInv> matchedInterfaces = new HashSet<ClientDCInternalFluidInv>();
|
||||||
|
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
@@ -156,13 +156,15 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
int extraLines = numUpgradesMap.get(inv);
|
int extraLines = numUpgradesMap.get(inv);
|
||||||
|
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
||||||
for (int z = 0; z < 5; z++) {
|
for (int z = 0; z < DualityFluidInterface.NUMBER_OF_TANKS; z++) {
|
||||||
GuiFluidTank tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
GuiFluidTank tankSlot;
|
||||||
|
if (!matchedInterfaces.contains(inv) && !this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
||||||
|
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16, true);
|
||||||
|
} else {
|
||||||
|
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
||||||
|
}
|
||||||
this.guiSlots.add(tankSlot);
|
this.guiSlots.add(tankSlot);
|
||||||
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
offset += 18;
|
offset += 18;
|
||||||
@@ -242,7 +244,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
final Object lineObj = this.lines.get(ex + x);
|
final Object lineObj = this.lines.get(ex + x);
|
||||||
if (lineObj instanceof ClientDCInternalFluidInv) {
|
if (lineObj instanceof ClientDCInternalFluidInv) {
|
||||||
GlStateManager.color(1, 1, 1, 1);
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
final int width = 5 * 18;
|
final int width = DualityFluidInterface.NUMBER_OF_TANKS * 18;
|
||||||
|
|
||||||
int extraLines = numUpgradesMap.get(lineObj);
|
int extraLines = numUpgradesMap.get(lineObj);
|
||||||
|
|
||||||
@@ -321,6 +323,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
|
this.matchedInterfaces.clear();
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
|
|
||||||
@@ -352,8 +355,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
if (found) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
} else {
|
} else {
|
||||||
@@ -441,7 +448,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
ClientDCInternalFluidInv o = this.byId.get(id);
|
ClientDCInternalFluidInv o = this.byId.get(id);
|
||||||
|
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
this.byId.put(id, o = new ClientDCInternalFluidInv(5, id, sortBy, string, 64));
|
this.byId.put(id, o = new ClientDCInternalFluidInv(DualityFluidInterface.NUMBER_OF_TANKS, id, sortBy, string, 1000));
|
||||||
this.refreshList = true;
|
this.refreshList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+22
-6
@@ -52,6 +52,7 @@ import net.minecraft.nbt.NBTUtil;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -60,6 +61,7 @@ import java.util.List;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEIGhostIngredients {
|
public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEIGhostIngredients {
|
||||||
@@ -77,6 +79,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
|
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
||||||
|
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
@@ -147,7 +150,9 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
for (int z = 0; z < 9; z++) {
|
for (int z = 0; z < 9; z++) {
|
||||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||||
|
} else if (!matchedInterfaces.contains(inv)) {
|
||||||
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
@@ -213,8 +218,14 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
if (slot instanceof SlotDisconnected) {
|
if (slot instanceof SlotDisconnected) {
|
||||||
final ItemStack stack = slot.getStack();
|
final ItemStack stack = slot.getStack();
|
||||||
if (stack != ItemStack.EMPTY) {
|
if (stack != ItemStack.EMPTY) {
|
||||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
final PacketInventoryAction p;
|
||||||
final PacketInventoryAction p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.DOUBLE : InventoryAction.HALVE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||||
|
} else {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||||
|
}
|
||||||
NetworkHandler.instance().sendToServer(p);
|
NetworkHandler.instance().sendToServer(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -289,7 +300,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||||
final String which = Integer.toString(x);
|
final String which = Integer.toString(x);
|
||||||
if (invData.hasKey(which)) {
|
if (invData.hasKey(which)) {
|
||||||
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
|
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final NumberFormatException ignored) {
|
} catch (final NumberFormatException ignored) {
|
||||||
@@ -314,6 +325,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
|
this.matchedInterfaces.clear();
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
|
|
||||||
@@ -345,7 +357,11 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
} else {
|
} else {
|
||||||
@@ -435,7 +451,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
ClientDCInternalInv o = this.byId.get(id);
|
ClientDCInternalInv o = this.byId.get(id);
|
||||||
|
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 64));
|
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 512));
|
||||||
this.refreshList = true;
|
this.refreshList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class GuiInterfaceTerminal extends AEBaseGui {
|
public class GuiInterfaceTerminal extends AEBaseGui {
|
||||||
@@ -69,7 +70,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
|
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
private boolean refreshList = false;
|
private boolean refreshList = false;
|
||||||
@@ -155,7 +156,9 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
for (int z = 0; z < 9; z++) {
|
for (int z = 0; z < 9; z++) {
|
||||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||||
|
} else if (!matchedInterfaces.contains(inv)) {
|
||||||
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
@@ -319,7 +322,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||||
final String which = Integer.toString(x);
|
final String which = Integer.toString(x);
|
||||||
if (invData.hasKey(which)) {
|
if (invData.hasKey(which)) {
|
||||||
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
|
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final NumberFormatException ignored) {
|
} catch (final NumberFormatException ignored) {
|
||||||
@@ -344,6 +347,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
|
this.matchedInterfaces.clear();
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
||||||
@@ -393,7 +397,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || (entry.getName().toLowerCase().contains(searchFieldInputs) && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
if ((searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty()) ||
|
||||||
|
!searchFieldInputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldInputs) ||
|
||||||
|
(!searchFieldOutputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ import appeng.api.util.IConfigManager;
|
|||||||
import appeng.api.util.IConfigurableObject;
|
import appeng.api.util.IConfigurableObject;
|
||||||
import appeng.client.ActionKey;
|
import appeng.client.ActionKey;
|
||||||
import appeng.client.gui.AEBaseMEGui;
|
import appeng.client.gui.AEBaseMEGui;
|
||||||
import appeng.client.gui.widgets.*;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.client.gui.widgets.ISortSource;
|
||||||
|
import appeng.client.gui.widgets.MEGuiTextField;
|
||||||
import appeng.client.me.InternalSlotME;
|
import appeng.client.me.InternalSlotME;
|
||||||
import appeng.client.me.ItemRepo;
|
import appeng.client.me.ItemRepo;
|
||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
@@ -73,7 +77,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
private static int craftingGridOffsetY;
|
private static int craftingGridOffsetY;
|
||||||
|
|
||||||
private static String memoryText = "";
|
private static String memoryText = "";
|
||||||
private final ItemRepo repo;
|
protected final ItemRepo repo;
|
||||||
private final int offsetX = 9;
|
private final int offsetX = 9;
|
||||||
private final int lowerTextureOffset = 0;
|
private final int lowerTextureOffset = 0;
|
||||||
private final IConfigManager configSrc;
|
private final IConfigManager configSrc;
|
||||||
@@ -99,7 +103,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
private int currentMouseY = 0;
|
private int currentMouseY = 0;
|
||||||
private boolean delayedUpdate;
|
private boolean delayedUpdate;
|
||||||
|
|
||||||
private boolean updateView = true;
|
|
||||||
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
|
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
|
||||||
|
|
||||||
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
@@ -158,7 +161,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.delayedUpdate) {
|
if (!this.delayedUpdate) {
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +319,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.searchField.setText(memoryText);
|
this.searchField.setText(memoryText);
|
||||||
this.searchField.selectAll();
|
this.searchField.selectAll();
|
||||||
this.repo.setSearchString(memoryText);
|
this.repo.setSearchString(memoryText);
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
craftingGridOffsetX = Integer.MAX_VALUE;
|
craftingGridOffsetX = Integer.MAX_VALUE;
|
||||||
@@ -376,7 +381,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
||||||
this.searchField.setText("");
|
this.searchField.setText("");
|
||||||
this.repo.setSearchString("");
|
this.repo.setSearchString("");
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
@@ -470,7 +476,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
|
|
||||||
if (this.searchField.textboxKeyTyped(character, key)) {
|
if (this.searchField.textboxKeyTyped(character, key)) {
|
||||||
this.repo.setSearchString(this.searchField.getText());
|
this.repo.setSearchString(this.searchField.getText());
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
// tell forge the key event is handled and should not be sent out
|
// tell forge the key event is handled and should not be sent out
|
||||||
this.keyHandled = mouseInGui;
|
this.keyHandled = mouseInGui;
|
||||||
} else {
|
} else {
|
||||||
@@ -497,7 +504,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.delayedUpdate = false;
|
this.delayedUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.delayedUpdate && updateView) {
|
if (!this.delayedUpdate) {
|
||||||
this.repo.updateView();
|
this.repo.updateView();
|
||||||
this.setScrollBar();
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
@@ -533,7 +540,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReservedSpace() {
|
int getReservedSpace() {
|
||||||
|
|||||||
@@ -51,11 +51,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
|||||||
|
|
||||||
private final ItemRepo repo;
|
private final ItemRepo repo;
|
||||||
private final int rows = 4;
|
private final int rows = 4;
|
||||||
|
private final ContainerNetworkStatus cns;
|
||||||
private GuiImgButton units;
|
private GuiImgButton units;
|
||||||
private int tooltip = -1;
|
private int tooltip = -1;
|
||||||
|
|
||||||
private boolean updateView = true;
|
|
||||||
|
|
||||||
public GuiNetworkStatus(final InventoryPlayer inventoryPlayer, final INetworkTool te) {
|
public GuiNetworkStatus(final InventoryPlayer inventoryPlayer, final INetworkTool te) {
|
||||||
super(new ContainerNetworkStatus(inventoryPlayer, te));
|
super(new ContainerNetworkStatus(inventoryPlayer, te));
|
||||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||||
@@ -65,6 +64,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
|||||||
this.ySize = 153;
|
this.ySize = 153;
|
||||||
this.xSize = 195;
|
this.xSize = 195;
|
||||||
this.repo.setRowSize(5);
|
this.repo.setRowSize(5);
|
||||||
|
|
||||||
|
this.cns = (ContainerNetworkStatus) this.inventorySlots;
|
||||||
|
this.cns.setGui(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -204,17 +206,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
|||||||
for (final IAEItemStack is : list) {
|
for (final IAEItemStack is : list) {
|
||||||
this.repo.postUpdate(is);
|
this.repo.postUpdate(is);
|
||||||
}
|
}
|
||||||
this.updateView = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
this.repo.updateView();
|
||||||
public void updateScreen() {
|
this.setScrollBar();
|
||||||
if (updateView) {
|
|
||||||
this.repo.updateView();
|
|
||||||
this.setScrollBar();
|
|
||||||
updateView = false;
|
|
||||||
}
|
|
||||||
super.updateScreen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setScrollBar() {
|
private void setScrollBar() {
|
||||||
|
|||||||
@@ -39,20 +39,19 @@ import javax.annotation.Nonnull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class ItemRepo {
|
public class ItemRepo {
|
||||||
|
|
||||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
private final List<IAEItemStack> view;
|
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||||
private final IScrollSource src;
|
private final IScrollSource src;
|
||||||
private final ISortSource sortSrc;
|
private final ISortSource sortSrc;
|
||||||
|
|
||||||
private int rowSize = 9;
|
private int rowSize = 9;
|
||||||
|
|
||||||
private volatile String searchString = "";
|
private String searchString = "";
|
||||||
private IPartitionList<IAEItemStack> myPartitionList;
|
private IPartitionList<IAEItemStack> myPartitionList;
|
||||||
private String innerSearch = "";
|
private String innerSearch = "";
|
||||||
private boolean hasPower;
|
private boolean hasPower;
|
||||||
@@ -60,9 +59,6 @@ public class ItemRepo {
|
|||||||
public ItemRepo(final IScrollSource src, final ISortSource sortSrc) {
|
public ItemRepo(final IScrollSource src, final ISortSource sortSrc) {
|
||||||
this.src = src;
|
this.src = src;
|
||||||
this.sortSrc = sortSrc;
|
this.sortSrc = sortSrc;
|
||||||
|
|
||||||
this.view = Collections.synchronizedList(new ArrayList<>());
|
|
||||||
list.forEach(this.view::add);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAEItemStack getReferenceItem(int idx) {
|
public IAEItemStack getReferenceItem(int idx) {
|
||||||
@@ -99,123 +95,111 @@ public class ItemRepo {
|
|||||||
this.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Void> searchTask = null;
|
|
||||||
|
|
||||||
public void updateView() {
|
public void updateView() {
|
||||||
if (searchTask != null) {
|
this.view.clear();
|
||||||
return;
|
|
||||||
|
this.view.ensureCapacity(this.list.size());
|
||||||
|
|
||||||
|
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||||
|
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_MODE);
|
||||||
|
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
||||||
|
|
||||||
|
if (searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP) {
|
||||||
|
this.updateJEI(this.searchString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since sortSrc is final, so we can safely call it inside lambda
|
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
||||||
searchTask = CompletableFuture.supplyAsync(() -> {
|
|
||||||
IItemList<IAEItemStack> list = this.list.clone();
|
|
||||||
List<IAEItemStack> view = new ArrayList<>(list.size());
|
|
||||||
Enum viewMode = this.sortSrc.getSortDisplay();
|
|
||||||
|
|
||||||
boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
boolean searchMod = false;
|
||||||
|
|
||||||
boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
this.innerSearch = searchString.toLowerCase();
|
||||||
|
if (this.innerSearch.startsWith("@")) {
|
||||||
|
searchMod = true;
|
||||||
|
this.innerSearch = this.innerSearch.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
boolean searchMod = false;
|
Pattern m = null;
|
||||||
|
try {
|
||||||
String innerSearch = searchString.toLowerCase();
|
m = Pattern.compile(this.innerSearch, Pattern.CASE_INSENSITIVE);
|
||||||
if (innerSearch.startsWith("@")) {
|
} catch (final Throwable ignore) {
|
||||||
searchMod = true;
|
|
||||||
innerSearch = innerSearch.substring(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Pattern m = null;
|
|
||||||
try {
|
try {
|
||||||
m = Pattern.compile(innerSearch, Pattern.CASE_INSENSITIVE);
|
m = Pattern.compile(Pattern.quote(this.innerSearch), Pattern.CASE_INSENSITIVE);
|
||||||
} catch (final Throwable ignore) {
|
} catch (final Throwable __) {
|
||||||
try {
|
return;
|
||||||
m = Pattern.compile(Pattern.quote(innerSearch), Pattern.CASE_INSENSITIVE);
|
}
|
||||||
} catch (final Throwable __) {
|
}
|
||||||
return Collections.<IAEItemStack>emptyList();
|
|
||||||
|
boolean notDone = false;
|
||||||
|
for (IAEItemStack is : this.list) {
|
||||||
|
if (this.myPartitionList != null) {
|
||||||
|
if (!this.myPartitionList.isListed(is)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (IAEItemStack is : list) {
|
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||||
if (this.myPartitionList != null) {
|
continue;
|
||||||
if (!this.myPartitionList.isListed(is)) {
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
final String dspName = (searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is)).toLowerCase();
|
||||||
continue;
|
boolean foundMatchingItemStack = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
for (String term : innerSearch.split(" ")) {
|
||||||
continue;
|
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
||||||
}
|
term = term.substring(1);
|
||||||
|
if (dspName.contains(term)) {
|
||||||
final String dspName = (searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is)).toLowerCase();
|
|
||||||
boolean foundMatchingItemStack = true;
|
|
||||||
|
|
||||||
for (String term : innerSearch.split(" ")) {
|
|
||||||
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
|
||||||
term = term.substring(1);
|
|
||||||
if (dspName.contains(term)) {
|
|
||||||
foundMatchingItemStack = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (!dspName.contains(term)) {
|
|
||||||
foundMatchingItemStack = false;
|
foundMatchingItemStack = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else if (!dspName.contains(term)) {
|
||||||
|
foundMatchingItemStack = false;
|
||||||
if (terminalSearchToolTips && !foundMatchingItemStack) {
|
break;
|
||||||
final List<String> tooltip = Platform.getTooltip(is);
|
|
||||||
for (final String line : tooltip) {
|
|
||||||
if (m.matcher(line).find()) {
|
|
||||||
foundMatchingItemStack = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundMatchingItemStack) {
|
|
||||||
if (needsZeroCopy) {
|
|
||||||
is = is.copy();
|
|
||||||
is.setStackSize(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
view.add(is);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Enum SortBy = this.sortSrc.getSortBy();
|
if (terminalSearchToolTips && !foundMatchingItemStack) {
|
||||||
final Enum SortDir = this.sortSrc.getSortDir();
|
final List<String> tooltip = Platform.getTooltip(is);
|
||||||
|
for (final String line : tooltip) {
|
||||||
ItemSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
if (m.matcher(line).find()) {
|
||||||
ItemSorters.init();
|
foundMatchingItemStack = true;
|
||||||
|
break;
|
||||||
if (SortBy == SortOrder.MOD) {
|
}
|
||||||
view.sort(ItemSorters.CONFIG_BASED_SORT_BY_MOD);
|
|
||||||
} else if (SortBy == SortOrder.AMOUNT) {
|
|
||||||
view.sort(ItemSorters.CONFIG_BASED_SORT_BY_SIZE);
|
|
||||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
|
||||||
if (InventoryBogoSortModule.isLoaded()) {
|
|
||||||
Collections.sort(this.view, InventoryBogoSortModule.COMPARATOR);
|
|
||||||
} else {
|
|
||||||
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundMatchingItemStack) {
|
||||||
|
if (needsZeroCopy) {
|
||||||
|
is = is.copy();
|
||||||
|
is.setStackSize(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.view.add(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Enum SortBy = this.sortSrc.getSortBy();
|
||||||
|
final Enum SortDir = this.sortSrc.getSortDir();
|
||||||
|
|
||||||
|
ItemSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||||
|
ItemSorters.init();
|
||||||
|
|
||||||
|
if (SortBy == SortOrder.MOD) {
|
||||||
|
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||||
|
} else if (SortBy == SortOrder.AMOUNT) {
|
||||||
|
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||||
|
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||||
|
if (InventoryBogoSortModule.isLoaded()) {
|
||||||
|
Collections.sort(this.view, InventoryBogoSortModule.COMPARATOR);
|
||||||
} else {
|
} else {
|
||||||
view.sort(ItemSorters.CONFIG_BASED_SORT_BY_NAME);
|
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
return view;
|
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||||
}).thenAcceptAsync(view -> {
|
}
|
||||||
this.view.clear();
|
|
||||||
this.view.addAll(view);
|
|
||||||
}).thenRunAsync(() -> {
|
|
||||||
this.searchTask = null; // Prevent redundant cancellation
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateJEI(String filter) {
|
private void updateJEI(String filter) {
|
||||||
@@ -227,8 +211,6 @@ public class ItemRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
searchTask.cancel(true);
|
|
||||||
searchTask = null;
|
|
||||||
this.list.resetStatus();
|
this.list.resetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,16 +236,9 @@ public class ItemRepo {
|
|||||||
|
|
||||||
public void setSearchString(@Nonnull final String searchString) {
|
public void setSearchString(@Nonnull final String searchString) {
|
||||||
this.searchString = searchString;
|
this.searchString = searchString;
|
||||||
|
}
|
||||||
|
|
||||||
if (searchTask != null) {
|
public IItemList<IAEItemStack> getList() {
|
||||||
searchTask.cancel(true);
|
return list;
|
||||||
searchTask = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Passive JEI auto search
|
|
||||||
final Enum<?> searchMode = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_MODE);
|
|
||||||
if (searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP) {
|
|
||||||
this.updateJEI(this.searchString);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import appeng.items.misc.ItemEncodedPattern;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -32,13 +32,22 @@ import java.util.List;
|
|||||||
* the pattern is being
|
* the pattern is being
|
||||||
* rendered in the GUI, and not anywhere else.
|
* rendered in the GUI, and not anywhere else.
|
||||||
*/
|
*/
|
||||||
class ItemEncodedPatternBakedModel implements IBakedModel {
|
public class ItemEncodedPatternBakedModel implements IBakedModel {
|
||||||
private final IBakedModel baseModel;
|
private final IBakedModel baseModel;
|
||||||
|
|
||||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||||
|
|
||||||
private final CustomOverrideList overrides;
|
private final CustomOverrideList overrides;
|
||||||
|
|
||||||
|
public static final IItemColor PATTERN_ITEM_COLOR_HANDLER = (stack, tintIndex) -> {
|
||||||
|
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||||
|
ItemStack output = iep.getOutput(stack);
|
||||||
|
if (!output.isEmpty() && isShiftKeyDown()) {
|
||||||
|
return Minecraft.getMinecraft().getItemColors().colorMultiplier(output, tintIndex);
|
||||||
|
}
|
||||||
|
return 0xFFFFFF;
|
||||||
|
};
|
||||||
|
|
||||||
ItemEncodedPatternBakedModel(IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms) {
|
ItemEncodedPatternBakedModel(IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms) {
|
||||||
this.baseModel = baseModel;
|
this.baseModel = baseModel;
|
||||||
this.transforms = transforms;
|
this.transforms = transforms;
|
||||||
@@ -90,88 +99,8 @@ class ItemEncodedPatternBakedModel implements IBakedModel {
|
|||||||
return PerspectiveMapWrapper.handlePerspective(this, this.transforms, cameraTransformType);
|
return PerspectiveMapWrapper.handlePerspective(this, this.transforms, cameraTransformType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static boolean isShiftKeyDown() {
|
||||||
* Since the ItemOverrideList handling comes before handling the perspective awareness (which is the first place
|
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||||
* where we
|
|
||||||
* know how we are being rendered) we need to remember the model of the crafting output, and make the decision on
|
|
||||||
* which to render later on.
|
|
||||||
* Sadly, Forge is pretty inconsistent when it will call the handlePerspective method, so some methods are called
|
|
||||||
* even on this interim-model.
|
|
||||||
* Usually those methods only matter for rendering on the ground and other cases, where we wouldn't render the
|
|
||||||
* crafting output model anyway,
|
|
||||||
* so in those cases we delegate to the model of the encoded pattern.
|
|
||||||
*/
|
|
||||||
private class ShiftHoldingModelWrapper implements IBakedModel {
|
|
||||||
|
|
||||||
private final IBakedModel outputModel;
|
|
||||||
|
|
||||||
private ShiftHoldingModelWrapper(IBakedModel outputModel) {
|
|
||||||
this.outputModel = outputModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
|
||||||
final IBakedModel selectedModel;
|
|
||||||
|
|
||||||
// No need to re-check for shift being held since this model is only handed out in that case
|
|
||||||
if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) {
|
|
||||||
selectedModel = this.outputModel;
|
|
||||||
} else {
|
|
||||||
selectedModel = ItemEncodedPatternBakedModel.this.baseModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now retroactively handle the isGui3d call, for which we always return false below
|
|
||||||
if (selectedModel.isGui3d() != ItemEncodedPatternBakedModel.this.baseModel.isGui3d()) {
|
|
||||||
GlStateManager.enableLighting();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedModel instanceof IBakedModel) {
|
|
||||||
return selectedModel.handlePerspective(cameraTransformType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return PerspectiveMapWrapper.handlePerspective(this, ItemEncodedPatternBakedModel.this.transforms, cameraTransformType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getQuads(state, side, rand);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAmbientOcclusion() {
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.isAmbientOcclusion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGui3d() {
|
|
||||||
// NOTE: Sadly, Forge will let Minecraft call this method before handling the perspective awareness
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.isGui3d();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBuiltInRenderer() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.isBuiltInRenderer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getParticleTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getItemCameraTransforms();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemOverrideList getOverrides() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getOverrides();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,15 +117,11 @@ class ItemEncodedPatternBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
||||||
boolean shiftHeld = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
if (isShiftKeyDown()) {
|
||||||
if (shiftHeld) {
|
|
||||||
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||||
ItemStack output = iep.getOutput(stack);
|
ItemStack output = iep.getOutput(stack);
|
||||||
if (!output.isEmpty()) {
|
if (!output.isEmpty()) {
|
||||||
IBakedModel realModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(output);
|
return Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(output, world, entity);
|
||||||
// Give the item model a chance to handle the overrides as well
|
|
||||||
realModel = realModel.getOverrides().handleItemState(realModel, output, world, entity);
|
|
||||||
return new ShiftHoldingModelWrapper(realModel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import appeng.helpers.InventoryAction;
|
|||||||
import appeng.me.helpers.PlayerSource;
|
import appeng.me.helpers.PlayerSource;
|
||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.helpers.ItemHandlerUtil;
|
||||||
import appeng.util.inv.AdaptorItemHandler;
|
import appeng.util.inv.AdaptorItemHandler;
|
||||||
import appeng.util.inv.WrapperCursorItemHandler;
|
import appeng.util.inv.WrapperCursorItemHandler;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
@@ -407,8 +408,6 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
clickSlot.putStack(ItemStack.EMPTY);
|
clickSlot.putStack(ItemStack.EMPTY);
|
||||||
d.onSlotChanged();
|
d.onSlotChanged();
|
||||||
|
|
||||||
// if ( hasMETiles ) updateClient();
|
|
||||||
|
|
||||||
this.updateSlot(clickSlot);
|
this.updateSlot(clickSlot);
|
||||||
this.updateSlot(d);
|
this.updateSlot(d);
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
@@ -427,42 +426,7 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d.isItemValid(tis)) {
|
if (d.isItemValid(tis)) {
|
||||||
if (d.getHasStack()) {
|
if (!d.getHasStack()) {
|
||||||
final ItemStack t = d.getStack().copy();
|
|
||||||
|
|
||||||
if (Platform.itemComparisons().isSameItem(t, tis)) {
|
|
||||||
int maxSize = t.getMaxStackSize();
|
|
||||||
if (d.getSlotStackLimit() < maxSize) {
|
|
||||||
maxSize = d.getSlotStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
int placeAble = maxSize - t.getCount();
|
|
||||||
|
|
||||||
if (tis.getCount() < placeAble) {
|
|
||||||
placeAble = tis.getCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
t.setCount(t.getCount() + placeAble);
|
|
||||||
tis.setCount(tis.getCount() - placeAble);
|
|
||||||
|
|
||||||
d.putStack(t);
|
|
||||||
|
|
||||||
if (tis.getCount() <= 0) {
|
|
||||||
clickSlot.putStack(ItemStack.EMPTY);
|
|
||||||
d.onSlotChanged();
|
|
||||||
|
|
||||||
// if ( worldEntity != null )
|
|
||||||
// worldEntity.markDirty();
|
|
||||||
// if ( hasMETiles ) updateClient();
|
|
||||||
|
|
||||||
this.updateSlot(clickSlot);
|
|
||||||
this.updateSlot(d);
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
} else {
|
|
||||||
this.updateSlot(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int maxSize = tis.getMaxStackSize();
|
int maxSize = tis.getMaxStackSize();
|
||||||
if (maxSize > d.getSlotStackLimit()) {
|
if (maxSize > d.getSlotStackLimit()) {
|
||||||
maxSize = d.getSlotStackLimit();
|
maxSize = d.getSlotStackLimit();
|
||||||
@@ -480,10 +444,6 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
clickSlot.putStack(ItemStack.EMPTY);
|
clickSlot.putStack(ItemStack.EMPTY);
|
||||||
d.onSlotChanged();
|
d.onSlotChanged();
|
||||||
|
|
||||||
// if ( worldEntity != null )
|
|
||||||
// worldEntity.markDirty();
|
|
||||||
// if ( hasMETiles ) updateClient();
|
|
||||||
|
|
||||||
this.updateSlot(clickSlot);
|
this.updateSlot(clickSlot);
|
||||||
this.updateSlot(d);
|
this.updateSlot(d);
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
@@ -545,23 +505,20 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PICKUP_OR_SET_DOWN:
|
case PICKUP_OR_SET_DOWN:
|
||||||
|
|
||||||
if (hand.isEmpty()) {
|
if (hand.isEmpty()) {
|
||||||
s.putStack(ItemStack.EMPTY);
|
s.putStack(ItemStack.EMPTY);
|
||||||
} else {
|
} else {
|
||||||
s.putStack(hand.copy());
|
s.putStack(hand.copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE:
|
||||||
|
|
||||||
if (!hand.isEmpty()) {
|
if (!hand.isEmpty()) {
|
||||||
final ItemStack is = hand.copy();
|
final ItemStack is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
} else {
|
} else {
|
||||||
final ItemStack is = s.getStack().copy();
|
final ItemStack is = s.getStack().copy();
|
||||||
if (is.getCount() < is.getMaxStackSize())
|
if (is.getCount() < is.getMaxStackSize() * 8)
|
||||||
is.grow(1);
|
is.grow(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
}
|
}
|
||||||
@@ -575,7 +532,6 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPLIT_OR_PLACE_SINGLE:
|
case SPLIT_OR_PLACE_SINGLE:
|
||||||
|
|
||||||
ItemStack is = s.getStack();
|
ItemStack is = s.getStack();
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
if (hand.isEmpty()) {
|
if (hand.isEmpty()) {
|
||||||
@@ -586,14 +542,26 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
is = hand.copy();
|
is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
} else if (!hand.isEmpty()) {
|
} else if (!hand.isEmpty()) {
|
||||||
is = hand.copy();
|
is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case HALVE:
|
||||||
|
if (s.getStack().getCount() > 1) {
|
||||||
|
ItemStack halved = s.getStack().copy();
|
||||||
|
halved.setCount(s.getStack().getCount() / 2);
|
||||||
|
s.putStack(halved);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DOUBLE:
|
||||||
|
ItemStack doubled = s.getStack().copy();
|
||||||
|
if (s.getStack().getCount() * 2 > 0) {
|
||||||
|
doubled.setCount(Math.min(s.getSlotStackLimit(), s.getStack().getCount() * 2));
|
||||||
|
s.putStack(doubled);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CREATIVE_DUPLICATE:
|
case CREATIVE_DUPLICATE:
|
||||||
case MOVE_REGION:
|
case MOVE_REGION:
|
||||||
@@ -606,9 +574,9 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
if (action == InventoryAction.MOVE_REGION) {
|
if (action == InventoryAction.MOVE_REGION) {
|
||||||
final List<Slot> from = new ArrayList<>();
|
final List<Slot> from = new ArrayList<>();
|
||||||
|
|
||||||
for (final Object j : this.inventorySlots) {
|
for (final Slot j : this.inventorySlots) {
|
||||||
if (j instanceof Slot && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
if (j != null && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||||
from.add((Slot) j);
|
from.add(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import appeng.api.storage.ITerminalHost;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -61,6 +62,7 @@ import javax.annotation.Nonnull;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
|
||||||
@@ -85,6 +87,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
public boolean noCPU = true;
|
public boolean noCPU = true;
|
||||||
@GuiSync(7)
|
@GuiSync(7)
|
||||||
public String myName = "";
|
public String myName = "";
|
||||||
|
private GuiCraftConfirm guiCraftConfirm;
|
||||||
|
|
||||||
public ContainerCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
public ContainerCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||||
super(ip, te);
|
super(ip, te);
|
||||||
@@ -403,4 +406,12 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
public void setJob(final Future<ICraftingJob> job) {
|
public void setJob(final Future<ICraftingJob> job) {
|
||||||
this.job = job;
|
this.job = job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||||
|
this.guiCraftConfirm.postUpdate(list, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(GuiCraftConfirm guiCraftConfirm) {
|
||||||
|
this.guiCraftConfirm = guiCraftConfirm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -47,6 +49,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.inventory.IContainerListener;
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject {
|
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject {
|
||||||
@@ -58,6 +61,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
|
|
||||||
@GuiSync(0)
|
@GuiSync(0)
|
||||||
public long eta = -1;
|
public long eta = -1;
|
||||||
|
private GuiCraftingCPU guiCraftingCPU;
|
||||||
|
|
||||||
public ContainerCraftingCPU(final InventoryPlayer ip, final Object te) {
|
public ContainerCraftingCPU(final InventoryPlayer ip, final Object te) {
|
||||||
super(ip, te);
|
super(ip, te);
|
||||||
@@ -232,4 +236,12 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
private void setNetwork(final IGrid network) {
|
private void setNetwork(final IGrid network) {
|
||||||
this.network = network;
|
this.network = network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||||
|
this.guiCraftingCPU.postUpdate(list, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(GuiCraftingCPU guiCraftingCPU) {
|
||||||
|
this.guiCraftingCPU = guiCraftingCPU;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ import appeng.container.ContainerNull;
|
|||||||
import appeng.container.slot.SlotCraftingMatrix;
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
import appeng.container.slot.SlotCraftingTerm;
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
|
import appeng.parts.reporting.AbstractPartTerminal;
|
||||||
import appeng.parts.reporting.PartCraftingTerminal;
|
import appeng.parts.reporting.PartCraftingTerminal;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
import appeng.util.inv.WrapperInvItemHandler;
|
import appeng.util.inv.WrapperInvItemHandler;
|
||||||
|
|||||||
+12
-404
@@ -1,55 +1,33 @@
|
|||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.container.slot.*;
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
import appeng.parts.reporting.PartExpandedProcessingPatternTerminal;
|
import appeng.container.slot.SlotPatternOutputs;
|
||||||
import appeng.util.Platform;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
|
||||||
import appeng.util.inv.InvOperation;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IContainerListener;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static appeng.helpers.PatternHelper.PROCESSING_INPUT_LIMIT;
|
import static appeng.helpers.PatternHelper.PROCESSING_INPUT_LIMIT;
|
||||||
import static appeng.helpers.PatternHelper.PROCESSING_OUTPUT_LIMIT;
|
import static appeng.helpers.PatternHelper.PROCESSING_OUTPUT_LIMIT;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerExpandedProcessingPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
public class ContainerExpandedProcessingPatternTerm extends ContainerPatternEncoder {
|
||||||
private final IItemHandler crafting;
|
|
||||||
private final SlotFakeCraftingMatrix[] gridSlots = new SlotFakeCraftingMatrix[PROCESSING_INPUT_LIMIT];
|
|
||||||
private final OptionalSlotFake[] outputSlots = new OptionalSlotFake[PROCESSING_OUTPUT_LIMIT];
|
|
||||||
private final SlotRestrictedInput patternSlotIN;
|
|
||||||
private final SlotRestrictedInput patternSlotOUT;
|
|
||||||
private final PartExpandedProcessingPatternTerminal expandedProcessingPatternTerminal;
|
|
||||||
|
|
||||||
public ContainerExpandedProcessingPatternTerm(InventoryPlayer ip, ITerminalHost monitorable) {
|
public ContainerExpandedProcessingPatternTerm(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||||
super(ip, monitorable, false);
|
super(ip, monitorable, false);
|
||||||
|
|
||||||
this.expandedProcessingPatternTerminal = (PartExpandedProcessingPatternTerminal) monitorable;
|
this.craftingSlots = new SlotFakeCraftingMatrix[PROCESSING_INPUT_LIMIT];
|
||||||
|
this.outputSlots = new OptionalSlotFake[PROCESSING_OUTPUT_LIMIT];
|
||||||
|
|
||||||
final IItemHandler patternInv = this.getExpandedPatternTerminal().getInventoryByName("pattern");
|
final IItemHandler patternInv = this.getPart().getInventoryByName("pattern");
|
||||||
final IItemHandler output = this.getExpandedPatternTerminal().getInventoryByName("output");
|
final IItemHandler output = this.getPart().getInventoryByName("output");
|
||||||
|
|
||||||
this.crafting = this.getExpandedPatternTerminal().getInventoryByName("crafting");
|
this.crafting = this.getPart().getInventoryByName("crafting");
|
||||||
|
|
||||||
for (int y = 0; y < 4; y++) {
|
for (int y = 0; y < 4; y++) {
|
||||||
for (int x = 0; x < 4; x++) {
|
for (int x = 0; x < 4; x++) {
|
||||||
this.addSlotToContainer(this.gridSlots[x + y * 4] = new SlotFakeCraftingMatrix(this.crafting, x + y * 4, 4 + x * 18, -85 + y * 18));
|
this.addSlotToContainer(this.craftingSlots[x + y * 4] = new SlotFakeCraftingMatrix(this.crafting, x + y * 4, 4 + x * 18, -85 + y * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,124 +45,7 @@ public class ContainerExpandedProcessingPatternTerm extends ContainerMEMonitorab
|
|||||||
this.patternSlotOUT.setStackLimit(1);
|
this.patternSlotOUT.setStackLimit(1);
|
||||||
|
|
||||||
this.bindPlayerInventory(ip, 0, 0);
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
|
||||||
if (Platform.isClient()) {
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
if (this.inventorySlots.get(idx) instanceof SlotPlayerInv || this.inventorySlots.get(idx) instanceof SlotPlayerHotBar) {
|
|
||||||
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
|
|
||||||
ItemStack itemStack = clickSlot.getStack();
|
|
||||||
if (AEApi.instance().definitions().materials().blankPattern().isSameAs(itemStack)) {
|
|
||||||
IItemHandler patternInv = this.getExpandedPatternTerminal().getInventoryByName("pattern");
|
|
||||||
ItemStack remainder = patternInv.insertItem(0, itemStack, false);
|
|
||||||
clickSlot.putStack(remainder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.transferStackInSlot(p, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveChanges() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encodeAndMoveToInventory() {
|
|
||||||
encode();
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
if (!output.isEmpty()) {
|
|
||||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
|
||||||
getPlayerInv().player.dropItem(output, false);
|
|
||||||
}
|
|
||||||
this.patternSlotOUT.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encode() {
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
|
|
||||||
final ItemStack[] in = this.getInputs();
|
|
||||||
final ItemStack[] out = this.getOutputs();
|
|
||||||
|
|
||||||
// if there is no input, this would be silly.
|
|
||||||
if (in == null || out == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check the output slots, should either be null, or a pattern
|
|
||||||
if (!output.isEmpty() && !this.isPattern(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)) {
|
|
||||||
return; // no blanks.
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove one, and clear the input slot.
|
|
||||||
output.setCount(output.getCount() - 1);
|
|
||||||
if (output.getCount() == 0) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// encode the slot.
|
|
||||||
final NBTTagCompound encodedValue = new NBTTagCompound();
|
|
||||||
|
|
||||||
final NBTTagList tagIn = new NBTTagList();
|
|
||||||
final NBTTagList tagOut = new NBTTagList();
|
|
||||||
|
|
||||||
for (final ItemStack i : in) {
|
|
||||||
tagIn.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final ItemStack i : out) {
|
|
||||||
tagOut.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
encodedValue.setTag("in", tagIn);
|
|
||||||
encodedValue.setTag("out", tagOut);
|
|
||||||
encodedValue.setBoolean("crafting", false);
|
|
||||||
encodedValue.setBoolean("substitute", false);
|
|
||||||
|
|
||||||
output.setTagCompound(encodedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isPattern(final ItemStack output) {
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IDefinitions definitions = AEApi.instance().definitions();
|
|
||||||
|
|
||||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
|
||||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
|
||||||
|
|
||||||
return isPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
NBTBase createItemTag(final ItemStack i) {
|
|
||||||
final NBTTagCompound c = new NBTTagCompound();
|
|
||||||
|
|
||||||
if (!i.isEmpty()) {
|
|
||||||
i.writeToNBT(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -192,261 +53,8 @@ public class ContainerExpandedProcessingPatternTerm extends ContainerMEMonitorab
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemStack[] getInputs() {
|
|
||||||
final ItemStack[] input = new ItemStack[16];
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty()) {
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack[] getOutputs() {
|
|
||||||
final List<ItemStack> list = new ArrayList<>(3);
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
|
|
||||||
if (!out.isEmpty() && out.getCount() > 0) {
|
|
||||||
list.add(out);
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return list.toArray(new ItemStack[0]);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
for (final Slot s : this.gridSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Slot s : this.outputSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemHandler getInventoryByName(final String name) {
|
public boolean isCraftingMode() {
|
||||||
if (name.equals("player")) {
|
|
||||||
return new PlayerInvWrapper(this.getInventoryPlayer());
|
|
||||||
}
|
|
||||||
return this.getExpandedPatternTerminal().getInventoryByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean useRealItems() {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartExpandedProcessingPatternTerminal getExpandedPatternTerminal() {
|
|
||||||
return this.expandedProcessingPatternTerminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void multiply(int multiple) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canMultiplyInputs = true;
|
|
||||||
boolean canMultiplyOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() * multiple > input[x].getMaxStackSize()) {
|
|
||||||
canMultiplyInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() * multiple > out.getMaxStackSize()) {
|
|
||||||
canMultiplyOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canMultiplyInputs && canMultiplyOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void divide(int divide) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canDivideInputs = true;
|
|
||||||
boolean canDivideOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() % divide != 0) {
|
|
||||||
canDivideInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() % divide != 0) {
|
|
||||||
canDivideOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDivideInputs && canDivideOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void increase(int increase) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canIncreaseInputs = true;
|
|
||||||
boolean canIncreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize()) {
|
|
||||||
canIncreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() + increase > out.getMaxStackSize()) {
|
|
||||||
canIncreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canIncreaseInputs && canIncreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrease(int decrease) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canDecreaseInputs = true;
|
|
||||||
boolean canDecreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() - decrease < 1) {
|
|
||||||
canDecreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() - decrease < 1) {
|
|
||||||
canDecreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDecreaseInputs && canDecreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void maximizeCount() {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canGrowInputs = true;
|
|
||||||
boolean canGrowOutputs = true;
|
|
||||||
int maxInputStackGrowth = 0;
|
|
||||||
int maxOutputStackGrowth = 0;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth) {
|
|
||||||
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
|
||||||
}
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize()) {
|
|
||||||
canGrowInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
{
|
|
||||||
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
|
||||||
}
|
|
||||||
if (!out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize()) {
|
|
||||||
canGrowOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canGrowInputs && canGrowOutputs) {
|
|
||||||
int maxStackGrowth = Math.min(maxInputStackGrowth, maxOutputStackGrowth);
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSlotChange(final Slot s) {
|
|
||||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
|
||||||
for (final IContainerListener listener : this.listeners) {
|
|
||||||
for (final Slot slot : this.inventorySlots) {
|
|
||||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
|
||||||
listener.sendSlotContents(this, slot.slotNumber, slot.getStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (listener instanceof EntityPlayerMP) {
|
|
||||||
((EntityPlayerMP) listener).isChangingQuantityOnly = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,13 @@ import appeng.container.guisync.GuiSync;
|
|||||||
import appeng.container.slot.*;
|
import appeng.container.slot.*;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
import appeng.helpers.IInterfaceHost;
|
import appeng.helpers.IInterfaceHost;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.tile.inventory.AppEngInternalOversizedInventory;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.ClickType;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
|
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
|
||||||
@@ -62,10 +67,23 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++) {
|
for (int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++) {
|
||||||
this.addSlotToContainer(new SlotNormal(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
|
this.addSlotToContainer(new SlotOversized(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
|
||||||
|
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
|
||||||
|
if (this.inventorySlots.get(slotId) instanceof SlotOversized) {
|
||||||
|
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(true);
|
||||||
|
ItemStack ret = super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||||
|
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(false);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getHeight() {
|
protected int getHeight() {
|
||||||
return 256;
|
return 256;
|
||||||
|
|||||||
+16
-2
@@ -50,6 +50,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
|
||||||
public final class ContainerInterfaceConfigurationTerminal extends AEBaseContainer {
|
public final class ContainerInterfaceConfigurationTerminal extends AEBaseContainer {
|
||||||
|
|
||||||
@@ -184,7 +186,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE:
|
||||||
if (inSlot.getMaxStackSize() > inSlot.getCount()) {
|
if (inSlot.getCount() < inSlot.getMaxStackSize() * 8) {
|
||||||
inSlot.grow(1);
|
inSlot.grow(1);
|
||||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
||||||
}
|
}
|
||||||
@@ -222,6 +224,18 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, player.inventory.getItemStack().copy());
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, player.inventory.getItemStack().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case HALVE:
|
||||||
|
if (inSlot.getCount() > 1) {
|
||||||
|
ItemStack halved = inSlot.copy();
|
||||||
|
halved.setCount(inSlot.getCount() / 2);
|
||||||
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, halved);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DOUBLE:
|
||||||
|
ItemStack doubled = inSlot.copy();
|
||||||
|
doubled.setCount(Math.min(512, inSlot.getCount() * 2));
|
||||||
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, doubled);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -298,7 +312,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
||||||
|
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
is.writeToNBT(itemNBT);
|
stackWriteToNBT(is, itemNBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
tag.setTag(Integer.toString(x + offset), itemNBT);
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
|
||||||
public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||||
|
|
||||||
@@ -345,7 +347,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
|||||||
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
||||||
|
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
is.writeToNBT(itemNBT);
|
stackWriteToNBT(is, itemNBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
tag.setTag(Integer.toString(x + offset), itemNBT);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import appeng.api.storage.data.IItemList;
|
|||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.api.util.IConfigurableObject;
|
import appeng.api.util.IConfigurableObject;
|
||||||
|
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
@@ -64,13 +65,14 @@ import net.minecraftforge.fml.common.Loader;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.BufferOverflowException;
|
import java.nio.BufferOverflowException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
||||||
|
|
||||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||||
private final IMEMonitor<IAEItemStack> monitor;
|
private final IMEMonitor<IAEItemStack> monitor;
|
||||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
public final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
private final IConfigManager clientCM;
|
private final IConfigManager clientCM;
|
||||||
private final ITerminalHost host;
|
private final ITerminalHost host;
|
||||||
@GuiSync(99)
|
@GuiSync(99)
|
||||||
@@ -357,11 +359,19 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||||||
this.hasPower = isPowered;
|
this.hasPower = isPowered;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IConfigManagerHost getGui() {
|
public IConfigManagerHost getGui() {
|
||||||
return this.gui;
|
return this.gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IItemList<IAEItemStack> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list) {
|
||||||
|
((GuiMEMonitorable) this.gui).postUpdate(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
|||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -42,6 +43,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerNetworkStatus extends AEBaseContainer {
|
public class ContainerNetworkStatus extends AEBaseContainer {
|
||||||
@@ -56,6 +58,7 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
|||||||
public long maxPower;
|
public long maxPower;
|
||||||
private IGrid network;
|
private IGrid network;
|
||||||
private int delay = 40;
|
private int delay = 40;
|
||||||
|
private GuiNetworkStatus guiNetworkStatus;
|
||||||
|
|
||||||
public ContainerNetworkStatus(final InventoryPlayer ip, final INetworkTool te) {
|
public ContainerNetworkStatus(final InventoryPlayer ip, final INetworkTool te) {
|
||||||
super(ip, null, null);
|
super(ip, null, null);
|
||||||
@@ -160,4 +163,12 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
|||||||
private void setPowerUsage(final long powerUsage) {
|
private void setPowerUsage(final long powerUsage) {
|
||||||
this.powerUsage = powerUsage;
|
this.powerUsage = powerUsage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list) {
|
||||||
|
this.guiNetworkStatus.postUpdate(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(GuiNetworkStatus guiNetworkStatus) {
|
||||||
|
this.guiNetworkStatus = guiNetworkStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,549 @@
|
|||||||
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.definitions.IDefinitions;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.IOptionalSlotHost;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
|
import appeng.parts.reporting.AbstractPartEncoder;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.nbt.NBTBase;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
public abstract class ContainerPatternEncoder extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||||
|
|
||||||
|
private final AbstractPartEncoder patternTerminal;
|
||||||
|
|
||||||
|
final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
||||||
|
|
||||||
|
protected IItemHandler crafting;
|
||||||
|
protected SlotPatternTerm craftSlot;
|
||||||
|
protected SlotRestrictedInput patternSlotIN;
|
||||||
|
protected SlotRestrictedInput patternSlotOUT;
|
||||||
|
private IRecipe currentRecipe;
|
||||||
|
|
||||||
|
protected SlotFakeCraftingMatrix[] craftingSlots;
|
||||||
|
protected OptionalSlotFake[] outputSlots;
|
||||||
|
|
||||||
|
@GuiSync(97)
|
||||||
|
public boolean craftingMode = true;
|
||||||
|
@GuiSync(96)
|
||||||
|
public boolean substitute = false;
|
||||||
|
|
||||||
|
public ContainerPatternEncoder(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||||
|
super(ip, monitorable);
|
||||||
|
patternTerminal = (AbstractPartEncoder) monitorable;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ContainerPatternEncoder(InventoryPlayer ip, ITerminalHost monitorable, boolean bindInventory) {
|
||||||
|
super(ip, monitorable, bindInventory);
|
||||||
|
patternTerminal = (AbstractPartEncoder) monitorable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||||
|
if (Platform.isClient()) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
if (this.inventorySlots.get(idx) instanceof SlotPlayerInv || this.inventorySlots.get(idx) instanceof SlotPlayerHotBar) {
|
||||||
|
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
|
||||||
|
ItemStack itemStack = clickSlot.getStack();
|
||||||
|
if (AEApi.instance().definitions().materials().blankPattern().isSameAs(itemStack)) {
|
||||||
|
IItemHandler patternInv = this.getPart().getInventoryByName("pattern");
|
||||||
|
ItemStack remainder = patternInv.insertItem(0, itemStack, false);
|
||||||
|
clickSlot.putStack(remainder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.transferStackInSlot(p, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractPartEncoder getPart() {
|
||||||
|
return this.patternTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract boolean isSlotEnabled(int idx);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemHandler getInventoryByName(String name) {
|
||||||
|
if (name.equals("player")) {
|
||||||
|
return new PlayerInvWrapper(this.getInventoryPlayer());
|
||||||
|
}
|
||||||
|
return this.getPart().getInventoryByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useRealItems() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putStackInSlot(int slotID, ItemStack stack) {
|
||||||
|
super.putStackInSlot(slotID, stack);
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateOrderOfOutputSlots() {
|
||||||
|
if (!this.isCraftingMode()) {
|
||||||
|
if (craftSlot != null) {
|
||||||
|
this.craftSlot.xPos = -9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.outputSlots[y].xPos = this.outputSlots[y].getX();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (craftSlot != null) {
|
||||||
|
this.craftSlot.xPos = this.craftSlot.getX();
|
||||||
|
}
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.outputSlots[y].xPos = -9000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSlotChange(final Slot s) {
|
||||||
|
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||||
|
for (final IContainerListener listener : this.listeners) {
|
||||||
|
for (final Slot slot : this.inventorySlots) {
|
||||||
|
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
||||||
|
listener.sendSlotContents(this, slot.slotNumber, slot.getStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (listener instanceof EntityPlayerMP) {
|
||||||
|
((EntityPlayerMP) listener).isChangingQuantityOnly = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encodeAndMoveToInventory() {
|
||||||
|
encode();
|
||||||
|
ItemStack output = this.patternSlotOUT.getStack();
|
||||||
|
if (!output.isEmpty()) {
|
||||||
|
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||||
|
getPlayerInv().player.dropItem(output, false);
|
||||||
|
}
|
||||||
|
this.patternSlotOUT.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode() {
|
||||||
|
ItemStack output = this.patternSlotOUT.getStack();
|
||||||
|
|
||||||
|
final ItemStack[] in = this.getInputs();
|
||||||
|
final ItemStack[] out = this.getOutputs();
|
||||||
|
|
||||||
|
// if there is no input, this would be silly.
|
||||||
|
if (in == null || out == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// first check the output slots, should either be null, or a pattern
|
||||||
|
if (!output.isEmpty() && !this.isPattern(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)) {
|
||||||
|
return; // no blanks.
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove one, and clear the input slot.
|
||||||
|
output.setCount(output.getCount() - 1);
|
||||||
|
if (output.getCount() == 0) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// encode the slot.
|
||||||
|
final NBTTagCompound encodedValue = new NBTTagCompound();
|
||||||
|
|
||||||
|
final NBTTagList tagIn = new NBTTagList();
|
||||||
|
final NBTTagList tagOut = new NBTTagList();
|
||||||
|
|
||||||
|
for (final ItemStack i : in) {
|
||||||
|
tagIn.appendTag(this.createItemTag(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final ItemStack i : out) {
|
||||||
|
tagOut.appendTag(this.createItemTag(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
encodedValue.setTag("in", tagIn);
|
||||||
|
encodedValue.setTag("out", tagOut);
|
||||||
|
encodedValue.setBoolean("crafting", this.isCraftingMode());
|
||||||
|
encodedValue.setBoolean("substitute", this.isSubstitute());
|
||||||
|
|
||||||
|
output.setTagCompound(encodedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void multiply(int multiple) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canMultiplyInputs = true;
|
||||||
|
boolean canMultiplyOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() * multiple < 1) {
|
||||||
|
canMultiplyInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() * multiple < 1) {
|
||||||
|
canMultiplyOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canMultiplyInputs && canMultiplyOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() * multiple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() * multiple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void divide(int divide) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canDivideInputs = true;
|
||||||
|
boolean canDivideOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() % divide != 0) {
|
||||||
|
canDivideInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() % divide != 0) {
|
||||||
|
canDivideOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canDivideInputs && canDivideOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() / divide);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() / divide);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void increase(int increase) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canIncreaseInputs = true;
|
||||||
|
boolean canIncreaseOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() + increase < 1) {
|
||||||
|
canIncreaseInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() + increase < 1) {
|
||||||
|
canIncreaseOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canIncreaseInputs && canIncreaseOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() + increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() + increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrease(int decrease) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canDecreaseInputs = true;
|
||||||
|
boolean canDecreaseOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() - decrease < 1) {
|
||||||
|
canDecreaseInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() - decrease < 1) {
|
||||||
|
canDecreaseOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canDecreaseInputs && canDecreaseOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() - decrease);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() - decrease);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void maximizeCount() {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canGrowInputs = true;
|
||||||
|
boolean canGrowOutputs = true;
|
||||||
|
int maxInputStackGrowth = 0;
|
||||||
|
int maxOutputStackGrowth = 0;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth) {
|
||||||
|
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
||||||
|
}
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize()) {
|
||||||
|
canGrowInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
{
|
||||||
|
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
||||||
|
}
|
||||||
|
if (!out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize()) {
|
||||||
|
canGrowOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canGrowInputs && canGrowOutputs) {
|
||||||
|
int maxStackGrowth = Math.min(maxInputStackGrowth, maxOutputStackGrowth);
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack[] getInputs() {
|
||||||
|
final ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean hasValue = false;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty()) {
|
||||||
|
hasValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack[] getOutputs() {
|
||||||
|
if (this.isCraftingMode()) {
|
||||||
|
final ItemStack out = this.getAndUpdateOutput();
|
||||||
|
|
||||||
|
if (!out.isEmpty() && out.getCount() > 0) {
|
||||||
|
return new ItemStack[]{out};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final List<ItemStack> list = new ArrayList<>(outputSlots.length);
|
||||||
|
boolean hasValue = false;
|
||||||
|
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
|
||||||
|
if (!out.isEmpty() && out.getCount() > 0) {
|
||||||
|
list.add(out);
|
||||||
|
hasValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue) {
|
||||||
|
return list.toArray(new ItemStack[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack getAndUpdateOutput() {
|
||||||
|
final World world = this.getPlayerInv().player.world;
|
||||||
|
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
||||||
|
|
||||||
|
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||||
|
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, world)) {
|
||||||
|
this.currentRecipe = CraftingManager.findMatchingRecipe(ic, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
final ItemStack is;
|
||||||
|
|
||||||
|
if (this.currentRecipe == null) {
|
||||||
|
is = ItemStack.EMPTY;
|
||||||
|
} else {
|
||||||
|
is = this.currentRecipe.getCraftingResult(ic);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cOut.setStackInSlot(0, is);
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCraftingMode() {
|
||||||
|
return this.craftingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCraftingMode(final boolean craftingMode) {
|
||||||
|
this.craftingMode = craftingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean isSubstitute() {
|
||||||
|
return this.substitute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubstitute(final boolean substitute) {
|
||||||
|
this.substitute = substitute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
if (this.isCraftingMode() != this.getPart().isCraftingRecipe()) {
|
||||||
|
this.setCraftingMode(this.getPart().isCraftingRecipe());
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.substitute = this.getPart().isSubstitution();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||||
|
super.onUpdate(field, oldValue, newValue);
|
||||||
|
|
||||||
|
if (field.equals("craftingMode")) {
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isPattern(final ItemStack output) {
|
||||||
|
if (output.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final IDefinitions definitions = AEApi.instance().definitions();
|
||||||
|
|
||||||
|
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
||||||
|
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
||||||
|
|
||||||
|
return isPattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTBase createItemTag(final ItemStack i) {
|
||||||
|
final NBTTagCompound c = new NBTTagCompound();
|
||||||
|
|
||||||
|
if (!i.isEmpty()) {
|
||||||
|
stackWriteToNBT(i, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
for (final Slot s : this.craftingSlots) {
|
||||||
|
s.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final Slot s : this.outputSlots) {
|
||||||
|
s.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,7 +21,6 @@ package appeng.container.implementations;
|
|||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
@@ -29,64 +28,50 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.slot.*;
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.IOptionalSlotHost;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternOutputs;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.core.sync.packets.PacketPatternSlot;
|
import appeng.core.sync.packets.PacketPatternSlot;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
|
||||||
import appeng.items.storage.ItemViewCell;
|
import appeng.items.storage.ItemViewCell;
|
||||||
import appeng.me.helpers.MachineSource;
|
import appeng.me.helpers.MachineSource;
|
||||||
import appeng.parts.reporting.PartPatternTerminal;
|
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
|
||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.inv.AdaptorItemHandler;
|
import appeng.util.inv.AdaptorItemHandler;
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
|
||||||
import appeng.util.inv.InvOperation;
|
|
||||||
import appeng.util.inv.WrapperCursorItemHandler;
|
import appeng.util.inv.WrapperCursorItemHandler;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.*;
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
import net.minecraft.inventory.InventoryCraftResult;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.inventory.SlotCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
|
|
||||||
public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
public class ContainerPatternTerm extends ContainerPatternEncoder {
|
||||||
|
|
||||||
private final PartPatternTerminal patternTerminal;
|
|
||||||
private final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
|
||||||
private final IItemHandler crafting;
|
|
||||||
private final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9];
|
|
||||||
private final OptionalSlotFake[] outputSlots = new OptionalSlotFake[3];
|
|
||||||
private final SlotPatternTerm craftSlot;
|
|
||||||
private final SlotRestrictedInput patternSlotIN;
|
|
||||||
private final SlotRestrictedInput patternSlotOUT;
|
|
||||||
|
|
||||||
private IRecipe currentRecipe;
|
|
||||||
@GuiSync(97)
|
|
||||||
public boolean craftingMode = true;
|
|
||||||
@GuiSync(96)
|
|
||||||
public boolean substitute = false;
|
|
||||||
|
|
||||||
public ContainerPatternTerm(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
public ContainerPatternTerm(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||||
super(ip, monitorable, false);
|
super(ip, monitorable, false);
|
||||||
this.patternTerminal = (PartPatternTerminal) monitorable;
|
|
||||||
|
|
||||||
final IItemHandler patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
this.craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||||
final IItemHandler output = this.getPatternTerminal().getInventoryByName("output");
|
this.outputSlots = new OptionalSlotFake[3];
|
||||||
|
|
||||||
this.crafting = this.getPatternTerminal().getInventoryByName("crafting");
|
final IItemHandler patternInv = this.getPart().getInventoryByName("pattern");
|
||||||
|
final IItemHandler output = this.getPart().getInventoryByName("output");
|
||||||
|
|
||||||
|
this.crafting = this.getPart().getInventoryByName("crafting");
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < 3; y++) {
|
||||||
for (int x = 0; x < 3; x++) {
|
for (int x = 0; x < 3; x++) {
|
||||||
@@ -98,7 +83,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this));
|
.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this));
|
||||||
this.craftSlot.setIIcon(-1);
|
this.craftSlot.setIIcon(-1);
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < this.outputSlots.length; y++) {
|
||||||
this.addSlotToContainer(this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
this.addSlotToContainer(this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
||||||
this.outputSlots[y].setRenderDisabled(false);
|
this.outputSlots[y].setRenderDisabled(false);
|
||||||
this.outputSlots[y].setIIcon(-1);
|
this.outputSlots[y].setIIcon(-1);
|
||||||
@@ -117,388 +102,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
this.updateOrderOfOutputSlots();
|
this.updateOrderOfOutputSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
|
||||||
if (Platform.isClient()) {
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
if (this.inventorySlots.get(idx) instanceof SlotPlayerInv || this.inventorySlots.get(idx) instanceof SlotPlayerHotBar) {
|
|
||||||
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
|
|
||||||
ItemStack itemStack = clickSlot.getStack();
|
|
||||||
if (AEApi.instance().definitions().materials().blankPattern().isSameAs(itemStack)) {
|
|
||||||
IItemHandler patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
|
||||||
ItemStack remainder = patternInv.insertItem(0, itemStack, false);
|
|
||||||
clickSlot.putStack(remainder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.transferStackInSlot(p, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void updateOrderOfOutputSlots() {
|
|
||||||
if (!this.isCraftingMode()) {
|
|
||||||
this.craftSlot.xPos = -9000;
|
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
|
||||||
this.outputSlots[y].xPos = this.outputSlots[y].getX();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.craftSlot.xPos = this.craftSlot.getX();
|
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
|
||||||
this.outputSlots[y].xPos = -9000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putStackInSlot(int slotID, ItemStack stack) {
|
|
||||||
super.putStackInSlot(slotID, stack);
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack getAndUpdateOutput() {
|
|
||||||
final World world = this.getPlayerInv().player.world;
|
|
||||||
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
|
||||||
|
|
||||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
|
||||||
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, world)) {
|
|
||||||
this.currentRecipe = CraftingManager.findMatchingRecipe(ic, world);
|
|
||||||
}
|
|
||||||
|
|
||||||
final ItemStack is;
|
|
||||||
|
|
||||||
if (this.currentRecipe == null) {
|
|
||||||
is = ItemStack.EMPTY;
|
|
||||||
} else {
|
|
||||||
is = this.currentRecipe.getCraftingResult(ic);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.cOut.setStackInSlot(0, is);
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveChanges() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encodeAndMoveToInventory() {
|
|
||||||
encode();
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
if (!output.isEmpty()) {
|
|
||||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
|
||||||
getPlayerInv().player.dropItem(output, false);
|
|
||||||
}
|
|
||||||
this.patternSlotOUT.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encode() {
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
|
|
||||||
final ItemStack[] in = this.getInputs();
|
|
||||||
final ItemStack[] out = this.getOutputs();
|
|
||||||
|
|
||||||
// if there is no input, this would be silly.
|
|
||||||
if (in == null || out == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check the output slots, should either be null, or a pattern
|
|
||||||
if (!output.isEmpty() && !this.isPattern(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)) {
|
|
||||||
return; // no blanks.
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove one, and clear the input slot.
|
|
||||||
output.setCount(output.getCount() - 1);
|
|
||||||
if (output.getCount() == 0) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// encode the slot.
|
|
||||||
final NBTTagCompound encodedValue = new NBTTagCompound();
|
|
||||||
|
|
||||||
final NBTTagList tagIn = new NBTTagList();
|
|
||||||
final NBTTagList tagOut = new NBTTagList();
|
|
||||||
|
|
||||||
for (final ItemStack i : in) {
|
|
||||||
tagIn.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final ItemStack i : out) {
|
|
||||||
tagOut.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
encodedValue.setTag("in", tagIn);
|
|
||||||
encodedValue.setTag("out", tagOut);
|
|
||||||
encodedValue.setBoolean("crafting", this.isCraftingMode());
|
|
||||||
encodedValue.setBoolean("substitute", this.isSubstitute());
|
|
||||||
|
|
||||||
output.setTagCompound(encodedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void multiply(int multiple) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canMultiplyInputs = true;
|
|
||||||
boolean canMultiplyOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() * multiple > input[x].getMaxStackSize()) {
|
|
||||||
canMultiplyInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() * multiple > out.getMaxStackSize()) {
|
|
||||||
canMultiplyOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canMultiplyInputs && canMultiplyOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void divide(int divide) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canDivideInputs = true;
|
|
||||||
boolean canDivideOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() % divide != 0) {
|
|
||||||
canDivideInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() % divide != 0) {
|
|
||||||
canDivideOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDivideInputs && canDivideOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void increase(int increase) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canIncreaseInputs = true;
|
|
||||||
boolean canIncreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize()) {
|
|
||||||
canIncreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() + increase > out.getMaxStackSize()) {
|
|
||||||
canIncreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canIncreaseInputs && canIncreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrease(int decrease) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canDecreaseInputs = true;
|
|
||||||
boolean canDecreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() - decrease < 1) {
|
|
||||||
canDecreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() - decrease < 1) {
|
|
||||||
canDecreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDecreaseInputs && canDecreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void maximizeCount() {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canGrowInputs = true;
|
|
||||||
boolean canGrowOutputs = true;
|
|
||||||
int maxInputStackGrowth = 0;
|
|
||||||
int maxOutputStackGrowth = 0;
|
|
||||||
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth) {
|
|
||||||
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
|
||||||
}
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize()) {
|
|
||||||
canGrowInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
{
|
|
||||||
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
|
||||||
}
|
|
||||||
if (!out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize()) {
|
|
||||||
canGrowOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canGrowInputs && canGrowOutputs) {
|
|
||||||
int maxStackGrowth = Math.min(maxInputStackGrowth, maxOutputStackGrowth);
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack[] getInputs() {
|
|
||||||
final ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty()) {
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack[] getOutputs() {
|
|
||||||
if (this.isCraftingMode()) {
|
|
||||||
final ItemStack out = this.getAndUpdateOutput();
|
|
||||||
|
|
||||||
if (!out.isEmpty() && out.getCount() > 0) {
|
|
||||||
return new ItemStack[]{out};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final List<ItemStack> list = new ArrayList<>(3);
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
|
|
||||||
if (!out.isEmpty() && out.getCount() > 0) {
|
|
||||||
list.add(out);
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return list.toArray(new ItemStack[list.size()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isPattern(final ItemStack output) {
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IDefinitions definitions = AEApi.instance().definitions();
|
|
||||||
|
|
||||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
|
||||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
|
||||||
|
|
||||||
return isPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
NBTBase createItemTag(final ItemStack i) {
|
|
||||||
final NBTTagCompound c = new NBTTagCompound();
|
|
||||||
|
|
||||||
if (!i.isEmpty()) {
|
|
||||||
i.writeToNBT(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSlotEnabled(final int idx) {
|
public boolean isSlotEnabled(final int idx) {
|
||||||
if (idx == 1) {
|
if (idx == 1) {
|
||||||
return Platform.isServer() ? !this.getPatternTerminal().isCraftingRecipe() : !this.isCraftingMode();
|
return Platform.isServer() ? !this.getPart().isCraftingRecipe() : !this.isCraftingMode();
|
||||||
} else if (idx == 2) {
|
} else if (idx == 2) {
|
||||||
return Platform.isServer() ? this.getPatternTerminal().isCraftingRecipe() : this.isCraftingMode();
|
return Platform.isServer() ? this.getPart().isCraftingRecipe() : this.isCraftingMode();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -543,7 +153,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal()
|
final IMEMonitor<IAEItemStack> storage = this.getPart()
|
||||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||||
|
|
||||||
@@ -585,107 +195,10 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
if (!failed.isEmpty()) {
|
if (!failed.isEmpty()) {
|
||||||
this.getCellInventory()
|
this.getCellInventory()
|
||||||
.injectItems(AEItemStack.fromItemStack(failed), Actionable.MODULATE,
|
.injectItems(AEItemStack.fromItemStack(failed), Actionable.MODULATE,
|
||||||
new MachineSource(this.getPatternTerminal()));
|
new MachineSource(this.getPart()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detectAndSendChanges() {
|
|
||||||
super.detectAndSendChanges();
|
|
||||||
if (Platform.isServer()) {
|
|
||||||
if (this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe()) {
|
|
||||||
this.setCraftingMode(this.getPatternTerminal().isCraftingRecipe());
|
|
||||||
this.updateOrderOfOutputSlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.substitute = this.patternTerminal.isSubstitution();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
|
||||||
super.onUpdate(field, oldValue, newValue);
|
|
||||||
|
|
||||||
if (field.equals("craftingMode")) {
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
this.updateOrderOfOutputSlots();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSlotChange(final Slot s) {
|
|
||||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
|
||||||
for (final IContainerListener listener : this.listeners) {
|
|
||||||
for (final Slot slot : this.inventorySlots) {
|
|
||||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
|
||||||
listener.sendSlotContents(this, slot.slotNumber, slot.getStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (listener instanceof EntityPlayerMP) {
|
|
||||||
((EntityPlayerMP) listener).isChangingQuantityOnly = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s == this.craftSlot && Platform.isClient()) {
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
for (final Slot s : this.craftingSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Slot s : this.outputSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IItemHandler getInventoryByName(final String name) {
|
|
||||||
if (name.equals("player")) {
|
|
||||||
return new PlayerInvWrapper(this.getInventoryPlayer());
|
|
||||||
}
|
|
||||||
return this.getPatternTerminal().getInventoryByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean useRealItems() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleSubstitute() {
|
|
||||||
this.substitute = !this.substitute;
|
|
||||||
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCraftingMode() {
|
|
||||||
return this.craftingMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCraftingMode(final boolean craftingMode) {
|
|
||||||
this.craftingMode = craftingMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PartPatternTerminal getPatternTerminal() {
|
|
||||||
return this.patternTerminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isSubstitute() {
|
|
||||||
return this.substitute;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubstitute(final boolean substitute) {
|
|
||||||
this.substitute = substitute;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
|||||||
this.securityBox = (TileSecurityStation) monitorable;
|
this.securityBox = (TileSecurityStation) monitorable;
|
||||||
|
|
||||||
this.addSlotToContainer(this.configSlot = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox
|
this.addSlotToContainer(this.configSlot = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox
|
||||||
.getConfigSlot(), 0, 37, -33 + jeiOffset, ip));
|
.getConfigSlot(), 0, 37, -33, ip));
|
||||||
|
|
||||||
this.addSlotToContainer(
|
this.addSlotToContainer(
|
||||||
this.wirelessIn = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, this.wirelessEncoder, 0, 212, 10 + jeiOffset, ip));
|
this.wirelessIn = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, this.wirelessEncoder, 0, 212, 10 + jeiOffset, ip));
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class AppEngSlot extends Slot {
|
|||||||
private int IIcon = -1;
|
private int IIcon = -1;
|
||||||
private hasCalculatedValidness isValid;
|
private hasCalculatedValidness isValid;
|
||||||
private boolean isDisplay = false;
|
private boolean isDisplay = false;
|
||||||
|
private boolean returnAsSingleStack;
|
||||||
|
|
||||||
public AppEngSlot(final IItemHandler inv, final int idx, final int x, final int y) {
|
public AppEngSlot(final IItemHandler inv, final int idx, final int x, final int y) {
|
||||||
super(emptyInventory, idx, x, y);
|
super(emptyInventory, idx, x, y);
|
||||||
@@ -94,14 +95,29 @@ public class AppEngSlot extends Slot {
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.isDisplay()) {
|
if (this.isDisplay()) {
|
||||||
this.setDisplay(false);
|
this.setDisplay(false);
|
||||||
|
if (this.returnAsSingleStack()) {
|
||||||
|
setReturnAsSingleStack(false);
|
||||||
|
ItemStack ret = this.getDisplayStack().copy();
|
||||||
|
ret.setCount(1);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
return this.getDisplayStack();
|
return this.getDisplayStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.itemHandler.getStackInSlot(this.index);
|
return this.itemHandler.getStackInSlot(this.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean returnAsSingleStack() {
|
||||||
|
return this.returnAsSingleStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReturnAsSingleStack(boolean returnAsSingleStack) {
|
||||||
|
this.returnAsSingleStack = returnAsSingleStack;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStack(final ItemStack stack) {
|
public void putStack(final ItemStack stack) {
|
||||||
if (this.isSlotEnabled()) {
|
if (this.isSlotEnabled()) {
|
||||||
@@ -120,7 +136,7 @@ public class AppEngSlot extends Slot {
|
|||||||
@Override
|
@Override
|
||||||
public void onSlotChanged() {
|
public void onSlotChanged() {
|
||||||
this.setIsValid(hasCalculatedValidness.NotAvailable);
|
this.setIsValid(hasCalculatedValidness.NotAvailable);
|
||||||
if (this.isSlotEnabled()) {
|
if (this.isSlotEnabled() && this.itemHandler != null) {
|
||||||
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, this.getStack().copy());
|
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, this.getStack().copy());
|
||||||
|
|
||||||
if (this.getContainer() != null) {
|
if (this.getContainer() != null) {
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ public class OptionalSlotFake extends SlotFake implements IOptionalSlot {
|
|||||||
return this.host.isSlotEnabled(this.groupNum);
|
return this.host.isSlotEnabled(this.groupNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotStackLimit() {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRenderDisabled() {
|
public boolean isRenderDisabled() {
|
||||||
return this.renderDisabled;
|
return this.renderDisabled;
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ import appeng.util.inv.AdaptorItemHandler;
|
|||||||
import appeng.util.inv.WrapperCursorItemHandler;
|
import appeng.util.inv.WrapperCursorItemHandler;
|
||||||
import appeng.util.inv.WrapperInvItemHandler;
|
import appeng.util.inv.WrapperInvItemHandler;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import com.blamejared.recipestages.recipes.RecipeStage;
|
||||||
|
import net.darkhax.gamestages.GameStageHelper;
|
||||||
|
import net.darkhax.itemstages.ItemStages;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -49,6 +53,9 @@ import net.minecraft.item.crafting.IRecipe;
|
|||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -90,6 +97,28 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't render the item client-side if the item stage for it is not unlocked yet
|
||||||
|
@Override
|
||||||
|
public ItemStack getStack() {
|
||||||
|
if (Platform.isClient() && Loader.isModLoaded("itemstages")) {
|
||||||
|
return itemstageStack();
|
||||||
|
}
|
||||||
|
return super.getStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
ItemStack itemstageStack() {
|
||||||
|
final ItemStack item = super.getStack();
|
||||||
|
final String itemsStage = ItemStages.getStage(item);
|
||||||
|
final String enchantStage = ItemStages.getEnchantStage(item);
|
||||||
|
final EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
|
|
||||||
|
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|
||||||
|
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
return super.getStack();
|
||||||
|
}
|
||||||
|
|
||||||
public void doClick(final InventoryAction action, final EntityPlayer who) {
|
public void doClick(final InventoryAction action, final EntityPlayer who) {
|
||||||
if (this.getStack().isEmpty()) {
|
if (this.getStack().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -144,17 +173,39 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
protected IRecipe findRecipe(InventoryCrafting ic, World world) {
|
protected IRecipe findRecipe(InventoryCrafting ic, World world, EntityPlayer player) {
|
||||||
if (this.container instanceof ContainerCraftingTerm) {
|
if (this.container instanceof ContainerCraftingTerm) {
|
||||||
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||||
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||||
|
|
||||||
if (recipe != null && recipe.matches(ic, world)) {
|
if (recipe != null && recipe.matches(ic, world)) {
|
||||||
return containerTerminal.getCurrentRecipe();
|
return handleRecipe(ic, containerTerminal.getCurrentRecipe(), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CraftingManager.findMatchingRecipe(ic, world);
|
return handleRecipe(ic, CraftingManager.findMatchingRecipe(ic, world), player);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns null in case this recipe is not yet unlocked
|
||||||
|
private IRecipe handleRecipe(InventoryCrafting ic, IRecipe recipe, EntityPlayer player) {
|
||||||
|
if (Loader.isModLoaded("recipestages")) {
|
||||||
|
if (recipe instanceof RecipeStage) {
|
||||||
|
final RecipeStage staged = (RecipeStage) recipe;
|
||||||
|
if (!staged.isGoodForCrafting(ic))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("itemstages")) {
|
||||||
|
final String itemsStage = ItemStages.getStage(recipe.getRecipeOutput());
|
||||||
|
final String enchantStage = ItemStages.getEnchantStage(recipe.getRecipeOutput());
|
||||||
|
|
||||||
|
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|
||||||
|
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
@@ -192,7 +243,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
|||||||
ic.setInventorySlotContents(x, this.getPattern().getStackInSlot(x));
|
ic.setInventorySlotContents(x, this.getPattern().getStackInSlot(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
final IRecipe r = this.findRecipe(ic, p.world);
|
final IRecipe r = this.findRecipe(ic, p.world, p);
|
||||||
|
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
final Item target = request.getItem();
|
final Item target = request.getItem();
|
||||||
|
|||||||
@@ -27,4 +27,9 @@ public class SlotFakeCraftingMatrix extends SlotFake {
|
|||||||
public SlotFakeCraftingMatrix(final IItemHandler inv, final int idx, final int x, final int y) {
|
public SlotFakeCraftingMatrix(final IItemHandler inv, final int idx, final int x, final int y) {
|
||||||
super(inv, idx, x, y);
|
super(inv, idx, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotStackLimit() {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package appeng.container.slot;
|
||||||
|
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
public class SlotOversized extends SlotNormal {
|
||||||
|
public SlotOversized(IItemHandler inv, int slot, int xPos, int yPos) {
|
||||||
|
super(inv, slot, xPos, yPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 2020 Adrian Siekierka
|
||||||
|
*
|
||||||
|
* This file is part of StackUp.
|
||||||
|
*
|
||||||
|
* StackUp 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.
|
||||||
|
*
|
||||||
|
* StackUp 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 StackUp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.core;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@IFMLLoadingPlugin.Name("AE2ELCore")
|
||||||
|
@IFMLLoadingPlugin.MCVersion("1.12.2")
|
||||||
|
@IFMLLoadingPlugin.SortingIndex(1001)
|
||||||
|
@IFMLLoadingPlugin.TransformerExclusions("appeng.core.transformer")
|
||||||
|
public class AE2ELCore implements IFMLLoadingPlugin {
|
||||||
|
@Override
|
||||||
|
public String[] getASMTransformerClass() {
|
||||||
|
return new String[]{
|
||||||
|
"appeng.core.transformer.AE2ELTransformer"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModContainerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String getSetupClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectData(Map<String, Object> data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTransformerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public final class AppEng {
|
|||||||
|
|
||||||
private static final String FORGE_CURRENT_VERSION = ForgeVersion.majorVersion + "." + ForgeVersion.minorVersion + "." + ForgeVersion.revisionVersion + "." + ForgeVersion.buildVersion;
|
private static final String FORGE_CURRENT_VERSION = ForgeVersion.majorVersion + "." + ForgeVersion.minorVersion + "." + ForgeVersion.revisionVersion + "." + ForgeVersion.buildVersion;
|
||||||
private static final String FORGE_MAX_VERSION = (ForgeVersion.majorVersion + 1) + ".0.0.0";
|
private static final String FORGE_MAX_VERSION = (ForgeVersion.majorVersion + 1) + ".0.0.0";
|
||||||
public static final String MOD_DEPENDENCIES = "required-after:forge@[" + FORGE_CURRENT_VERSION + "," + FORGE_MAX_VERSION + ");after:ctm@[" + CTM.VERSION + ",);";
|
public static final String MOD_DEPENDENCIES = "required-after:forge@[" + FORGE_CURRENT_VERSION + "," + FORGE_MAX_VERSION + ");after:ctm@[" + CTM.VERSION + ",);after:itemstages;after:recipestages";
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final AppEng INSTANCE = new AppEng();
|
private static final AppEng INSTANCE = new AppEng();
|
||||||
|
|||||||
@@ -4,10 +4,25 @@ package appeng.core.api;
|
|||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
import appeng.api.storage.ICellInventory;
|
import appeng.api.storage.ICellInventory;
|
||||||
import appeng.api.storage.ICellInventoryHandler;
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
|
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||||
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.IClientHelper;
|
import appeng.api.util.IClientHelper;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.fluids.items.FluidDummyItem;
|
||||||
|
import appeng.fluids.util.AEFluidStack;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -27,16 +42,72 @@ public class ApiClientHelper implements IClientHelper {
|
|||||||
.getLocal());
|
.getLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IItemList<?> itemList = cellInventory.getChannel().createList();
|
||||||
|
|
||||||
if (handler.isPreformatted()) {
|
if (handler.isPreformatted()) {
|
||||||
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
|
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
|
||||||
|
|
||||||
if (handler.isFuzzy()) {
|
if (handler.isFuzzy()) {
|
||||||
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Fuzzy.getLocal());
|
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Fuzzy.getLocal());
|
||||||
} else {
|
} else {
|
||||||
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal());
|
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Precise.getLocal());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||||
|
IItemHandler inv = cellInventory.getConfigInventory();
|
||||||
|
cellInventory.getAvailableItems((IItemList) itemList);
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
final ItemStack is = inv.getStackInSlot(i);
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
if (cellInventory.getChannel() instanceof IItemStorageChannel) {
|
||||||
|
if (!handler.isFuzzy()) {
|
||||||
|
final IAEItemStack ais = AEItemStack.fromItemStack(is);
|
||||||
|
IAEItemStack stocked = ((IItemList<IAEItemStack>) itemList).findPrecise(ais);
|
||||||
|
lines.add("[" + is.getDisplayName() + "]" + ": " + (stocked == null ? "0" : String.valueOf(stocked.getStackSize())));
|
||||||
|
} else {
|
||||||
|
final IAEItemStack ais = AEItemStack.fromItemStack(is);
|
||||||
|
Collection<IAEItemStack> stocked = ((IItemList<IAEItemStack>) itemList).findFuzzy(ais, handler.getCellInv().getFuzzyMode());
|
||||||
|
|
||||||
|
int[] ids = OreDictionary.getOreIDs(is);
|
||||||
|
long size = 0;
|
||||||
|
for (IAEItemStack ist : stocked) {
|
||||||
|
size += ist.getStackSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.getItem().isDamageable()) {
|
||||||
|
lines.add("[" + is.getDisplayName() + "]" + ": " + size);
|
||||||
|
} else if (ids.length > 0) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int j : ids) {
|
||||||
|
sb.append(OreDictionary.getOreName(j)).append(", ");
|
||||||
|
}
|
||||||
|
lines.add("[{" + sb.substring(0, sb.length() - 2) + "}]" + ": " + size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (cellInventory.getChannel() instanceof IFluidStorageChannel) {
|
||||||
|
final AEFluidStack ais;
|
||||||
|
if (is.getItem() instanceof FluidDummyItem) {
|
||||||
|
ais = AEFluidStack.fromFluidStack(((FluidDummyItem) is.getItem()).getFluidStack(is));
|
||||||
|
} else {
|
||||||
|
ais = AEFluidStack.fromFluidStack(FluidUtil.getFluidContained(is));
|
||||||
|
}
|
||||||
|
IAEFluidStack stocked = ((IItemList<IAEFluidStack>) itemList).findPrecise(ais);
|
||||||
|
lines.add("[" + is.getDisplayName() + "]" + ": " + (stocked == null ? "0" : String.valueOf(stocked.getStackSize())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||||
|
cellInventory.getAvailableItems((IItemList) itemList);
|
||||||
|
for (IAEStack<?> s : itemList) {
|
||||||
|
if (s instanceof IAEItemStack) {
|
||||||
|
lines.add(((IAEItemStack) s).getDefinition().getDisplayName() + ": " + s.getStackSize());
|
||||||
|
} else if (s instanceof IAEFluidStack) {
|
||||||
|
lines.add(((IAEFluidStack) s).getFluidStack().getLocalizedName() + ": " + s.getStackSize() + "mB");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package appeng.core.api.imc;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.api.IIMCProcessor;
|
import appeng.core.api.IIMCProcessor;
|
||||||
|
import net.minecraft.launchwrapper.Launch;
|
||||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ public class IMCSpatial implements IIMCProcessor {
|
|||||||
public void process(final IMCMessage m) {
|
public void process(final IMCMessage m) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Class classInstance = Class.forName(m.getStringValue());
|
final Class classInstance = Class.forName(m.getStringValue(), false, Launch.classLoader);
|
||||||
AEApi.instance().registries().movable().whiteListTileEntity(classInstance);
|
AEApi.instance().registries().movable().whiteListTileEntity(classInstance);
|
||||||
} catch (final ClassNotFoundException e) {
|
} catch (final ClassNotFoundException e) {
|
||||||
AELog.info("Bad Class Registered: " + m.getStringValue() + " by " + m.getSender());
|
AELog.info("Bad Class Registered: " + m.getStringValue() + " by " + m.getSender());
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public enum PlayerMessages {
|
|||||||
DeviceNotLinked,
|
DeviceNotLinked,
|
||||||
StationCanNotBeLocated,
|
StationCanNotBeLocated,
|
||||||
SettingCleared,
|
SettingCleared,
|
||||||
;
|
MissingPatternsToEncode;
|
||||||
|
|
||||||
public ITextComponent get() {
|
public ITextComponent get() {
|
||||||
return new TextComponentTranslation(this.getName());
|
return new TextComponentTranslation(this.getName());
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class PacketJEIRecipe extends AppEngPacket {
|
public class PacketJEIRecipe extends AppEngPacket {
|
||||||
|
|
||||||
@@ -85,7 +87,7 @@ public class PacketJEIRecipe extends AppEngPacket {
|
|||||||
if (list.tagCount() > 0) {
|
if (list.tagCount() > 0) {
|
||||||
this.recipe.add(new ItemStack[list.tagCount()]);
|
this.recipe.add(new ItemStack[list.tagCount()]);
|
||||||
for (int y = 0; y < list.tagCount(); y++) {
|
for (int y = 0; y < list.tagCount(); y++) {
|
||||||
this.recipe.get(x)[y] = new ItemStack(list.getCompoundTagAt(y));
|
this.recipe.get(x)[y] = stackFromNBT(list.getCompoundTagAt(y));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.recipe.add(emptyArray);
|
this.recipe.add(emptyArray);
|
||||||
@@ -97,7 +99,7 @@ public class PacketJEIRecipe extends AppEngPacket {
|
|||||||
final NBTTagList outputList = comp.getTagList("outputs", 10);
|
final NBTTagList outputList = comp.getTagList("outputs", 10);
|
||||||
this.output = new ArrayList<>();
|
this.output = new ArrayList<>();
|
||||||
for (int z = 0; z < outputList.tagCount(); z++) {
|
for (int z = 0; z < outputList.tagCount(); z++) {
|
||||||
this.output.add(new ItemStack(outputList.getCompoundTagAt(z)));
|
this.output.add(stackFromNBT(outputList.getCompoundTagAt(z)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,9 +199,12 @@ public class PacketJEIRecipe extends AppEngPacket {
|
|||||||
if (request.getItem().isDamageable() || Platform.isGTDamageableItem(request.getItem())) {
|
if (request.getItem().isDamageable() || Platform.isGTDamageableItem(request.getItem())) {
|
||||||
Collection<IAEItemStack> outList = inv.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)).getStorageList().findFuzzy(request, FuzzyMode.IGNORE_ALL);
|
Collection<IAEItemStack> outList = inv.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)).getStorageList().findFuzzy(request, FuzzyMode.IGNORE_ALL);
|
||||||
for (IAEItemStack is : outList) {
|
for (IAEItemStack is : outList) {
|
||||||
if (is.getDefinition().getMetadata() == request.getDefinition().getMetadata()) {
|
if (Platform.isGTDamageableItem(request.getItem())) {
|
||||||
out = Platform.poweredExtraction(energy, storage, is.copy().setStackSize(1), cct.getActionSource());
|
if (!(is.getDefinition().getMetadata() == request.getDefinition().getMetadata())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
out = Platform.poweredExtraction(energy, storage, is.copy().setStackSize(1), cct.getActionSource());
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,19 +20,18 @@ package appeng.core.sync.packets;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
import appeng.container.implementations.ContainerCraftConfirm;
|
||||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
import appeng.container.implementations.ContainerCraftingCPU;
|
||||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
import appeng.container.implementations.ContainerMEMonitorable;
|
||||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
import appeng.container.implementations.ContainerNetworkStatus;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.sync.AppEngPacket;
|
import appeng.core.sync.AppEngPacket;
|
||||||
import appeng.core.sync.network.INetworkInfo;
|
import appeng.core.sync.network.INetworkInfo;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
@@ -132,22 +131,22 @@ public class PacketMEInventoryUpdate extends AppEngPacket {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
|
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
|
||||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
final Container c = player.openContainer;
|
||||||
|
|
||||||
if (gs instanceof GuiCraftConfirm) {
|
if (c instanceof ContainerCraftConfirm) {
|
||||||
((GuiCraftConfirm) gs).postUpdate(this.list, this.ref);
|
((ContainerCraftConfirm) c).postUpdate(this.list, this.ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gs instanceof GuiCraftingCPU) {
|
if (c instanceof ContainerCraftingCPU) {
|
||||||
((GuiCraftingCPU) gs).postUpdate(this.list, this.ref);
|
((ContainerCraftingCPU) c).postUpdate(this.list, this.ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gs instanceof GuiMEMonitorable) {
|
if (c instanceof ContainerMEMonitorable) {
|
||||||
((GuiMEMonitorable) gs).postUpdate(this.list);
|
((ContainerMEMonitorable) c).postUpdate(this.list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gs instanceof GuiNetworkStatus) {
|
if (c instanceof ContainerNetworkStatus) {
|
||||||
((GuiNetworkStatus) gs).postUpdate(this.list);
|
((ContainerNetworkStatus) c).postUpdate(this.list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class PacketValueConfig extends AppEngPacket {
|
|||||||
if (c instanceof ContainerPatternTerm) {
|
if (c instanceof ContainerPatternTerm) {
|
||||||
final ContainerPatternTerm cpt = (ContainerPatternTerm) c;
|
final ContainerPatternTerm cpt = (ContainerPatternTerm) c;
|
||||||
if (this.Name.equals("PatternTerminal.CraftMode")) {
|
if (this.Name.equals("PatternTerminal.CraftMode")) {
|
||||||
cpt.getPatternTerminal().setCraftingRecipe(this.Value.equals("1"));
|
cpt.getPart().setCraftingRecipe(this.Value.equals("1"));
|
||||||
} else if (this.Name.equals("PatternTerminal.Encode")) {
|
} else if (this.Name.equals("PatternTerminal.Encode")) {
|
||||||
if (this.Value.equals("2")) {
|
if (this.Value.equals("2")) {
|
||||||
cpt.encodeAndMoveToInventory();
|
cpt.encodeAndMoveToInventory();
|
||||||
@@ -157,7 +157,7 @@ public class PacketValueConfig extends AppEngPacket {
|
|||||||
} else if (this.Name.equals("PatternTerminal.MaximizeCount")) {
|
} else if (this.Name.equals("PatternTerminal.MaximizeCount")) {
|
||||||
cpt.maximizeCount();
|
cpt.maximizeCount();
|
||||||
} else if (this.Name.equals("PatternTerminal.Substitute")) {
|
} else if (this.Name.equals("PatternTerminal.Substitute")) {
|
||||||
cpt.getPatternTerminal().setSubstitution(this.Value.equals("1"));
|
cpt.getPart().setSubstitution(this.Value.equals("1"));
|
||||||
}
|
}
|
||||||
} else if (c instanceof ContainerExpandedProcessingPatternTerm) {
|
} else if (c instanceof ContainerExpandedProcessingPatternTerm) {
|
||||||
final ContainerExpandedProcessingPatternTerm cept = (ContainerExpandedProcessingPatternTerm) c;
|
final ContainerExpandedProcessingPatternTerm cept = (ContainerExpandedProcessingPatternTerm) c;
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 2020 Adrian Siekierka
|
||||||
|
*
|
||||||
|
* This file is part of StackUp.
|
||||||
|
*
|
||||||
|
* StackUp 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.
|
||||||
|
*
|
||||||
|
* StackUp 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 StackUp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.core.transformer;
|
||||||
|
|
||||||
|
import net.minecraft.launchwrapper.IClassTransformer;
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class AE2ELTransformer implements IClassTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||||
|
transformedName = transformedName.replace('/', '.');
|
||||||
|
|
||||||
|
byte[] data = basicClass;
|
||||||
|
Consumer<ClassNode> consumer = (n) -> {
|
||||||
|
};
|
||||||
|
Consumer<ClassNode> emptyConsumer = consumer;
|
||||||
|
|
||||||
|
if ("net.minecraft.item.ItemStack".equals(transformedName)) {
|
||||||
|
consumer = consumer.andThen(ItemStackPatch::patchCountGetSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (consumer != emptyConsumer) {
|
||||||
|
return processNode(basicClass, consumer);
|
||||||
|
} else {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] processNode(byte[] data, Consumer<ClassNode> classNodeConsumer) {
|
||||||
|
ClassReader reader = new ClassReader(data);
|
||||||
|
ClassNode nodeOrig = new ClassNode();
|
||||||
|
reader.accept(nodeOrig, 0);
|
||||||
|
classNodeConsumer.accept(nodeOrig);
|
||||||
|
ClassWriter writer = new ClassWriter(0);
|
||||||
|
nodeOrig.accept(writer);
|
||||||
|
return writer.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 2020 Adrian Siekierka
|
||||||
|
*
|
||||||
|
* This file is part of StackUp.
|
||||||
|
*
|
||||||
|
* StackUp 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.
|
||||||
|
*
|
||||||
|
* StackUp 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 StackUp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.core.transformer;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.LdcInsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
|
public final class ItemStackPatch {
|
||||||
|
private ItemStackPatch() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void patchCountGetSet(ClassNode node) {
|
||||||
|
for (MethodNode mn : node.methods) {
|
||||||
|
if ("<init>".equals(mn.name)) {
|
||||||
|
ListIterator<AbstractInsnNode> it = mn.instructions.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
AbstractInsnNode in = it.next();
|
||||||
|
if (in instanceof LdcInsnNode && "Count".equals(((LdcInsnNode) in).cst)) {
|
||||||
|
AbstractInsnNode in2 = it.next();
|
||||||
|
if (in2.getOpcode() == Opcodes.INVOKEVIRTUAL) {
|
||||||
|
// :thinking:
|
||||||
|
boolean patched = false;
|
||||||
|
MethodInsnNode min2 = (MethodInsnNode) in2;
|
||||||
|
if (min2.name.equals("getByte")) {
|
||||||
|
min2.name = "getInteger";
|
||||||
|
patched = true;
|
||||||
|
} else if (min2.name.equals("func_74771_c")) {
|
||||||
|
min2.name = "func_74762_e";
|
||||||
|
patched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patched) {
|
||||||
|
min2.desc = "(Ljava/lang/String;)I";
|
||||||
|
System.out.println("Patched ItemStack Count getter!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ("func_77955_b".equals(mn.name) || "writeToNBT".equals(mn.name)) {
|
||||||
|
ListIterator<AbstractInsnNode> it = mn.instructions.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
AbstractInsnNode in = it.next();
|
||||||
|
if (in instanceof LdcInsnNode && "Count".equals(((LdcInsnNode) in).cst)) {
|
||||||
|
it.next();
|
||||||
|
it.next();
|
||||||
|
it.next();
|
||||||
|
AbstractInsnNode in2 = it.next();
|
||||||
|
if (in2.getOpcode() == Opcodes.INVOKEVIRTUAL) {
|
||||||
|
// :thinking:
|
||||||
|
boolean patched = false;
|
||||||
|
MethodInsnNode min2 = (MethodInsnNode) in2;
|
||||||
|
if (min2.name.equals("setByte")) {
|
||||||
|
min2.name = "setInteger";
|
||||||
|
patched = true;
|
||||||
|
} else if (min2.name.equals("func_74774_a")) {
|
||||||
|
min2.name = "func_74768_a";
|
||||||
|
patched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patched) {
|
||||||
|
min2.desc = "(Ljava/lang/String;I)V";
|
||||||
|
System.out.println("Patched ItemStack Count setter!");
|
||||||
|
|
||||||
|
// Remove I2B cast
|
||||||
|
it.previous();
|
||||||
|
it.previous();
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,7 +41,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Optional.Interface(iface = "gregtech.api.items.IToolItem", modid = "gregtech")
|
|
||||||
public class CraftingTreeNode {
|
public class CraftingTreeNode {
|
||||||
|
|
||||||
// what slot!
|
// what slot!
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class GuiFluidInterface extends GuiUpgradeable implements IConfigManagerH
|
|||||||
public GuiFluidInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
|
public GuiFluidInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
|
||||||
super(new ContainerFluidInterface(ip, te));
|
super(new ContainerFluidInterface(ip, te));
|
||||||
this.ySize = 231;
|
this.ySize = 231;
|
||||||
|
this.xSize = 245;
|
||||||
this.host = te;
|
this.host = te;
|
||||||
(this.container = (ContainerFluidInterface) this.inventorySlots).setGui(this);
|
(this.container = (ContainerFluidInterface) this.inventorySlots).setGui(this);
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ public class GuiFluidInterface extends GuiUpgradeable implements IConfigManagerH
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
this.bindTexture("guis/interfacefluid.png");
|
this.bindTexture("guis/interfacefluidextendedlife.png");
|
||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
private final int slot;
|
private final int slot;
|
||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
private boolean darkened = false;
|
||||||
|
|
||||||
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h) {
|
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h) {
|
||||||
super(id, x, y);
|
super(id, x, y);
|
||||||
@@ -50,6 +51,15 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
this.height = h;
|
this.height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h, boolean darkened) {
|
||||||
|
super(id, x, y);
|
||||||
|
this.tank = tank;
|
||||||
|
this.slot = slot;
|
||||||
|
this.width = w;
|
||||||
|
this.height = h;
|
||||||
|
this.darkened = darkened;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawContent(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
public void drawContent(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||||
final IAEFluidStack fs = this.getFluidStack();
|
final IAEFluidStack fs = this.getFluidStack();
|
||||||
@@ -66,10 +76,16 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
float red = (fluid.getFluid().getColor() >> 16 & 255) / 255.0F;
|
float red = (fluid.getFluid().getColor() >> 16 & 255) / 255.0F;
|
||||||
float green = (fluid.getFluid().getColor() >> 8 & 255) / 255.0F;
|
float green = (fluid.getFluid().getColor() >> 8 & 255) / 255.0F;
|
||||||
float blue = (fluid.getFluid().getColor() & 255) / 255.0F;
|
float blue = (fluid.getFluid().getColor() & 255) / 255.0F;
|
||||||
|
if (darkened) {
|
||||||
|
red = red * 0.4F;
|
||||||
|
green = green * 0.4F;
|
||||||
|
blue = blue * 0.4F;
|
||||||
|
}
|
||||||
GlStateManager.color(red, green, blue);
|
GlStateManager.color(red, green, blue);
|
||||||
|
|
||||||
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString());
|
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString());
|
||||||
final int scaledHeight = (int) (this.height * ((float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity()));
|
int scaledHeight = (int) (this.height * ((float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity()));
|
||||||
|
scaledHeight = Math.min(this.height, scaledHeight);
|
||||||
|
|
||||||
int iconHeightRemainder = scaledHeight % 16;
|
int iconHeightRemainder = scaledHeight % 16;
|
||||||
if (iconHeightRemainder > 0) {
|
if (iconHeightRemainder > 0) {
|
||||||
|
|||||||
@@ -234,9 +234,4 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable implemen
|
|||||||
public int availableUpgrades() {
|
public int availableUpgrades() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasToolbox() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
final Block directedBlock = directedBlockState.getBlock();
|
final Block directedBlock = directedBlockState.getBlock();
|
||||||
ItemStack what = new ItemStack(directedBlock, 1, directedBlock.getMetaFromState(directedBlockState));
|
ItemStack what = new ItemStack(directedBlock, 1, directedBlock.getMetaFromState(directedBlockState));
|
||||||
|
|
||||||
if (Loader.isModLoaded("gregtech") && directedBlock instanceof BlockMachine) {
|
if (Platform.GTLoaded && directedBlock instanceof BlockMachine) {
|
||||||
MetaTileEntity metaTileEntity = Platform.getMetaTileEntity(directedTile.getWorld(), directedTile.getPos());
|
MetaTileEntity metaTileEntity = Platform.getMetaTileEntity(directedTile.getWorld(), directedTile.getPos());
|
||||||
if (metaTileEntity != null) {
|
if (metaTileEntity != null) {
|
||||||
return metaTileEntity.getMetaFullName();
|
return metaTileEntity.getMetaFullName();
|
||||||
@@ -528,6 +528,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
|||||||
this.tanks.readFromNBT(data, "storage");
|
this.tanks.readFromNBT(data, "storage");
|
||||||
this.priority = data.getInteger("priority");
|
this.priority = data.getInteger("priority");
|
||||||
this.upgrades.readFromNBT(data, "upgrades");
|
this.upgrades.readFromNBT(data, "upgrades");
|
||||||
|
this.tanks.setCapacity((int) (Math.pow(4, this.getInstalledUpgrades(Upgrades.CAPACITY) + 1) * Fluid.BUCKET_VOLUME));
|
||||||
this.readConfig();
|
this.readConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class AEFluidInventory implements IAEFluidTank {
|
|||||||
|
|
||||||
if (doFill) {
|
if (doFill) {
|
||||||
if (fluid == null) {
|
if (fluid == null) {
|
||||||
this.setFluidInSlot(slot, AEFluidStack.fromFluidStack(resource));
|
this.setFluidInSlot(slot, AEFluidStack.fromFluidStack(resource).setStackSize(amountToStore));
|
||||||
} else {
|
} else {
|
||||||
fluid.setStackSize(fluid.getStackSize() + amountToStore);
|
fluid.setStackSize(fluid.getStackSize() + amountToStore);
|
||||||
this.onContentChanged(slot);
|
this.onContentChanged(slot);
|
||||||
|
|||||||
@@ -161,13 +161,6 @@ public final class FluidList implements IItemList<IAEFluidStack> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FluidList clone() {
|
|
||||||
FluidList list = new FluidList();
|
|
||||||
list.records.putAll(records);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IAEFluidStack getFluidRecord(final IAEFluidStack fluid) {
|
private IAEFluidStack getFluidRecord(final IAEFluidStack fluid) {
|
||||||
return this.records.get(fluid);
|
return this.records.get(fluid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import appeng.parts.automation.UpgradeInventory;
|
|||||||
import appeng.parts.misc.PartInterface;
|
import appeng.parts.misc.PartInterface;
|
||||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.tile.inventory.AppEngInternalOversizedInventory;
|
||||||
import appeng.tile.networking.TileCableBus;
|
import appeng.tile.networking.TileCableBus;
|
||||||
import appeng.util.ConfigManager;
|
import appeng.util.ConfigManager;
|
||||||
import appeng.util.IConfigManagerHost;
|
import appeng.util.IConfigManagerHost;
|
||||||
@@ -100,6 +101,8 @@ import net.minecraftforge.items.wrapper.RangedWrapper;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.*;
|
||||||
|
|
||||||
|
|
||||||
public class DualityInterface implements IGridTickable, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory, IConfigManagerHost, ICraftingProvider, IUpgradeableHost {
|
public class DualityInterface implements IGridTickable, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory, IConfigManagerHost, ICraftingProvider, IUpgradeableHost {
|
||||||
public static final int NUMBER_OF_STORAGE_SLOTS = 9;
|
public static final int NUMBER_OF_STORAGE_SLOTS = 9;
|
||||||
@@ -114,8 +117,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
private final IActionSource mySource;
|
private final IActionSource mySource;
|
||||||
private final IActionSource interfaceRequestSource;
|
private final IActionSource interfaceRequestSource;
|
||||||
private final ConfigManager cm = new ConfigManager(this);
|
private final ConfigManager cm = new ConfigManager(this);
|
||||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS);
|
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS, 512);
|
||||||
private final AppEngInternalInventory storage = new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS);
|
private final AppEngInternalInventory storage = new AppEngInternalOversizedInventory(this, NUMBER_OF_STORAGE_SLOTS, 512);
|
||||||
private final AppEngInternalInventory patterns = new AppEngInternalInventory(this, NUMBER_OF_PATTERN_SLOTS);
|
private final AppEngInternalInventory patterns = new AppEngInternalInventory(this, NUMBER_OF_PATTERN_SLOTS);
|
||||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>(new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>(new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>(new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class));
|
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>(new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class));
|
||||||
@@ -207,9 +210,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final NBTTagList waitingToSend = new NBTTagList();
|
final NBTTagList waitingToSend = new NBTTagList();
|
||||||
if (this.waitingToSend != null) {
|
if (this.waitingToSend != null) {
|
||||||
for (final ItemStack is : this.waitingToSend) {
|
for (final ItemStack is : this.waitingToSend) {
|
||||||
final NBTTagCompound item = new NBTTagCompound();
|
final NBTTagCompound itemNBT = stackToNBT(is);
|
||||||
is.writeToNBT(item);
|
waitingToSend.appendTag(itemNBT);
|
||||||
waitingToSend.appendTag(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.setTag("waitingToSend", waitingToSend);
|
data.setTag("waitingToSend", waitingToSend);
|
||||||
@@ -221,9 +223,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
NBTTagList waitingListSided = new NBTTagList();
|
NBTTagList waitingListSided = new NBTTagList();
|
||||||
if (this.waitingToSendFacing.containsKey(s)) {
|
if (this.waitingToSendFacing.containsKey(s)) {
|
||||||
for (final ItemStack is : this.waitingToSendFacing.get(s)) {
|
for (final ItemStack is : this.waitingToSendFacing.get(s)) {
|
||||||
final NBTTagCompound item = new NBTTagCompound();
|
final NBTTagCompound itemNBT = stackToNBT(is);
|
||||||
is.writeToNBT(item);
|
waitingListSided.appendTag(itemNBT);
|
||||||
waitingListSided.appendTag(item);
|
|
||||||
}
|
}
|
||||||
sidedWaitList.setTag(s.name(), waitingListSided);
|
sidedWaitList.setTag(s.name(), waitingListSided);
|
||||||
}
|
}
|
||||||
@@ -239,7 +240,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
for (int x = 0; x < waitingList.tagCount(); x++) {
|
for (int x = 0; x < waitingList.tagCount(); x++) {
|
||||||
final NBTTagCompound c = waitingList.getCompoundTagAt(x);
|
final NBTTagCompound c = waitingList.getCompoundTagAt(x);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
final ItemStack is = new ItemStack(c);
|
final ItemStack is = stackFromNBT(c);
|
||||||
this.addToSendList(is);
|
this.addToSendList(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +255,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
for (int x = 0; x < w.tagCount(); x++) {
|
for (int x = 0; x < w.tagCount(); x++) {
|
||||||
final NBTTagCompound c = w.getCompoundTagAt(x);
|
final NBTTagCompound c = w.getCompoundTagAt(x);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
final ItemStack is = new ItemStack(c);
|
final ItemStack is = stackFromNBT(c);
|
||||||
this.addToSendListFacing(is, EnumFacing.getFront(s.getIndex()));
|
this.addToSendListFacing(is, EnumFacing.getFront(s.getIndex()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -626,7 +627,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
whatToSend = ItemStack.EMPTY;
|
whatToSend = ItemStack.EMPTY;
|
||||||
} else {
|
} else {
|
||||||
whatToSend.setCount(whatToSend.getCount() - (whatToSend.getCount() - result.getCount()));
|
whatToSend.setCount(result.getCount());
|
||||||
|
whatToSend.setTagCompound(result.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whatToSend.isEmpty()) {
|
if (whatToSend.isEmpty()) {
|
||||||
@@ -680,6 +682,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final IAEItemStack result = inv.injectItems(AEItemStack.fromItemStack(whatToSend), Actionable.MODULATE, this.mySource);
|
final IAEItemStack result = inv.injectItems(AEItemStack.fromItemStack(whatToSend), Actionable.MODULATE, this.mySource);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
whatToSend.setCount((int) result.getStackSize());
|
whatToSend.setCount((int) result.getStackSize());
|
||||||
|
whatToSend.setTagCompound(result.getDefinition().getTagCompound());
|
||||||
} else {
|
} else {
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
@@ -708,6 +711,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final ItemStack result = ad.addItems(whatToSend);
|
final ItemStack result = ad.addItems(whatToSend);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
whatToSend.setCount(result.getCount());
|
whatToSend.setCount(result.getCount());
|
||||||
|
whatToSend.setTagCompound(result.getTagCompound());
|
||||||
} else {
|
} else {
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
@@ -749,7 +753,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
// make sure strange things didn't happen...
|
// make sure strange things didn't happen...
|
||||||
// TODO: check if OK
|
// TODO: check if OK
|
||||||
final ItemStack canExtract = adaptor.simulateRemove((int) diff, toStore.getDefinition(), null);
|
final ItemStack canExtract = adaptor.simulateRemove((int) diff, toStore.getDefinition(), null);
|
||||||
if (canExtract.isEmpty() || canExtract.getCount() != diff) {
|
if (canExtract.isEmpty()) {
|
||||||
changed = true;
|
changed = true;
|
||||||
throw new GridAccessException();
|
throw new GridAccessException();
|
||||||
}
|
}
|
||||||
@@ -766,8 +770,6 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final ItemStack removed = adaptor.removeItems((int) diff, ItemStack.EMPTY, null);
|
final ItemStack removed = adaptor.removeItems((int) diff, ItemStack.EMPTY, null);
|
||||||
if (removed.isEmpty()) {
|
if (removed.isEmpty()) {
|
||||||
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
||||||
} else if (removed.getCount() != diff) {
|
|
||||||
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1107,7 +1109,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
|
|
||||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor(te, s.getOpposite());
|
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor(te, s.getOpposite());
|
||||||
if (ad != null) {
|
if (ad != null) {
|
||||||
if (Loader.isModLoaded("actuallyadditions") && Loader.isModLoaded("gregtech") && te instanceof IPhantomTile) {
|
if (Loader.isModLoaded("actuallyadditions") && Platform.GTLoaded && te instanceof IPhantomTile) {
|
||||||
IPhantomTile phantomTE = ((IPhantomTile) te);
|
IPhantomTile phantomTE = ((IPhantomTile) te);
|
||||||
if (phantomTE.hasBoundPosition()) {
|
if (phantomTE.hasBoundPosition()) {
|
||||||
TileEntity phantom = w.getTileEntity(phantomTE.getBoundPosition());
|
TileEntity phantom = w.getTileEntity(phantomTE.getBoundPosition());
|
||||||
@@ -1289,7 +1291,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final Block directedBlock = directedBlockState.getBlock();
|
final Block directedBlock = directedBlockState.getBlock();
|
||||||
ItemStack what = new ItemStack(directedBlock, 1, directedBlock.getMetaFromState(directedBlockState));
|
ItemStack what = new ItemStack(directedBlock, 1, directedBlock.getMetaFromState(directedBlockState));
|
||||||
|
|
||||||
if (Loader.isModLoaded("gregtech") && directedBlock instanceof BlockMachine) {
|
if (Platform.GTLoaded && directedBlock instanceof BlockMachine) {
|
||||||
MetaTileEntity metaTileEntity = Platform.getMetaTileEntity(directedTile.getWorld(), directedTile.getPos());
|
MetaTileEntity metaTileEntity = Platform.getMetaTileEntity(directedTile.getWorld(), directedTile.getPos());
|
||||||
if (metaTileEntity != null) {
|
if (metaTileEntity != null) {
|
||||||
return metaTileEntity.getMetaFullName();
|
return metaTileEntity.getMetaFullName();
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import net.minecraft.util.text.TextFormatting;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class InvalidPatternHelper {
|
public class InvalidPatternHelper {
|
||||||
|
|
||||||
@@ -89,11 +91,14 @@ public class InvalidPatternHelper {
|
|||||||
private final ItemStack stack;
|
private final ItemStack stack;
|
||||||
|
|
||||||
public PatternIngredient(NBTTagCompound tag) {
|
public PatternIngredient(NBTTagCompound tag) {
|
||||||
this.stack = new ItemStack(tag);
|
this.stack = stackFromNBT(tag);
|
||||||
|
|
||||||
if (this.stack.isEmpty()) {
|
if (this.stack.isEmpty()) {
|
||||||
this.id = tag.getString("id");
|
this.id = tag.getString("id");
|
||||||
this.count = tag.getByte("Count");
|
this.count = tag.getByte("Count");
|
||||||
|
if (tag.hasKey("stackSize")) {
|
||||||
|
this.count = tag.getInteger("stackSize");
|
||||||
|
}
|
||||||
this.damage = Math.max(0, tag.getShort("Damage"));
|
this.damage = Math.max(0, tag.getShort("Damage"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,7 @@ public enum InventoryAction {
|
|||||||
ROLL_DOWN,
|
ROLL_DOWN,
|
||||||
AUTO_CRAFT,
|
AUTO_CRAFT,
|
||||||
PLACE_SINGLE,
|
PLACE_SINGLE,
|
||||||
|
DOUBLE,
|
||||||
|
HALVE,
|
||||||
PLACE_JEI_GHOST_ITEM
|
PLACE_JEI_GHOST_ITEM
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package appeng.helpers;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Methods to help with the added "stackSize" NBT tag to get around "Count" being written and read as a byte.
|
||||||
|
*/
|
||||||
|
public class ItemStackHelper {
|
||||||
|
public static ItemStack stackFromNBT(NBTTagCompound itemNBT) {
|
||||||
|
ItemStack is = new ItemStack(itemNBT);
|
||||||
|
if (itemNBT.hasKey("stackSize")) {
|
||||||
|
is.setCount(itemNBT.getInteger("stackSize"));
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void stackWriteToNBT(ItemStack is, NBTTagCompound itemNBT) {
|
||||||
|
is.writeToNBT(itemNBT);
|
||||||
|
if (is.getCount() > Byte.MAX_VALUE) {
|
||||||
|
itemNBT.setInteger("stackSize", is.getCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NBTTagCompound stackToNBT(ItemStack is) {
|
||||||
|
NBTTagCompound itemNBT = new NBTTagCompound();
|
||||||
|
stackWriteToNBT(is, itemNBT);
|
||||||
|
return itemNBT;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ public class NonBlockingItems {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModItemMeta[0].equals("gregtech") && Platform.isModLoaded("gregtech")) {
|
if (ModItemMeta[0].equals("gregtech") && Platform.GTLoaded) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (MetaItem<?> metaItem : MetaItem.getMetaItems()) {
|
for (MetaItem<?> metaItem : MetaItem.getMetaItems()) {
|
||||||
MetaItem<?>.MetaValueItem metaItem2 = metaItem.getItem(ModItemMeta[1]);
|
MetaItem<?>.MetaValueItem metaItem2 = metaItem.getItem(ModItemMeta[1]);
|
||||||
|
|||||||
@@ -40,15 +40,17 @@ import net.minecraftforge.common.crafting.IShapedRecipe;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class PatternHelper implements ICraftingPatternDetails, Comparable<PatternHelper> {
|
public class PatternHelper implements ICraftingPatternDetails, Comparable<PatternHelper> {
|
||||||
|
|
||||||
private static final int CRAFTING_GRID_DIMENSION = 3;
|
public static final int CRAFTING_GRID_DIMENSION = 3;
|
||||||
private static final int CRAFTING_INPUT_LIMIT = CRAFTING_GRID_DIMENSION * CRAFTING_GRID_DIMENSION;
|
private static final int CRAFTING_INPUT_LIMIT = CRAFTING_GRID_DIMENSION * CRAFTING_GRID_DIMENSION;
|
||||||
public static final int PROCESSING_INPUT_HEIGHT = 4;
|
public static final int PROCESSING_INPUT_HEIGHT = 4;
|
||||||
public static final int PROCESSING_INPUT_WIDTH = 4;
|
public static final int PROCESSING_INPUT_WIDTH = 4;
|
||||||
public static final int PROCESSING_INPUT_LIMIT = PROCESSING_INPUT_HEIGHT * PROCESSING_INPUT_WIDTH;
|
public static final int PROCESSING_INPUT_LIMIT = PROCESSING_INPUT_HEIGHT * PROCESSING_INPUT_WIDTH;
|
||||||
private static final int CRAFTING_OUTPUT_LIMIT = 1;
|
public static final int CRAFTING_OUTPUT_LIMIT = 1;
|
||||||
public static final int PROCESSING_OUTPUT_LIMIT = 6;
|
public static final int PROCESSING_OUTPUT_LIMIT = 6;
|
||||||
|
|
||||||
private final ItemStack patternItem;
|
private final ItemStack patternItem;
|
||||||
@@ -91,7 +93,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
|||||||
|
|
||||||
for (int x = 0; x < inTag.tagCount(); x++) {
|
for (int x = 0; x < inTag.tagCount(); x++) {
|
||||||
NBTTagCompound ingredient = inTag.getCompoundTagAt(x);
|
NBTTagCompound ingredient = inTag.getCompoundTagAt(x);
|
||||||
final ItemStack gs = new ItemStack(ingredient);
|
final ItemStack gs = stackFromNBT(ingredient);
|
||||||
|
|
||||||
if (!ingredient.hasNoTags() && gs.isEmpty()) {
|
if (!ingredient.hasNoTags() && gs.isEmpty()) {
|
||||||
throw new IllegalArgumentException("No pattern here!");
|
throw new IllegalArgumentException("No pattern here!");
|
||||||
@@ -122,7 +124,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
|||||||
|
|
||||||
for (int x = 0; x < outTag.tagCount(); x++) {
|
for (int x = 0; x < outTag.tagCount(); x++) {
|
||||||
NBTTagCompound resultItemTag = outTag.getCompoundTagAt(x);
|
NBTTagCompound resultItemTag = outTag.getCompoundTagAt(x);
|
||||||
final ItemStack gs = new ItemStack(resultItemTag);
|
final ItemStack gs = stackFromNBT(resultItemTag);
|
||||||
|
|
||||||
if (!resultItemTag.hasNoTags() && gs.isEmpty()) {
|
if (!resultItemTag.hasNoTags() && gs.isEmpty()) {
|
||||||
throw new IllegalArgumentException("No pattern here!");
|
throw new IllegalArgumentException("No pattern here!");
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package appeng.integration.modules.chisel;
|
||||||
|
|
||||||
|
import appeng.block.networking.BlockCableBus;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.MovementInput;
|
||||||
|
import net.minecraft.util.MovementInputFromOptions;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.Optional;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import team.chisel.common.config.Configurations;
|
||||||
|
|
||||||
|
import static team.chisel.client.handler.BlockSpeedHandler.speedupBlocks;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(Side.CLIENT)
|
||||||
|
public class ChiselBlockSpeedHandler {
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private static MovementInput manualInputCheck;
|
||||||
|
|
||||||
|
@Optional.Method(modid = "chisel")
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static void speedupPlayer(TickEvent.PlayerTickEvent event) {
|
||||||
|
if (event.phase == TickEvent.Phase.START && event.side.isClient() && event.player.onGround && event.player instanceof EntityPlayerSP) {
|
||||||
|
if (manualInputCheck == null) {
|
||||||
|
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||||
|
}
|
||||||
|
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||||
|
BlockPos blockPosBelow = new BlockPos(player.posX, player.posY - (1 / 16D), player.posZ);
|
||||||
|
IBlockState below = player.getEntityWorld().getBlockState(blockPosBelow);
|
||||||
|
if (below.getBlock() instanceof BlockCableBus) {
|
||||||
|
IBlockState f = ((BlockCableBus) below.getBlock()).getFacadeState(Minecraft.getMinecraft().world, blockPosBelow, EnumFacing.UP);
|
||||||
|
if (speedupBlocks.contains(f.getBlock())) {
|
||||||
|
manualInputCheck.updatePlayerMoveState();
|
||||||
|
if ((manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) && !player.isInWater()) {
|
||||||
|
player.motionX *= Configurations.concreteVelocityMult;
|
||||||
|
player.motionZ *= Configurations.concreteVelocityMult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package appeng.integration.modules.gregtech;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.launchwrapper.Launch;
|
||||||
|
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class ToolClass {
|
||||||
|
private static Class<?> GTToolClass;
|
||||||
|
private static Method getMaxItemDamage = null;
|
||||||
|
private static Method getItemDamage = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
GTToolClass = Class.forName("gregtech.api.items.IToolItem", false, Launch.classLoader);
|
||||||
|
getItemDamage = ReflectionHelper.findMethod(GTToolClass, "getItemDamage", null, ItemStack.class);
|
||||||
|
getMaxItemDamage = ReflectionHelper.findMethod(GTToolClass, "getMaxItemDamage", null, ItemStack.class);
|
||||||
|
} catch (ClassNotFoundException ignored) {
|
||||||
|
try {
|
||||||
|
GTToolClass = Class.forName("gregtech.api.items.toolitem.IGTTool", false, Launch.classLoader);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Enum<Interfaces> GTToolInterface = getGTToolInterface();
|
||||||
|
|
||||||
|
public static Class<?> getGTToolClass() {
|
||||||
|
if (GTToolClass == null) {
|
||||||
|
System.out.printf("TToolClass == null");
|
||||||
|
}
|
||||||
|
return GTToolClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Enum<Interfaces> getGTToolInterface() {
|
||||||
|
if (GTToolClass.getName().equals("IToolItem")) {
|
||||||
|
return Interfaces.ITOOLITEM;
|
||||||
|
} else {
|
||||||
|
return Interfaces.IGTTOOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getGTMaxDamage(ItemStack itemStack) {
|
||||||
|
if (GTToolInterface == Interfaces.ITOOLITEM) {
|
||||||
|
try {
|
||||||
|
return (int) getMaxItemDamage.invoke(itemStack.getItem(), itemStack);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return itemStack.getMaxDamage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getGTitemDamage(ItemStack itemStack) {
|
||||||
|
if (GTToolInterface == Interfaces.ITOOLITEM) {
|
||||||
|
try {
|
||||||
|
return (int) getItemDamage.invoke(itemStack.getItem(), itemStack);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return itemStack.getItemDamage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Interfaces {
|
||||||
|
ITOOLITEM,
|
||||||
|
IGTTOOL
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import com.google.common.base.Stopwatch;
|
||||||
|
import mezz.jei.api.gui.ITooltipCallback;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.translation.I18n;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class CraftableCallBack implements ITooltipCallback<ItemStack> {
|
||||||
|
private final IItemList<IAEItemStack> list;
|
||||||
|
private final Container container;
|
||||||
|
private final Stopwatch lastClicked = Stopwatch.createStarted();
|
||||||
|
|
||||||
|
|
||||||
|
public CraftableCallBack(Container container, IItemList<IAEItemStack> ir) {
|
||||||
|
this.list = ir;
|
||||||
|
this.container = container;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTooltip(int slotIndex, boolean input, ItemStack ingredient, List<String> tooltip) {
|
||||||
|
if (!input) return;
|
||||||
|
if (list != null) {
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> available = mergeInventories(list, (ContainerCraftingTerm) container);
|
||||||
|
|
||||||
|
IAEItemStack search = AEItemStack.fromItemStack(ingredient);
|
||||||
|
if (ingredient.getItem().isDamageable() || Platform.isGTDamageableItem(ingredient.getItem())) {
|
||||||
|
Collection<IAEItemStack> fuzzy = available.findFuzzy(search, FuzzyMode.IGNORE_ALL);
|
||||||
|
if (fuzzy.size() > 0) {
|
||||||
|
for (IAEItemStack itemStack : fuzzy) {
|
||||||
|
if (itemStack.getStackSize() > 0) {
|
||||||
|
if (Platform.isGTDamageableItem(ingredient.getItem())) {
|
||||||
|
if (!(ingredient.getMetadata() == itemStack.getDefinition().getMetadata())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
String line = "§c[" + I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing") + "]";
|
||||||
|
tooltip.add(line);
|
||||||
|
if (itemStack.isCraftable()) {
|
||||||
|
line = "§1[" + I18n.translateToLocalFormatted("gui.tooltips.appliedenergistics2.Craftable") + "]";
|
||||||
|
tooltip.add(line);
|
||||||
|
if (Mouse.isButtonDown(2) && this.lastClicked.elapsed(TimeUnit.MILLISECONDS) > 200) {
|
||||||
|
this.lastClicked.reset().start();
|
||||||
|
((AEBaseContainer) container).setTargetStack(itemStack);
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.AUTO_CRAFT, container.getInventory().size(), 0);
|
||||||
|
NetworkHandler.instance().sendToServer(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String line = "§c[" + I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing") + "]";
|
||||||
|
tooltip.add(line);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
IAEItemStack found = available.findPrecise(search);
|
||||||
|
if (found != null) {
|
||||||
|
if (found.getStackSize() == 0) {
|
||||||
|
String line = "§c[" + I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing") + "]";
|
||||||
|
tooltip.add(line);
|
||||||
|
}
|
||||||
|
if (found.isCraftable()) {
|
||||||
|
String line = "§1[" + I18n.translateToLocalFormatted("gui.tooltips.appliedenergistics2.Craftable") + "]";
|
||||||
|
tooltip.add(line);
|
||||||
|
if (Mouse.isButtonDown(2) && this.lastClicked.elapsed(TimeUnit.MILLISECONDS) > 200) {
|
||||||
|
this.lastClicked.reset().start();
|
||||||
|
((AEBaseContainer) container).setTargetStack(found);
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.AUTO_CRAFT, container.getInventory().size(), 0);
|
||||||
|
NetworkHandler.instance().sendToServer(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String line = "§c[" + I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing") + "]";
|
||||||
|
tooltip.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> mergeInventories(IItemList<IAEItemStack> repo, ContainerCraftingTerm containerCraftingTerm) {
|
||||||
|
IItemList<IAEItemStack> itemList = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
|
for (IAEItemStack i : repo) {
|
||||||
|
itemList.addStorage(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerMainInvWrapper invWrapper = new PlayerMainInvWrapper(containerCraftingTerm.getPlayerInv());
|
||||||
|
for (int i = 0; i < invWrapper.getSlots(); i++) {
|
||||||
|
itemList.addStorage(AEItemStack.fromItemStack(invWrapper.getStackInSlot(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
IItemHandler itemHandler = containerCraftingTerm.getInventoryByName("crafting");
|
||||||
|
for (int i = 0; i < itemHandler.getSlots(); i++) {
|
||||||
|
itemList.addStorage(AEItemStack.fromItemStack(itemHandler.getStackInSlot(i)));
|
||||||
|
}
|
||||||
|
return itemList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||||
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import mezz.jei.api.gui.IGuiIngredient;
|
||||||
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
|
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||||
|
import mezz.jei.gui.recipes.RecipeLayout;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static mezz.jei.api.recipe.transfer.IRecipeTransferError.Type.USER_FACING;
|
||||||
|
|
||||||
|
public class JEIMissingItem implements IRecipeTransferError {
|
||||||
|
|
||||||
|
private boolean errored;
|
||||||
|
public long lastUpdate;
|
||||||
|
private final List<Integer> craftableSlots = new ArrayList<>();
|
||||||
|
private final List<Integer> foundSlots = new ArrayList<>();
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> available = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
|
|
||||||
|
JEIMissingItem(Container container, @Nonnull IRecipeLayout recipeLayout) {
|
||||||
|
if (container instanceof ContainerCraftingTerm) {
|
||||||
|
ContainerCraftingTerm craftingTerm = (ContainerCraftingTerm) container;
|
||||||
|
GuiCraftingTerm g = (GuiCraftingTerm) craftingTerm.getGui();
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> ir = g.getRepo().getList();
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> available = mergeInventories(ir, (ContainerCraftingTerm) container);
|
||||||
|
|
||||||
|
boolean found;
|
||||||
|
this.errored = false;
|
||||||
|
recipeLayout.getItemStacks().addTooltipCallback(new CraftableCallBack(container, available));
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
|
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||||
|
found = false;
|
||||||
|
if (i.isInput() && i.getAllIngredients().size() > 0) {
|
||||||
|
List<?> allIngredients = i.getAllIngredients();
|
||||||
|
for (Object allIngredient : allIngredients) {
|
||||||
|
if (allIngredient instanceof ItemStack) {
|
||||||
|
ItemStack stack = (ItemStack) allIngredient;
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
IAEItemStack search = AEItemStack.fromItemStack(stack);
|
||||||
|
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
|
Collection<IAEItemStack> fuzzy = available.findFuzzy(search, FuzzyMode.IGNORE_ALL);
|
||||||
|
if (fuzzy.size() > 0) {
|
||||||
|
for (IAEItemStack itemStack : fuzzy) {
|
||||||
|
if (itemStack.getStackSize() > 0) {
|
||||||
|
if (Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
|
if (!(stack.getMetadata() == itemStack.getDefinition().getMetadata())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found = true;
|
||||||
|
used.add(itemStack.copy().setStackSize(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
IAEItemStack ext = available.findPrecise(search);
|
||||||
|
if (ext != null) {
|
||||||
|
IAEItemStack usedStack = used.findPrecise(ext);
|
||||||
|
if (ext.getStackSize() > 0 && (usedStack == null || ext.getStackSize() > usedStack.getStackSize())) {
|
||||||
|
used.add(ext.copy().setStackSize(1));
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
this.errored = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public Type getType() {
|
||||||
|
return USER_FACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showError(Minecraft minecraft, int mouseX, int mouseY, @Nonnull IRecipeLayout recipeLayout, int recipeX, int recipeY) {
|
||||||
|
Container c = minecraft.player.openContainer;
|
||||||
|
if (c instanceof ContainerCraftingTerm) {
|
||||||
|
ContainerCraftingTerm craftingTerm = (ContainerCraftingTerm) c;
|
||||||
|
|
||||||
|
GuiCraftingTerm g = (GuiCraftingTerm) craftingTerm.getGui();
|
||||||
|
IItemList<IAEItemStack> ir = g.getRepo().getList();
|
||||||
|
boolean found;
|
||||||
|
boolean craftable;
|
||||||
|
int currentSlot = 0;
|
||||||
|
this.errored = false;
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - lastUpdate > 1000) {
|
||||||
|
lastUpdate = System.currentTimeMillis();
|
||||||
|
available = mergeInventories(ir, (ContainerCraftingTerm) minecraft.player.openContainer);
|
||||||
|
this.foundSlots.clear();
|
||||||
|
this.craftableSlots.clear();
|
||||||
|
} else {
|
||||||
|
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||||
|
if (i.isInput()) {
|
||||||
|
if (!foundSlots.contains(currentSlot)) {
|
||||||
|
if (craftableSlots.contains(currentSlot)) {
|
||||||
|
i.drawHighlight(minecraft, new Color(0.0f, 0.0f, 1.0f, 0.4f), recipeX, recipeY);
|
||||||
|
} else {
|
||||||
|
i.drawHighlight(minecraft, new Color(1.0f, 0.0f, 0.0f, 0.4f), recipeX, recipeY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentSlot++;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.used.resetStatus();
|
||||||
|
|
||||||
|
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||||
|
found = false;
|
||||||
|
craftable = false;
|
||||||
|
ArrayList<ItemStack> valid = new ArrayList<>();
|
||||||
|
if (i.isInput()) {
|
||||||
|
List<?> allIngredients = i.getAllIngredients();
|
||||||
|
for (Object allIngredient : allIngredients) {
|
||||||
|
if (allIngredient instanceof ItemStack) {
|
||||||
|
ItemStack stack = (ItemStack) allIngredient;
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
IAEItemStack search = AEItemStack.fromItemStack(stack);
|
||||||
|
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
|
Collection<IAEItemStack> fuzzy = available.findFuzzy(search, FuzzyMode.IGNORE_ALL);
|
||||||
|
if (fuzzy.size() > 0) {
|
||||||
|
for (IAEItemStack itemStack : fuzzy) {
|
||||||
|
if (itemStack.getStackSize() > 0) {
|
||||||
|
if (Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
|
if (!(stack.getMetadata() == itemStack.getDefinition().getMetadata())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found = true;
|
||||||
|
used.add(itemStack.copy().setStackSize(1));
|
||||||
|
valid.add(itemStack.copy().setStackSize(1).createItemStack());
|
||||||
|
} else {
|
||||||
|
if (itemStack.isCraftable()) {
|
||||||
|
craftable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
IAEItemStack ext = available.findPrecise(search);
|
||||||
|
if (ext != null) {
|
||||||
|
IAEItemStack usedStack = used.findPrecise(ext);
|
||||||
|
if (ext.getStackSize() > 0 && (usedStack == null || usedStack.getStackSize() < ext.getStackSize())) {
|
||||||
|
used.add(ext.copy().setStackSize(1));
|
||||||
|
if (craftable) {
|
||||||
|
valid.clear();
|
||||||
|
}
|
||||||
|
valid.add(ext.copy().setStackSize(1).createItemStack());
|
||||||
|
found = true;
|
||||||
|
} else if (ext.isCraftable()) {
|
||||||
|
valid.add(ext.copy().setStackSize(1).createItemStack());
|
||||||
|
craftable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i.getAllIngredients().size() == 0) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
if (craftable) {
|
||||||
|
i.drawHighlight(minecraft, new Color(0.0f, 0.0f, 1.0f, 0.4f), recipeX, recipeY);
|
||||||
|
this.craftableSlots.add(currentSlot);
|
||||||
|
recipeLayout.getItemStacks().set(currentSlot, valid);
|
||||||
|
} else {
|
||||||
|
i.drawHighlight(minecraft, new Color(1.0f, 0.0f, 0.0f, 0.4f), recipeX, recipeY);
|
||||||
|
}
|
||||||
|
this.errored = true;
|
||||||
|
} else {
|
||||||
|
this.foundSlots.add(currentSlot);
|
||||||
|
recipeLayout.getItemStacks().set(currentSlot, valid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentSlot++;
|
||||||
|
}
|
||||||
|
if (!this.errored) {
|
||||||
|
((RecipeLayout) recipeLayout).getRecipeTransferButton().init(Minecraft.getMinecraft().player.openContainer, Minecraft.getMinecraft().player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IItemList<IAEItemStack> mergeInventories(IItemList<IAEItemStack> repo, ContainerCraftingTerm containerCraftingTerm) {
|
||||||
|
IItemList<IAEItemStack> itemList = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
|
for (IAEItemStack i : repo) {
|
||||||
|
itemList.addStorage(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerMainInvWrapper invWrapper = new PlayerMainInvWrapper(containerCraftingTerm.getPlayerInv());
|
||||||
|
for (int i = 0; i < invWrapper.getSlots(); i++) {
|
||||||
|
itemList.addStorage(AEItemStack.fromItemStack(invWrapper.getStackInSlot(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
IItemHandler itemHandler = containerCraftingTerm.getInventoryByName("crafting");
|
||||||
|
for (int i = 0; i < itemHandler.getSlots(); i++) {
|
||||||
|
itemList.addStorage(AEItemStack.fromItemStack(itemHandler.getStackInSlot(i)));
|
||||||
|
}
|
||||||
|
return itemList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean errored() {
|
||||||
|
return errored;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package appeng.integration.modules.jei;
|
package appeng.integration.modules.jei;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
import appeng.container.implementations.ContainerPatternTerm;
|
import appeng.container.implementations.ContainerPatternTerm;
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
@@ -40,12 +41,15 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackToNBT;
|
||||||
|
|
||||||
|
|
||||||
class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandler<T> {
|
class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandler<T> {
|
||||||
|
|
||||||
@@ -62,7 +66,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IRecipeTransferError transferRecipe(T container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
public IRecipeTransferError transferRecipe(@Nonnull T container, IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||||
final String recipeType = recipeLayout.getRecipeCategory().getUid();
|
final String recipeType = recipeLayout.getRecipeCategory().getUid();
|
||||||
|
|
||||||
if (recipeType.equals(VanillaRecipeCategoryUid.INFORMATION) || recipeType.equals(VanillaRecipeCategoryUid.FUEL)) {
|
if (recipeType.equals(VanillaRecipeCategoryUid.INFORMATION) || recipeType.equals(VanillaRecipeCategoryUid.FUEL)) {
|
||||||
@@ -70,6 +74,11 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!doTransfer) {
|
if (!doTransfer) {
|
||||||
|
if (container instanceof ContainerCraftingTerm && recipeType.equals(VanillaRecipeCategoryUid.CRAFTING)) {
|
||||||
|
JEIMissingItem error = new JEIMissingItem(container, recipeLayout);
|
||||||
|
if (error.errored())
|
||||||
|
return error;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +110,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
|||||||
if (!ingredient.isInput()) {
|
if (!ingredient.isInput()) {
|
||||||
ItemStack output = ingredient.getDisplayedIngredient();
|
ItemStack output = ingredient.getDisplayedIngredient();
|
||||||
if (output != null) {
|
if (output != null) {
|
||||||
final NBTTagCompound tag = new NBTTagCompound();
|
final NBTTagCompound tag = stackToNBT(output);
|
||||||
output.writeToNBT(tag);
|
|
||||||
outputs.appendTag(tag);
|
outputs.appendTag(tag);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -133,8 +141,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (final ItemStack is : list) {
|
for (final ItemStack is : list) {
|
||||||
final NBTTagCompound tag = new NBTTagCompound();
|
final NBTTagCompound tag = stackToNBT(is);
|
||||||
is.writeToNBT(tag);
|
|
||||||
tags.appendTag(tag);
|
tags.appendTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-6
@@ -138,16 +138,14 @@ public class SecurityCache implements ISecurityGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(final int playerID, final SecurityPermissions perm) {
|
public boolean hasPermission(final int playerID, final SecurityPermissions perm) {
|
||||||
|
if (playerID == -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (this.isAvailable()) {
|
if (this.isAvailable()) {
|
||||||
final EnumSet<SecurityPermissions> perms = this.playerPerms.get(playerID);
|
final EnumSet<SecurityPermissions> perms = this.playerPerms.get(playerID);
|
||||||
|
|
||||||
if (perms == null) {
|
if (perms == null) {
|
||||||
if (playerID == -1) // no default?
|
return this.hasPermission(-1, perm);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return this.hasPermission(-1, perm);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return perms.contains(perm);
|
return perms.contains(perm);
|
||||||
|
|||||||
@@ -639,9 +639,10 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
|||||||
itemList = new ArrayList<>(1);
|
itemList = new ArrayList<>(1);
|
||||||
|
|
||||||
final IAEItemStack item = this.inventory.getItemList().findPrecise(input[x]);
|
final IAEItemStack item = this.inventory.getItemList().findPrecise(input[x]);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
itemList.add(item);
|
itemList.add(item);
|
||||||
|
} else if (input[x].getDefinition().getItem().isDamageable() || Platform.isGTDamageableItem(input[x].getDefinition().getItem())) {
|
||||||
|
itemList.addAll(this.inventory.getItemList().findFuzzy(input[x], FuzzyMode.IGNORE_ALL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
|||||||
* @param from source of settings
|
* @param from source of settings
|
||||||
* @param compound compound of source
|
* @param compound compound of source
|
||||||
*/
|
*/
|
||||||
private void uploadSettings(final SettingsFrom from, final NBTTagCompound compound) {
|
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound, EntityPlayer player) {
|
||||||
if (compound != null) {
|
if (compound != null) {
|
||||||
final IConfigManager cm = this.getConfigManager();
|
final IConfigManager cm = this.getConfigManager();
|
||||||
if (cm != null) {
|
if (cm != null) {
|
||||||
@@ -359,7 +359,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
|||||||
* @param from source of settings
|
* @param from source of settings
|
||||||
* @return compound of source
|
* @return compound of source
|
||||||
*/
|
*/
|
||||||
private NBTTagCompound downloadSettings(final SettingsFrom from) {
|
protected NBTTagCompound downloadSettings(final SettingsFrom from) {
|
||||||
final NBTTagCompound output = new NBTTagCompound();
|
final NBTTagCompound output = new NBTTagCompound();
|
||||||
|
|
||||||
final IConfigManager cm = this.getConfigManager();
|
final IConfigManager cm = this.getConfigManager();
|
||||||
@@ -428,7 +428,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
|||||||
final String storedName = memoryCard.getSettingsName(memCardIS);
|
final String storedName = memoryCard.getSettingsName(memCardIS);
|
||||||
final NBTTagCompound data = memoryCard.getData(memCardIS);
|
final NBTTagCompound data = memoryCard.getData(memCardIS);
|
||||||
if (name.equals(storedName)) {
|
if (name.equals(storedName)) {
|
||||||
this.uploadSettings(SettingsFrom.MEMORY_CARD, data);
|
this.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
||||||
} else {
|
} else {
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
||||||
|
|||||||
@@ -113,4 +113,5 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel
|
|||||||
private void setClientFlags(final int clientFlags) {
|
private void setClientFlags(final int clientFlags) {
|
||||||
this.clientFlags = clientFlags;
|
this.clientFlags = clientFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.parts.misc;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.definitions.IMaterials;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
@@ -42,15 +43,19 @@ import appeng.api.storage.data.IAEStack;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
import appeng.core.localization.PlayerMessages;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
import appeng.helpers.IInterfaceHost;
|
import appeng.helpers.IInterfaceHost;
|
||||||
import appeng.helpers.IPriorityHost;
|
import appeng.helpers.IPriorityHost;
|
||||||
import appeng.helpers.Reflected;
|
import appeng.helpers.Reflected;
|
||||||
|
import appeng.items.misc.ItemEncodedPattern;
|
||||||
import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
import appeng.parts.PartBasicState;
|
import appeng.parts.PartBasicState;
|
||||||
import appeng.parts.PartModel;
|
import appeng.parts.PartModel;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.SettingsFrom;
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
import appeng.util.inv.IInventoryDestination;
|
import appeng.util.inv.IInventoryDestination;
|
||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
@@ -66,6 +71,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -275,4 +281,60 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
|||||||
public GuiBridge getGuiBridge() {
|
public GuiBridge getGuiBridge() {
|
||||||
return GuiBridge.GUI_INTERFACE;
|
return GuiBridge.GUI_INTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||||
|
NBTTagCompound output = super.downloadSettings(from);
|
||||||
|
if (from == SettingsFrom.MEMORY_CARD) {
|
||||||
|
final IItemHandler inv = this.getInventoryByName("patterns");
|
||||||
|
if (inv instanceof AppEngInternalInventory) {
|
||||||
|
((AppEngInternalInventory) inv).writeToNBT(output, "patterns");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void uploadSettings(SettingsFrom from, NBTTagCompound compound, EntityPlayer player) {
|
||||||
|
super.uploadSettings(from, compound, player);
|
||||||
|
final IItemHandler inv = this.getInventoryByName("patterns");
|
||||||
|
if (inv instanceof AppEngInternalInventory) {
|
||||||
|
final AppEngInternalInventory target = (AppEngInternalInventory) inv;
|
||||||
|
AppEngInternalInventory tmp = new AppEngInternalInventory(null, target.getSlots());
|
||||||
|
tmp.readFromNBT(compound, "patterns");
|
||||||
|
PlayerMainInvWrapper playerInv = new PlayerMainInvWrapper(player.inventory);
|
||||||
|
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||||
|
int missingPatternsToEncode = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
if (target.getStackInSlot(i).getItem() instanceof ItemEncodedPattern) {
|
||||||
|
ItemStack blank = materials.blankPattern().maybeStack(target.getStackInSlot(i).getCount()).get();
|
||||||
|
if (!player.addItemStackToInventory(blank)) {
|
||||||
|
player.dropItem(blank, true);
|
||||||
|
}
|
||||||
|
target.setStackInSlot(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int x = 0; x < tmp.getSlots(); x++) {
|
||||||
|
if (!tmp.getStackInSlot(x).isEmpty()) {
|
||||||
|
boolean found = false;
|
||||||
|
for (int i = 0; i < playerInv.getSlots(); i++) {
|
||||||
|
if (materials.blankPattern().isSameAs(playerInv.getStackInSlot(i))) {
|
||||||
|
target.setStackInSlot(x, tmp.getStackInSlot(x));
|
||||||
|
playerInv.getStackInSlot(i).shrink(1);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
missingPatternsToEncode++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Platform.isServer() && missingPatternsToEncode > 0) {
|
||||||
|
player.sendMessage(PlayerMessages.MissingPatternsToEncode.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package appeng.parts.reporting;
|
||||||
|
|
||||||
|
import appeng.api.implementations.ICraftingPatternItem;
|
||||||
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
|
import appeng.api.parts.IPartModel;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class AbstractPartEncoder extends AbstractPartTerminal {
|
||||||
|
|
||||||
|
protected AppEngInternalInventory crafting;
|
||||||
|
protected AppEngInternalInventory output;
|
||||||
|
protected AppEngInternalInventory pattern;
|
||||||
|
|
||||||
|
protected boolean craftingMode = true;
|
||||||
|
protected boolean substitute = false;
|
||||||
|
|
||||||
|
public AbstractPartEncoder(ItemStack is) {
|
||||||
|
super(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||||
|
for (final ItemStack is : this.pattern) {
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
drops.add(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(final NBTTagCompound data) {
|
||||||
|
super.readFromNBT(data);
|
||||||
|
this.pattern.readFromNBT(data, "pattern");
|
||||||
|
this.output.readFromNBT(data, "outputList");
|
||||||
|
this.crafting.readFromNBT(data, "crafting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(final NBTTagCompound data) {
|
||||||
|
super.writeToNBT(data);
|
||||||
|
this.pattern.writeToNBT(data, "pattern");
|
||||||
|
this.output.writeToNBT(data, "outputList");
|
||||||
|
this.crafting.writeToNBT(data, "crafting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
||||||
|
if (inv == this.pattern && slot == 1) {
|
||||||
|
final ItemStack is = this.pattern.getStackInSlot(1);
|
||||||
|
if (!is.isEmpty() && is.getItem() instanceof ICraftingPatternItem) {
|
||||||
|
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||||
|
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorld());
|
||||||
|
if (details != null) {
|
||||||
|
this.setCraftingRecipe(details.isCraftable());
|
||||||
|
this.setSubstitution(details.canSubstitute());
|
||||||
|
|
||||||
|
for (int x = 0; x < this.crafting.getSlots() && x < details.getInputs().length; x++) {
|
||||||
|
final IAEItemStack item = details.getInputs()[x];
|
||||||
|
this.crafting.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int x = 0; x < this.output.getSlots() && x < details.getOutputs().length; x++) {
|
||||||
|
final IAEItemStack item = details.getOutputs()[x];
|
||||||
|
this.output.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (inv == this.crafting) {
|
||||||
|
this.fixCraftingRecipes();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getHost().markForSave();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fixCraftingRecipes() {
|
||||||
|
if (this.isCraftingRecipe()) {
|
||||||
|
for (int x = 0; x < this.crafting.getSlots(); x++) {
|
||||||
|
final ItemStack is = this.crafting.getStackInSlot(x);
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
is.setCount(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCraftingRecipe() {
|
||||||
|
return this.craftingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCraftingRecipe(final boolean craftingMode) {
|
||||||
|
this.craftingMode = craftingMode;
|
||||||
|
this.fixCraftingRecipes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSubstitution() {
|
||||||
|
return this.substitute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubstitution(final boolean canSubstitute) {
|
||||||
|
this.substitute = canSubstitute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemHandler getInventoryByName(final String name) {
|
||||||
|
if (name.equals("crafting")) {
|
||||||
|
return this.crafting;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equals("output")) {
|
||||||
|
return this.output;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equals("pattern")) {
|
||||||
|
return this.pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getInventoryByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GuiBridge getGui(final EntityPlayer p) {
|
||||||
|
int x = (int) p.posX;
|
||||||
|
int y = (int) p.posY;
|
||||||
|
int z = (int) p.posZ;
|
||||||
|
if (this.getHost().getTile() != null) {
|
||||||
|
x = this.getTile().getPos().getX();
|
||||||
|
y = this.getTile().getPos().getY();
|
||||||
|
z = this.getTile().getPos().getZ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getGuiBridge().hasPermissions(this.getHost().getTile(), x, y, z, this.getSide(), p)) {
|
||||||
|
return getGuiBridge();
|
||||||
|
}
|
||||||
|
return GuiBridge.GUI_ME;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public GuiBridge getGuiBridge();
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
abstract public IPartModel getStaticModels();
|
||||||
|
}
|
||||||
@@ -1,29 +1,22 @@
|
|||||||
package appeng.parts.reporting;
|
package appeng.parts.reporting;
|
||||||
|
|
||||||
import appeng.api.implementations.ICraftingPatternItem;
|
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
|
||||||
import appeng.api.parts.IPartModel;
|
import appeng.api.parts.IPartModel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.Reflected;
|
import appeng.helpers.Reflected;
|
||||||
import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
import appeng.parts.PartModel;
|
import appeng.parts.PartModel;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.util.inv.InvOperation;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import java.util.List;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import static appeng.helpers.PatternHelper.PROCESSING_INPUT_LIMIT;
|
import static appeng.helpers.PatternHelper.PROCESSING_INPUT_LIMIT;
|
||||||
import static appeng.helpers.PatternHelper.PROCESSING_OUTPUT_LIMIT;
|
import static appeng.helpers.PatternHelper.PROCESSING_OUTPUT_LIMIT;
|
||||||
|
|
||||||
|
|
||||||
public class PartExpandedProcessingPatternTerminal extends AbstractPartTerminal {
|
public class PartExpandedProcessingPatternTerminal extends AbstractPartEncoder {
|
||||||
@PartModels
|
@PartModels
|
||||||
public static final ResourceLocation MODEL_OFF = new ResourceLocation(AppEng.MOD_ID, "part/expanded_processing_pattern_terminal_off");
|
public static final ResourceLocation MODEL_OFF = new ResourceLocation(AppEng.MOD_ID, "part/expanded_processing_pattern_terminal_off");
|
||||||
@PartModels
|
@PartModels
|
||||||
@@ -33,96 +26,31 @@ public class PartExpandedProcessingPatternTerminal extends AbstractPartTerminal
|
|||||||
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_ON);
|
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_ON);
|
||||||
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL);
|
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL);
|
||||||
|
|
||||||
private final AppEngInternalInventory crafting = new AppEngInternalInventory(this, PROCESSING_INPUT_LIMIT);
|
|
||||||
|
|
||||||
private final AppEngInternalInventory output = new AppEngInternalInventory(this, PROCESSING_OUTPUT_LIMIT);
|
|
||||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory(this, 2);
|
|
||||||
|
|
||||||
@Reflected
|
@Reflected
|
||||||
public PartExpandedProcessingPatternTerminal(final ItemStack is) {
|
public PartExpandedProcessingPatternTerminal(final ItemStack is) {
|
||||||
super(is);
|
super(is);
|
||||||
|
this.crafting = new AppEngInternalInventory(this, PROCESSING_INPUT_LIMIT);
|
||||||
|
this.output = new AppEngInternalInventory(this, PROCESSING_OUTPUT_LIMIT);
|
||||||
|
this.pattern = new AppEngInternalInventory(this, 2);
|
||||||
|
this.craftingMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
public boolean isCraftingRecipe() {
|
||||||
for (final ItemStack is : this.pattern) {
|
return false;
|
||||||
if (!is.isEmpty()) {
|
|
||||||
drops.add(is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound data) {
|
public void setCraftingRecipe(final boolean craftingMode) {
|
||||||
super.readFromNBT(data);
|
// NO-OP
|
||||||
this.crafting.readFromNBT(data, "processingGrid");
|
|
||||||
this.pattern.readFromNBT(data, "pattern");
|
|
||||||
this.output.readFromNBT(data, "outputList");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound data) {
|
public GuiBridge getGuiBridge() {
|
||||||
super.writeToNBT(data);
|
return GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL;
|
||||||
this.crafting.writeToNBT(data, "processingGrid");
|
|
||||||
this.pattern.writeToNBT(data, "pattern");
|
|
||||||
this.output.writeToNBT(data, "outputList");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GuiBridge getGui(final EntityPlayer p) {
|
|
||||||
int x = (int) p.posX;
|
|
||||||
int y = (int) p.posY;
|
|
||||||
int z = (int) p.posZ;
|
|
||||||
if (this.getHost().getTile() != null) {
|
|
||||||
x = this.getTile().getPos().getX();
|
|
||||||
y = this.getTile().getPos().getY();
|
|
||||||
z = this.getTile().getPos().getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL.hasPermissions(this.getHost().getTile(), x, y, z, this.getSide(), p)) {
|
|
||||||
return GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL;
|
|
||||||
}
|
|
||||||
return GuiBridge.GUI_ME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
|
||||||
if (inv == this.pattern && slot == 1) {
|
|
||||||
final ItemStack is = this.pattern.getStackInSlot(1);
|
|
||||||
if (!is.isEmpty() && is.getItem() instanceof ICraftingPatternItem) {
|
|
||||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
|
||||||
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorld());
|
|
||||||
if (details != null) {
|
|
||||||
for (int x = 0; x < this.crafting.getSlots() && x < details.getInputs().length; x++) {
|
|
||||||
final IAEItemStack item = details.getInputs()[x];
|
|
||||||
this.crafting.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < this.output.getSlots() && x < details.getOutputs().length; x++) {
|
|
||||||
final IAEItemStack item = details.getOutputs()[x];
|
|
||||||
this.output.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getHost().markForSave();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IItemHandler getInventoryByName(final String name) {
|
|
||||||
if (name.equals("crafting")) {
|
|
||||||
return this.crafting;
|
|
||||||
}
|
|
||||||
if (name.equals("output")) {
|
|
||||||
return this.output;
|
|
||||||
}
|
|
||||||
if (name.equals("pattern")) {
|
|
||||||
return this.pattern;
|
|
||||||
}
|
|
||||||
return super.getInventoryByName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IPartModel getStaticModels() {
|
public IPartModel getStaticModels() {
|
||||||
return this.selectModel(MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL);
|
return this.selectModel(MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL);
|
||||||
|
|||||||
@@ -19,27 +19,24 @@
|
|||||||
package appeng.parts.reporting;
|
package appeng.parts.reporting;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.implementations.ICraftingPatternItem;
|
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
|
||||||
import appeng.api.parts.IPartModel;
|
import appeng.api.parts.IPartModel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.Reflected;
|
import appeng.helpers.Reflected;
|
||||||
import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
import appeng.parts.PartModel;
|
import appeng.parts.PartModel;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.util.inv.InvOperation;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import java.util.List;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import static appeng.helpers.PatternHelper.CRAFTING_GRID_DIMENSION;
|
||||||
|
import static appeng.helpers.PatternHelper.CRAFTING_OUTPUT_LIMIT;
|
||||||
|
|
||||||
|
|
||||||
public class PartPatternTerminal extends AbstractPartTerminal {
|
public class PartPatternTerminal extends AbstractPartEncoder {
|
||||||
|
|
||||||
@PartModels
|
@PartModels
|
||||||
public static final ResourceLocation MODEL_OFF = new ResourceLocation(AppEng.MOD_ID, "part/pattern_terminal_off");
|
public static final ResourceLocation MODEL_OFF = new ResourceLocation(AppEng.MOD_ID, "part/pattern_terminal_off");
|
||||||
@@ -50,25 +47,12 @@ public class PartPatternTerminal extends AbstractPartTerminal {
|
|||||||
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_ON);
|
public static final IPartModel MODELS_ON = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_ON);
|
||||||
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL);
|
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL);
|
||||||
|
|
||||||
private final AppEngInternalInventory crafting = new AppEngInternalInventory(this, 9);
|
|
||||||
private final AppEngInternalInventory output = new AppEngInternalInventory(this, 3);
|
|
||||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory(this, 2);
|
|
||||||
|
|
||||||
private boolean craftingMode = true;
|
|
||||||
private boolean substitute = false;
|
|
||||||
|
|
||||||
@Reflected
|
@Reflected
|
||||||
public PartPatternTerminal(final ItemStack is) {
|
public PartPatternTerminal(final ItemStack is) {
|
||||||
super(is);
|
super(is);
|
||||||
}
|
this.crafting = new AppEngInternalInventory(this, CRAFTING_GRID_DIMENSION * CRAFTING_GRID_DIMENSION);
|
||||||
|
this.output = new AppEngInternalInventory(this, 3);
|
||||||
@Override
|
this.pattern = new AppEngInternalInventory(this, 2);
|
||||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
|
||||||
for (final ItemStack is : this.pattern) {
|
|
||||||
if (!is.isEmpty()) {
|
|
||||||
drops.add(is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,9 +60,6 @@ public class PartPatternTerminal extends AbstractPartTerminal {
|
|||||||
super.readFromNBT(data);
|
super.readFromNBT(data);
|
||||||
this.setCraftingRecipe(data.getBoolean("craftingMode"));
|
this.setCraftingRecipe(data.getBoolean("craftingMode"));
|
||||||
this.setSubstitution(data.getBoolean("substitute"));
|
this.setSubstitution(data.getBoolean("substitute"));
|
||||||
this.pattern.readFromNBT(data, "pattern");
|
|
||||||
this.output.readFromNBT(data, "outputList");
|
|
||||||
this.crafting.readFromNBT(data, "craftingGrid");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,102 +67,14 @@ public class PartPatternTerminal extends AbstractPartTerminal {
|
|||||||
super.writeToNBT(data);
|
super.writeToNBT(data);
|
||||||
data.setBoolean("craftingMode", this.craftingMode);
|
data.setBoolean("craftingMode", this.craftingMode);
|
||||||
data.setBoolean("substitute", this.substitute);
|
data.setBoolean("substitute", this.substitute);
|
||||||
this.pattern.writeToNBT(data, "pattern");
|
|
||||||
this.output.writeToNBT(data, "outputList");
|
|
||||||
this.crafting.writeToNBT(data, "craftingGrid");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GuiBridge getGui(final EntityPlayer p) {
|
public GuiBridge getGuiBridge() {
|
||||||
int x = (int) p.posX;
|
return GuiBridge.GUI_PATTERN_TERMINAL;
|
||||||
int y = (int) p.posY;
|
|
||||||
int z = (int) p.posZ;
|
|
||||||
if (this.getHost().getTile() != null) {
|
|
||||||
x = this.getTile().getPos().getX();
|
|
||||||
y = this.getTile().getPos().getY();
|
|
||||||
z = this.getTile().getPos().getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions(this.getHost().getTile(), x, y, z, this.getSide(), p)) {
|
|
||||||
return GuiBridge.GUI_PATTERN_TERMINAL;
|
|
||||||
}
|
|
||||||
return GuiBridge.GUI_ME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
|
||||||
if (inv == this.pattern && slot == 1) {
|
|
||||||
final ItemStack is = this.pattern.getStackInSlot(1);
|
|
||||||
if (!is.isEmpty() && is.getItem() instanceof ICraftingPatternItem) {
|
|
||||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
|
||||||
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorld());
|
|
||||||
if (details != null) {
|
|
||||||
this.setCraftingRecipe(details.isCraftable());
|
|
||||||
this.setSubstitution(details.canSubstitute());
|
|
||||||
|
|
||||||
for (int x = 0; x < this.crafting.getSlots() && x < details.getInputs().length; x++) {
|
|
||||||
final IAEItemStack item = details.getInputs()[x];
|
|
||||||
this.crafting.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < this.output.getSlots() && x < details.getOutputs().length; x++) {
|
|
||||||
final IAEItemStack item = details.getOutputs()[x];
|
|
||||||
this.output.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (inv == this.crafting) {
|
|
||||||
this.fixCraftingRecipes();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getHost().markForSave();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fixCraftingRecipes() {
|
|
||||||
if (this.craftingMode) {
|
|
||||||
for (int x = 0; x < this.crafting.getSlots(); x++) {
|
|
||||||
final ItemStack is = this.crafting.getStackInSlot(x);
|
|
||||||
if (!is.isEmpty()) {
|
|
||||||
is.setCount(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCraftingRecipe() {
|
|
||||||
return this.craftingMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftingRecipe(final boolean craftingMode) {
|
|
||||||
this.craftingMode = craftingMode;
|
|
||||||
this.fixCraftingRecipes();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSubstitution() {
|
|
||||||
return this.substitute;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubstitution(final boolean canSubstitute) {
|
|
||||||
this.substitute = canSubstitute;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IItemHandler getInventoryByName(final String name) {
|
|
||||||
if (name.equals("crafting")) {
|
|
||||||
return this.crafting;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name.equals("output")) {
|
|
||||||
return this.output;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name.equals("pattern")) {
|
|
||||||
return this.pattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.getInventoryByName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public IPartModel getStaticModels() {
|
public IPartModel getStaticModels() {
|
||||||
return this.selectModel(MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL);
|
return this.selectModel(MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL);
|
||||||
|
|||||||
@@ -138,18 +138,12 @@ public final class CompassService {
|
|||||||
public void kill() {
|
public void kill() {
|
||||||
this.executor.shutdown();
|
this.executor.shutdown();
|
||||||
|
|
||||||
try {
|
this.jobSize = 0;
|
||||||
this.executor.awaitTermination(6, TimeUnit.MINUTES);
|
for (final CompassReader cr : this.worldSet.values()) {
|
||||||
this.jobSize = 0;
|
cr.close();
|
||||||
|
|
||||||
for (final CompassReader cr : this.worldSet.values()) {
|
|
||||||
cr.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.worldSet.clear();
|
|
||||||
} catch (final InterruptedException e) {
|
|
||||||
// wrap this up..
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.worldSet.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompassReader getReader(final World w) {
|
private CompassReader getReader(final World w) {
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInventory {
|
public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInventory {
|
||||||
|
|
||||||
@@ -50,7 +53,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
|
|||||||
final NBTTagCompound opt = data.getCompoundTag("inv");
|
final NBTTagCompound opt = data.getCompoundTag("inv");
|
||||||
for (int x = 0; x < inv.getSlots(); x++) {
|
for (int x = 0; x < inv.getSlots(); x++) {
|
||||||
final NBTTagCompound item = opt.getCompoundTag("item" + x);
|
final NBTTagCompound item = opt.getCompoundTag("item" + x);
|
||||||
ItemHandlerUtil.setStackInSlot(inv, x, new ItemStack(item));
|
ItemHandlerUtil.setStackInSlot(inv, x, stackFromNBT(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,12 +68,12 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
|
|||||||
if (inv != EmptyHandler.INSTANCE) {
|
if (inv != EmptyHandler.INSTANCE) {
|
||||||
final NBTTagCompound opt = new NBTTagCompound();
|
final NBTTagCompound opt = new NBTTagCompound();
|
||||||
for (int x = 0; x < inv.getSlots(); x++) {
|
for (int x = 0; x < inv.getSlots(); x++) {
|
||||||
final NBTTagCompound item = new NBTTagCompound();
|
final NBTTagCompound itemNBT = new NBTTagCompound();
|
||||||
final ItemStack is = inv.getStackInSlot(x);
|
final ItemStack is = inv.getStackInSlot(x);
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
is.writeToNBT(item);
|
stackWriteToNBT(is, itemNBT);
|
||||||
}
|
}
|
||||||
opt.setTag("item" + x, item);
|
opt.setTag("item" + x, itemNBT);
|
||||||
}
|
}
|
||||||
data.setTag("inv", opt);
|
data.setTag("inv", opt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
@@ -301,7 +302,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||||||
|
|
||||||
public void onPlacement(final ItemStack stack, final EntityPlayer player, final EnumFacing side) {
|
public void onPlacement(final ItemStack stack, final EntityPlayer player, final EnumFacing side) {
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
this.uploadSettings(SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound());
|
this.uploadSettings(SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound(), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +312,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||||||
* @param from source of settings
|
* @param from source of settings
|
||||||
* @param compound compound of source
|
* @param compound compound of source
|
||||||
*/
|
*/
|
||||||
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound) {
|
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound, EntityPlayer player) {
|
||||||
if (compound != null && this instanceof IConfigurableObject) {
|
if (compound != null && this instanceof IConfigurableObject) {
|
||||||
final IConfigManager cm = ((IConfigurableObject) this).getConfigManager();
|
final IConfigManager cm = ((IConfigurableObject) this).getConfigManager();
|
||||||
if (cm != null) {
|
if (cm != null) {
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ import java.util.EnumMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
|
||||||
public class TileMolecularAssembler extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable, ICraftingMachine, IPowerChannelState {
|
public class TileMolecularAssembler extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable, ICraftingMachine, IPowerChannelState {
|
||||||
private final InventoryCrafting craftingInv;
|
private final InventoryCrafting craftingInv;
|
||||||
@@ -288,7 +291,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
|||||||
final ItemStack pattern = this.myPlan.getPattern();
|
final ItemStack pattern = this.myPlan.getPattern();
|
||||||
if (!pattern.isEmpty()) {
|
if (!pattern.isEmpty()) {
|
||||||
final NBTTagCompound compound = new NBTTagCompound();
|
final NBTTagCompound compound = new NBTTagCompound();
|
||||||
pattern.writeToNBT(compound);
|
stackWriteToNBT(pattern, compound);
|
||||||
data.setTag("myPlan", compound);
|
data.setTag("myPlan", compound);
|
||||||
data.setInteger("pushDirection", this.pushDirection.ordinal());
|
data.setInteger("pushDirection", this.pushDirection.ordinal());
|
||||||
}
|
}
|
||||||
@@ -303,7 +306,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
|||||||
public void readFromNBT(final NBTTagCompound data) {
|
public void readFromNBT(final NBTTagCompound data) {
|
||||||
super.readFromNBT(data);
|
super.readFromNBT(data);
|
||||||
if (data.hasKey("myPlan")) {
|
if (data.hasKey("myPlan")) {
|
||||||
final ItemStack myPat = new ItemStack(data.getCompoundTag("myPlan"));
|
final ItemStack myPat = stackFromNBT(data.getCompoundTag("myPlan"));
|
||||||
|
|
||||||
if (!myPat.isEmpty() && myPat.getItem() instanceof ItemEncodedPattern) {
|
if (!myPat.isEmpty() && myPat.getItem() instanceof ItemEncodedPattern) {
|
||||||
final World w = this.getWorld();
|
final World w = this.getWorld();
|
||||||
|
|||||||
@@ -52,6 +52,13 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
|||||||
this.inv = new IAEItemStack[s];
|
this.inv = new IAEItemStack[s];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AppEngInternalAEInventory(final IAEAppEngInventory te, final int s, int stackSize) {
|
||||||
|
this.te = te;
|
||||||
|
this.size = s;
|
||||||
|
this.maxStack = stackSize;
|
||||||
|
this.inv = new IAEItemStack[s];
|
||||||
|
}
|
||||||
|
|
||||||
public void setMaxStackSize(final int s) {
|
public void setMaxStackSize(final int s) {
|
||||||
this.maxStack = s;
|
this.maxStack = s;
|
||||||
}
|
}
|
||||||
@@ -216,7 +223,7 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSlotLimit(int slot) {
|
public int getSlotLimit(int slot) {
|
||||||
return this.maxStack > 64 ? 64 : this.maxStack;
|
return this.maxStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ import appeng.util.inv.InvOperation;
|
|||||||
import appeng.util.inv.filter.IAEItemFilter;
|
import appeng.util.inv.filter.IAEItemFilter;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@@ -32,14 +35,18 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackToNBT;
|
||||||
|
|
||||||
|
|
||||||
public class AppEngInternalInventory extends ItemStackHandler implements Iterable<ItemStack> {
|
public class AppEngInternalInventory extends ItemStackHandler implements Iterable<ItemStack> {
|
||||||
private boolean enableClientEvents = false;
|
protected boolean enableClientEvents = false;
|
||||||
private IAEAppEngInventory te;
|
protected IAEAppEngInventory te;
|
||||||
private final int[] maxStack;
|
protected final int[] maxStack;
|
||||||
private ItemStack previousStack = ItemStack.EMPTY;
|
protected ItemStack previousStack = ItemStack.EMPTY;
|
||||||
private IAEItemFilter filter;
|
protected IAEItemFilter filter;
|
||||||
private boolean dirtyFlag = false;
|
protected boolean dirtyFlag = false;
|
||||||
|
protected boolean limitExtraction;
|
||||||
|
|
||||||
public AppEngInternalInventory(final IAEAppEngInventory inventory, final int size, final int maxStack, IAEItemFilter filter) {
|
public AppEngInternalInventory(final IAEAppEngInventory inventory, final int size, final int maxStack, IAEItemFilter filter) {
|
||||||
super(size);
|
super(size);
|
||||||
@@ -152,6 +159,23 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
|||||||
data.setTag(name, this.serializeNBT());
|
data.setTag(name, this.serializeNBT());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound serializeNBT() {
|
||||||
|
NBTTagList nbtTagList = new NBTTagList();
|
||||||
|
for (int i = 0; i < stacks.size(); i++) {
|
||||||
|
ItemStack is = stacks.get(i);
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
NBTTagCompound itemTag = stackToNBT(is);
|
||||||
|
itemTag.setInteger("Slot", i);
|
||||||
|
nbtTagList.appendTag(itemTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
nbt.setTag("Items", nbtTagList);
|
||||||
|
nbt.setInteger("Size", stacks.size());
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
public void readFromNBT(final NBTTagCompound data, final String name) {
|
public void readFromNBT(final NBTTagCompound data, final String name) {
|
||||||
final NBTTagCompound c = data.getCompoundTag(name);
|
final NBTTagCompound c = data.getCompoundTag(name);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
@@ -163,6 +187,20 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
|||||||
this.deserializeNBT(data);
|
this.deserializeNBT(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserializeNBT(NBTTagCompound nbt) {
|
||||||
|
setSize(nbt.hasKey("Size", Constants.NBT.TAG_INT) ? nbt.getInteger("Size") : stacks.size());
|
||||||
|
NBTTagList tagList = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||||
|
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||||
|
NBTTagCompound itemTags = tagList.getCompoundTagAt(i);
|
||||||
|
int slot = itemTags.getInteger("Slot");
|
||||||
|
if (slot >= 0 && slot < stacks.size()) {
|
||||||
|
stacks.set(slot, stackFromNBT(itemTags));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onLoad();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<ItemStack> iterator() {
|
public Iterator<ItemStack> iterator() {
|
||||||
return Collections.unmodifiableList(super.stacks).iterator();
|
return Collections.unmodifiableList(super.stacks).iterator();
|
||||||
@@ -183,4 +221,8 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
|||||||
public void setTileEntity(final IAEAppEngInventory te) {
|
public void setTileEntity(final IAEAppEngInventory te) {
|
||||||
this.te = te;
|
this.te = te;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void limitExtraction(boolean limitExtraction) {
|
||||||
|
this.limitExtraction = limitExtraction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package appeng.tile.inventory;
|
||||||
|
|
||||||
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
|
import appeng.util.inv.filter.IAEItemFilter;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.Spliterator;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class AppEngInternalOversizedInventory extends AppEngInternalInventory {
|
||||||
|
public AppEngInternalOversizedInventory(IAEAppEngInventory inventory, int size, int maxStack, IAEItemFilter filter) {
|
||||||
|
super(inventory, size, maxStack, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppEngInternalOversizedInventory(IAEAppEngInventory inventory, int size, int maxStack) {
|
||||||
|
super(inventory, size, maxStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppEngInternalOversizedInventory(IAEAppEngInventory inventory, int size) {
|
||||||
|
super(inventory, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nonnull
|
||||||
|
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||||
|
if (this.filter != null && !this.filter.allowInsert(this, slot, stack)) {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!simulate) {
|
||||||
|
this.previousStack = this.getStackInSlot(slot).copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.isEmpty())
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
|
validateSlotIndex(slot);
|
||||||
|
|
||||||
|
ItemStack existing = this.stacks.get(slot);
|
||||||
|
|
||||||
|
int limit = maxStack[slot];
|
||||||
|
|
||||||
|
if (!existing.isEmpty()) {
|
||||||
|
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
limit -= existing.getCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (limit <= 0)
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
boolean reachedLimit = stack.getCount() > limit;
|
||||||
|
|
||||||
|
if (!simulate) {
|
||||||
|
if (existing.isEmpty()) {
|
||||||
|
this.stacks.set(slot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
|
||||||
|
} else {
|
||||||
|
existing.grow(reachedLimit ? limit : stack.getCount());
|
||||||
|
}
|
||||||
|
onContentsChanged(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - limit) : ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nonnull
|
||||||
|
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||||
|
if (this.filter != null && !this.filter.allowExtract(this, slot, amount)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!simulate) {
|
||||||
|
this.previousStack = this.getStackInSlot(slot).copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (limitExtraction)
|
||||||
|
return super.extractItem(slot, amount, simulate);
|
||||||
|
if (amount == 0)
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
|
validateSlotIndex(slot);
|
||||||
|
|
||||||
|
ItemStack existing = this.stacks.get(slot);
|
||||||
|
|
||||||
|
if (existing.isEmpty())
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
|
if (existing.getCount() <= amount) {
|
||||||
|
if (!simulate) {
|
||||||
|
this.stacks.set(slot, ItemStack.EMPTY);
|
||||||
|
onContentsChanged(slot);
|
||||||
|
}
|
||||||
|
return existing;
|
||||||
|
} else {
|
||||||
|
if (!simulate) {
|
||||||
|
this.stacks.set(slot, ItemHandlerHelper.copyStackWithSize(existing, existing.getCount() - amount));
|
||||||
|
onContentsChanged(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ItemHandlerHelper.copyStackWithSize(existing, amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEach(Consumer<? super ItemStack> consumer) {
|
||||||
|
super.forEach(consumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Spliterator<ItemStack> spliterator() {
|
||||||
|
return super.spliterator();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,8 @@ package appeng.tile.misc;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.definitions.IMaterials;
|
||||||
|
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
@@ -37,16 +39,23 @@ import appeng.api.util.AECableType;
|
|||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.api.util.DimensionalCoord;
|
import appeng.api.util.DimensionalCoord;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.core.localization.PlayerMessages;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
import appeng.helpers.IInterfaceHost;
|
import appeng.helpers.IInterfaceHost;
|
||||||
import appeng.helpers.IPriorityHost;
|
import appeng.helpers.IPriorityHost;
|
||||||
|
import appeng.items.misc.ItemEncodedPattern;
|
||||||
import appeng.tile.grid.AENetworkInvTile;
|
import appeng.tile.grid.AENetworkInvTile;
|
||||||
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.SettingsFrom;
|
||||||
import appeng.util.inv.IInventoryDestination;
|
import appeng.util.inv.IInventoryDestination;
|
||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -56,6 +65,8 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -308,4 +319,61 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
|
|||||||
public GuiBridge getGuiBridge() {
|
public GuiBridge getGuiBridge() {
|
||||||
return GuiBridge.GUI_INTERFACE;
|
return GuiBridge.GUI_INTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||||
|
NBTTagCompound output = super.downloadSettings(from);
|
||||||
|
if (from == SettingsFrom.MEMORY_CARD) {
|
||||||
|
final IItemHandler inv = this.getInventoryByName("patterns");
|
||||||
|
if (inv instanceof AppEngInternalInventory) {
|
||||||
|
((AppEngInternalInventory) inv).writeToNBT(output, "patterns");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void uploadSettings(SettingsFrom from, NBTTagCompound compound, EntityPlayer player) {
|
||||||
|
super.uploadSettings(from, compound, player);
|
||||||
|
final IItemHandler inv = this.getInventoryByName("patterns");
|
||||||
|
if (inv instanceof AppEngInternalInventory) {
|
||||||
|
final AppEngInternalInventory target = (AppEngInternalInventory) inv;
|
||||||
|
AppEngInternalInventory tmp = new AppEngInternalInventory(null, target.getSlots());
|
||||||
|
tmp.readFromNBT(compound, "patterns");
|
||||||
|
PlayerMainInvWrapper playerInv = new PlayerMainInvWrapper(player.inventory);
|
||||||
|
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||||
|
int missingPatternsToEncode = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
if (target.getStackInSlot(i).getItem() instanceof ItemEncodedPattern) {
|
||||||
|
ItemStack blank = materials.blankPattern().maybeStack(target.getStackInSlot(i).getCount()).get();
|
||||||
|
if (!player.addItemStackToInventory(blank)) {
|
||||||
|
player.dropItem(blank, true);
|
||||||
|
}
|
||||||
|
target.setStackInSlot(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int x = 0; x < tmp.getSlots(); x++) {
|
||||||
|
if (!tmp.getStackInSlot(x).isEmpty()) {
|
||||||
|
boolean found = false;
|
||||||
|
for (int i = 0; i < playerInv.getSlots(); i++) {
|
||||||
|
if (materials.blankPattern().isSameAs(playerInv.getStackInSlot(i))) {
|
||||||
|
target.setStackInSlot(x, tmp.getStackInSlot(x));
|
||||||
|
playerInv.getStackInSlot(i).shrink(1);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
missingPatternsToEncode++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Platform.isServer() && missingPatternsToEncode > 0) {
|
||||||
|
player.sendMessage(PlayerMessages.MissingPatternsToEncode.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ import java.util.EnumSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class TileSecurityStation extends AENetworkTile implements ITerminalHost, IAEAppEngInventory, ILocatable, IConfigManagerHost, ISecurityProvider, IColorableTile {
|
public class TileSecurityStation extends AENetworkTile implements ITerminalHost, IAEAppEngInventory, ILocatable, IConfigManagerHost, ISecurityProvider, IColorableTile {
|
||||||
|
|
||||||
@@ -175,7 +177,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
|||||||
for (final Object key : storedItems.getKeySet()) {
|
for (final Object key : storedItems.getKeySet()) {
|
||||||
final NBTBase obj = storedItems.getTag((String) key);
|
final NBTBase obj = storedItems.getTag((String) key);
|
||||||
if (obj instanceof NBTTagCompound) {
|
if (obj instanceof NBTTagCompound) {
|
||||||
this.inventory.getStoredItems().add(AEItemStack.fromItemStack(new ItemStack((NBTTagCompound) obj)));
|
this.inventory.getStoredItems().add(AEItemStack.fromItemStack(stackFromNBT((NBTTagCompound) obj)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import appeng.block.networking.BlockEnergyCell;
|
|||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.tile.grid.AENetworkTile;
|
import appeng.tile.grid.AENetworkTile;
|
||||||
import appeng.util.SettingsFrom;
|
import appeng.util.SettingsFrom;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound) {
|
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound, EntityPlayer player) {
|
||||||
if (from == SettingsFrom.DISMANTLE_ITEM) {
|
if (from == SettingsFrom.DISMANTLE_ITEM) {
|
||||||
this.internalCurrentPower = compound.getDouble("internalCurrentPower");
|
this.internalCurrentPower = compound.getDouble("internalCurrentPower");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import appeng.fluids.util.AEFluidStack;
|
|||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.integration.Integrations;
|
import appeng.integration.Integrations;
|
||||||
import appeng.integration.modules.bogosorter.InventoryBogoSortModule;
|
import appeng.integration.modules.bogosorter.InventoryBogoSortModule;
|
||||||
|
import appeng.integration.modules.gregtech.ToolClass;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.GridNode;
|
import appeng.me.GridNode;
|
||||||
import appeng.me.helpers.AENetworkProxy;
|
import appeng.me.helpers.AENetworkProxy;
|
||||||
@@ -67,7 +68,6 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import gregtech.api.block.machines.BlockMachine;
|
import gregtech.api.block.machines.BlockMachine;
|
||||||
import gregtech.api.items.IToolItem;
|
|
||||||
import gregtech.api.metatileentity.MetaTileEntity;
|
import gregtech.api.metatileentity.MetaTileEntity;
|
||||||
import gregtech.api.util.GTUtility;
|
import gregtech.api.util.GTUtility;
|
||||||
import ic2.api.item.ICustomDamageItem;
|
import ic2.api.item.ICustomDamageItem;
|
||||||
@@ -126,7 +126,6 @@ import java.util.*;
|
|||||||
* @version rv2
|
* @version rv2
|
||||||
* @since rv0
|
* @since rv0
|
||||||
*/
|
*/
|
||||||
@Optional.Interface(iface = "gregtech.api.items.IToolItem", modid = "gregtech")
|
|
||||||
@Optional.Interface(iface = "ic2.api.item.ICustomDamageItem", modid = "IC2")
|
@Optional.Interface(iface = "ic2.api.item.ICustomDamageItem", modid = "IC2")
|
||||||
public class Platform {
|
public class Platform {
|
||||||
|
|
||||||
@@ -146,6 +145,7 @@ public class Platform {
|
|||||||
private static final ItemComparisonHelper ITEM_COMPARISON_HELPER = new ItemComparisonHelper();
|
private static final ItemComparisonHelper ITEM_COMPARISON_HELPER = new ItemComparisonHelper();
|
||||||
private static final P2PHelper P2P_HELPER = new P2PHelper();
|
private static final P2PHelper P2P_HELPER = new P2PHelper();
|
||||||
private static Method reflectGTgetMTE;
|
private static Method reflectGTgetMTE;
|
||||||
|
public static final boolean GTLoaded = isModLoaded("gregtech");
|
||||||
|
|
||||||
public static ItemComparisonHelper itemComparisons() {
|
public static ItemComparisonHelper itemComparisons() {
|
||||||
return ITEM_COMPARISON_HELPER;
|
return ITEM_COMPARISON_HELPER;
|
||||||
@@ -1416,7 +1416,7 @@ public class Platform {
|
|||||||
|
|
||||||
//consider methods below moving to a compability class
|
//consider methods below moving to a compability class
|
||||||
public static boolean isGTDamageableItem(Item item) {
|
public static boolean isGTDamageableItem(Item item) {
|
||||||
return (isModLoaded("gregtech") && item instanceof IToolItem);
|
return ((GTLoaded) && ToolClass.getGTToolClass().isAssignableFrom(item.getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MetaTileEntity getMetaTileEntity(IBlockAccess world, BlockPos pos) {
|
public static MetaTileEntity getMetaTileEntity(IBlockAccess world, BlockPos pos) {
|
||||||
|
|||||||
@@ -94,9 +94,4 @@ public class ItemListIgnoreCrafting<T extends IAEStack<T>> implements IItemList<
|
|||||||
public void resetStatus() {
|
public void resetStatus() {
|
||||||
this.target.resetStatus();
|
this.target.resetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemListIgnoreCrafting<T> clone() {
|
|
||||||
return new ItemListIgnoreCrafting<>(target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.core.Api;
|
import appeng.core.Api;
|
||||||
|
import appeng.integration.modules.gregtech.ToolClass;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import gregtech.api.items.IToolItem;
|
|
||||||
import ic2.api.item.ICustomDamageItem;
|
import ic2.api.item.ICustomDamageItem;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -326,7 +326,7 @@ public class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack {
|
|||||||
} else if (a.getItem().isDamageable()) {
|
} else if (a.getItem().isDamageable()) {
|
||||||
return a.getItemDamage() > 1 == b.getItemDamage() > 1;
|
return a.getItemDamage() > 1 == b.getItemDamage() > 1;
|
||||||
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
||||||
return ((IToolItem) a.getItem()).getItemDamage(a) > 1 == ((IToolItem) b.getItem()).getItemDamage(b) > 1;
|
return (ToolClass.getGTitemDamage(a) > 1 == ToolClass.getGTitemDamage(b) > 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float percentDamageOfA = 0;
|
float percentDamageOfA = 0;
|
||||||
@@ -338,8 +338,8 @@ public class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack {
|
|||||||
percentDamageOfA = (float) a.getItemDamage() / a.getMaxDamage();
|
percentDamageOfA = (float) a.getItemDamage() / a.getMaxDamage();
|
||||||
percentDamageOfB = (float) b.getItemDamage() / b.getMaxDamage();
|
percentDamageOfB = (float) b.getItemDamage() / b.getMaxDamage();
|
||||||
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
} else if (Platform.isGTDamageableItem(a.getItem())) {
|
||||||
percentDamageOfA = (float) ((IToolItem) a.getItem()).getItemDamage(a) / ((IToolItem) a.getItem()).getMaxItemDamage(a);
|
percentDamageOfA = (float) ToolClass.getGTitemDamage(a) / ToolClass.getGTMaxDamage(a);
|
||||||
percentDamageOfB = (float) ((IToolItem) b.getItem()).getItemDamage(b) / ((IToolItem) b.getItem()).getMaxItemDamage(b);
|
percentDamageOfB = (float) ToolClass.getGTitemDamage(b) / ToolClass.getGTMaxDamage(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
return percentDamageOfA > mode.breakPoint == percentDamageOfB > mode.breakPoint;
|
return percentDamageOfA > mode.breakPoint == percentDamageOfB > mode.breakPoint;
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ package appeng.util.item;
|
|||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.integration.modules.gregtech.ToolClass;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import gregtech.api.items.IToolItem;
|
|
||||||
import ic2.api.item.ICustomDamageItem;
|
import ic2.api.item.ICustomDamageItem;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectAVLTreeMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectAVLTreeMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap;
|
||||||
@@ -154,8 +154,8 @@ class FuzzyItemVariantList extends ItemVariantList {
|
|||||||
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
||||||
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
||||||
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
maxDamage = ((IToolItem) stack.getItem()).getMaxItemDamage(stack);
|
maxDamage = ToolClass.getGTMaxDamage(stack);
|
||||||
damage = ((IToolItem) stack.getItem()).getItemDamage(stack);
|
damage = ToolClass.getGTitemDamage(stack);
|
||||||
} else {
|
} else {
|
||||||
maxDamage = stack.getMaxDamage();
|
maxDamage = stack.getMaxDamage();
|
||||||
damage = stack.getItemDamage();
|
damage = stack.getItemDamage();
|
||||||
@@ -189,8 +189,8 @@ class FuzzyItemVariantList extends ItemVariantList {
|
|||||||
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
maxDamage = ((ICustomDamageItem) stack.getItem()).getMaxCustomDamage(stack);
|
||||||
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
damage = ((ICustomDamageItem) stack.getItem()).getCustomDamage(stack);
|
||||||
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
} else if (Platform.isGTDamageableItem(stack.getItem())) {
|
||||||
maxDamage = ((IToolItem) stack.getItem()).getMaxItemDamage(stack);
|
maxDamage = ToolClass.getGTMaxDamage(stack);
|
||||||
damage = ((IToolItem) stack.getItem()).getItemDamage(stack);
|
damage = ToolClass.getGTitemDamage(stack);
|
||||||
} else {
|
} else {
|
||||||
maxDamage = stack.getMaxDamage();
|
maxDamage = stack.getMaxDamage();
|
||||||
damage = stack.getItemDamage();
|
damage = stack.getItemDamage();
|
||||||
|
|||||||
@@ -140,14 +140,6 @@ public final class ItemList implements IItemList<IAEItemStack> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemList clone() {
|
|
||||||
ItemList list = new ItemList();
|
|
||||||
list.records.putAll(records);
|
|
||||||
list.version.set(version.get());
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemVariantList getOrCreateRecord(Item item) {
|
private ItemVariantList getOrCreateRecord(Item item) {
|
||||||
return this.records.computeIfAbsent(item, this::makeRecordMap);
|
return this.records.computeIfAbsent(item, this::makeRecordMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ tile.appliedenergistics2.sky_stone_slab.name=Sky Stone Slabs
|
|||||||
// Chat Messages
|
// Chat Messages
|
||||||
chat.appliedenergistics2.ChestCannotReadStorageCell=ME Chest cannot read storage cell.
|
chat.appliedenergistics2.ChestCannotReadStorageCell=ME Chest cannot read storage cell.
|
||||||
chat.appliedenergistics2.SettingCleared=Memory card cleared.
|
chat.appliedenergistics2.SettingCleared=Memory card cleared.
|
||||||
|
chat.appliedenergistics2.MissingPatternsToEncode=Not enough patterns to finish copying
|
||||||
chat.appliedenergistics2.OutOfRange=Wireless Out Of Range.
|
chat.appliedenergistics2.OutOfRange=Wireless Out Of Range.
|
||||||
chat.appliedenergistics2.InvalidMachine=Invalid Machine.
|
chat.appliedenergistics2.InvalidMachine=Invalid Machine.
|
||||||
chat.appliedenergistics2.LoadedSettings=Loaded device configuration from memory card.
|
chat.appliedenergistics2.LoadedSettings=Loaded device configuration from memory card.
|
||||||
@@ -262,10 +263,10 @@ gui.tooltips.appliedenergistics2.SubstitutionsOff=Substitutions Disabled
|
|||||||
gui.tooltips.appliedenergistics2.Encode=Encode Pattern
|
gui.tooltips.appliedenergistics2.Encode=Encode Pattern
|
||||||
gui.tooltips.appliedenergistics2.EncodeDescription=Write the entered pattern to the current encoded pattern, or to available blank pattern. Hold Shift to transfer directly to your inventory
|
gui.tooltips.appliedenergistics2.EncodeDescription=Write the entered pattern to the current encoded pattern, or to available blank pattern. Hold Shift to transfer directly to your inventory
|
||||||
gui.tooltips.appliedenergistics2.FuzzyMode=Fuzzy Comparison
|
gui.tooltips.appliedenergistics2.FuzzyMode=Fuzzy Comparison
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_25=Split Damage at 25%
|
gui.tooltips.appliedenergistics2.FZPercent_25=Split Damage at §a25%§r
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_50=Split Damage at 50%
|
gui.tooltips.appliedenergistics2.FZPercent_50=Split Damage at §e50%§r
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_75=Split Damage at 75%
|
gui.tooltips.appliedenergistics2.FZPercent_75=Split Damage at §675%§r
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_99=Split Damage at 99%
|
gui.tooltips.appliedenergistics2.FZPercent_99=Split Damage at §499%§r
|
||||||
gui.tooltips.appliedenergistics2.SortOrder=Sort Order
|
gui.tooltips.appliedenergistics2.SortOrder=Sort Order
|
||||||
gui.tooltips.appliedenergistics2.SortBy=Sort By
|
gui.tooltips.appliedenergistics2.SortBy=Sort By
|
||||||
gui.tooltips.appliedenergistics2.FZIgnoreAll=Match Any
|
gui.tooltips.appliedenergistics2.FZIgnoreAll=Match Any
|
||||||
@@ -289,8 +290,8 @@ gui.tooltips.appliedenergistics2.TrashController=Deletion via Shift / Space Clic
|
|||||||
gui.tooltips.appliedenergistics2.InterfaceBlockingMode=Blocking Mode
|
gui.tooltips.appliedenergistics2.InterfaceBlockingMode=Blocking Mode
|
||||||
gui.tooltips.appliedenergistics2.InterfaceCraftingMode=Crafting Mode
|
gui.tooltips.appliedenergistics2.InterfaceCraftingMode=Crafting Mode
|
||||||
gui.tooltips.appliedenergistics2.Trash=Destroy Items
|
gui.tooltips.appliedenergistics2.Trash=Destroy Items
|
||||||
gui.tooltips.appliedenergistics2.MatterBalls=Condense Into Matter Balls\n%s per item
|
gui.tooltips.appliedenergistics2.MatterBalls=Condense Into Matter Balls\n§a%s§r per item
|
||||||
gui.tooltips.appliedenergistics2.Singularity=Condense Into Singularities\n%s per item
|
gui.tooltips.appliedenergistics2.Singularity=Condense Into Singularities\n§a%s§r per item
|
||||||
gui.tooltips.appliedenergistics2.Read=Extract Only
|
gui.tooltips.appliedenergistics2.Read=Extract Only
|
||||||
gui.tooltips.appliedenergistics2.Write=Insert Only
|
gui.tooltips.appliedenergistics2.Write=Insert Only
|
||||||
gui.tooltips.appliedenergistics2.ReadWrite=Bi-Directional
|
gui.tooltips.appliedenergistics2.ReadWrite=Bi-Directional
|
||||||
@@ -409,16 +410,16 @@ waila.appliedenergistics2.Locked=Locked
|
|||||||
waila.appliedenergistics2.Unlocked=Unlocked
|
waila.appliedenergistics2.Unlocked=Unlocked
|
||||||
waila.appliedenergistics2.Showing=Showing
|
waila.appliedenergistics2.Showing=Showing
|
||||||
waila.appliedenergistics2.Contains=Contains
|
waila.appliedenergistics2.Contains=Contains
|
||||||
waila.appliedenergistics2.Channels=%1$d of %2$d Channels
|
waila.appliedenergistics2.Channels=§2%1$d§r of §4%2$d§r Channels
|
||||||
waila.appliedenergistics2.P2PUnlinked=Unlinked
|
waila.appliedenergistics2.P2PUnlinked=Unlinked
|
||||||
waila.appliedenergistics2.p2p_input_one_output=Linked (Input Side) - 1 Output
|
waila.appliedenergistics2.p2p_input_one_output=Linked (Input Side) - 1 Output
|
||||||
waila.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - %d Outputs
|
waila.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - §4%d§r Outputs
|
||||||
waila.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 Input
|
waila.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 Input
|
||||||
waila.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - %d Inputs
|
waila.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - §2%d§r Inputs
|
||||||
waila.appliedenergistics2.P2POutput=Linked (Output Side)
|
waila.appliedenergistics2.P2POutput=Linked (Output Side)
|
||||||
|
|
||||||
// TheOneProbe
|
// TheOneProbe
|
||||||
theoneprobe.appliedenergistics2.crafting=Crafting: %1$s
|
theoneprobe.appliedenergistics2.crafting=Crafting: §2%1$s§r
|
||||||
theoneprobe.appliedenergistics2.device_online=Device Online
|
theoneprobe.appliedenergistics2.device_online=Device Online
|
||||||
theoneprobe.appliedenergistics2.device_offline=Device Offline
|
theoneprobe.appliedenergistics2.device_offline=Device Offline
|
||||||
theoneprobe.appliedenergistics2.device_missing_channel=Device Missing Channel
|
theoneprobe.appliedenergistics2.device_missing_channel=Device Missing Channel
|
||||||
@@ -426,15 +427,15 @@ theoneprobe.appliedenergistics2.locked=Locked
|
|||||||
theoneprobe.appliedenergistics2.unlocked=Unlocked
|
theoneprobe.appliedenergistics2.unlocked=Unlocked
|
||||||
theoneprobe.appliedenergistics2.showing=Showing
|
theoneprobe.appliedenergistics2.showing=Showing
|
||||||
theoneprobe.appliedenergistics2.contains=Contains
|
theoneprobe.appliedenergistics2.contains=Contains
|
||||||
theoneprobe.appliedenergistics2.channels=%1$d of %2$d Channels
|
theoneprobe.appliedenergistics2.channels=§2%1$d§r of §4%2$d§r Channels
|
||||||
theoneprobe.appliedenergistics2.p2p_unlinked=Unlinked
|
theoneprobe.appliedenergistics2.p2p_unlinked=Unlinked
|
||||||
theoneprobe.appliedenergistics2.p2p_input_one_output=Linked (Input Side) - 1 Output
|
theoneprobe.appliedenergistics2.p2p_input_one_output=Linked (Input Side) - 1 Output
|
||||||
theoneprobe.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - %d Outputs
|
theoneprobe.appliedenergistics2.p2p_input_many_outputs=Linked (Input Side) - §4%d§r Outputs
|
||||||
theoneprobe.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 Input
|
theoneprobe.appliedenergistics2.p2p_output_one_input=Linked (Output Side) - 1 Input
|
||||||
theoneprobe.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - %d Inputs
|
theoneprobe.appliedenergistics2.p2p_output_many_inputs=Linked (Output Side) - §2%d§r Inputs
|
||||||
theoneprobe.appliedenergistics2.p2p_output=Linked (Output Side)
|
theoneprobe.appliedenergistics2.p2p_output=Linked (Output Side)
|
||||||
theoneprobe.appliedenergistics2.p2p_frequency=Frequency: %1$s
|
theoneprobe.appliedenergistics2.p2p_frequency=Frequency: §5%1$s§r
|
||||||
theoneprobe.appliedenergistics2.stored_energy=%1$d / %2$d
|
theoneprobe.appliedenergistics2.stored_energy=§2%1$d§к / §4%2$d§r
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
item.appliedenergistics2.storage_cell_1k.name=§61k§r ME Storage Cell
|
item.appliedenergistics2.storage_cell_1k.name=§61k§r ME Storage Cell
|
||||||
@@ -551,8 +552,8 @@ item.appliedenergistics2.multi_part.inverted_toggle_bus.name=ME Inverted Toggle
|
|||||||
item.appliedenergistics2.multi_part.toggle_bus.name=ME Toggle Bus
|
item.appliedenergistics2.multi_part.toggle_bus.name=ME Toggle Bus
|
||||||
item.appliedenergistics2.multi_part.crafting_monitor.name=ME Crafting Monitor
|
item.appliedenergistics2.multi_part.crafting_monitor.name=ME Crafting Monitor
|
||||||
item.appliedenergistics2.multi_part.interface_terminal.name=ME Interface Terminal
|
item.appliedenergistics2.multi_part.interface_terminal.name=ME Interface Terminal
|
||||||
item.appliedenergistics2.multi_part.interface_configuration_terminal.name=ME Configuration Interface Terminal
|
item.appliedenergistics2.multi_part.interface_configuration_terminal.name=ME Interface Configuration Terminal
|
||||||
item.appliedenergistics2.multi_part.fluid_interface_configuration_terminal.name=ME Configuration Fluid Interface Terminal
|
item.appliedenergistics2.multi_part.fluid_interface_configuration_terminal.name=ME Fluid Interface Configuration Terminal
|
||||||
item.appliedenergistics2.multi_part.fluid_terminal.name=ME Fluid Terminal
|
item.appliedenergistics2.multi_part.fluid_terminal.name=ME Fluid Terminal
|
||||||
item.appliedenergistics2.multi_part.invalid_type.name=Disabled Item
|
item.appliedenergistics2.multi_part.invalid_type.name=Disabled Item
|
||||||
|
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
tile.appliedenergistics2.cable_bus.name=AE2 кабель и/или шина
|
tile.appliedenergistics2.cable_bus.name=AE2 кабель и/или шина
|
||||||
tile.appliedenergistics2.cell_workbench.name=Верстак для ячеек
|
tile.appliedenergistics2.cell_workbench.name=Верстак для ячеек
|
||||||
tile.appliedenergistics2.charger.name=Зарядник
|
tile.appliedenergistics2.charger.name=Зарядник
|
||||||
tile.appliedenergistics2.chest.name=МЭ сундук
|
tile.appliedenergistics2.chest.name=МЭ Сундук
|
||||||
tile.appliedenergistics2.condenser.name=Конденсатор материи
|
tile.appliedenergistics2.condenser.name=Конденсатор материи
|
||||||
tile.appliedenergistics2.controller.name=МЭ контроллер
|
tile.appliedenergistics2.controller.name=МЭ Контроллер
|
||||||
tile.appliedenergistics2.crank.name=Деревянная рукоятка
|
tile.appliedenergistics2.crank.name=Деревянная рукоятка
|
||||||
tile.appliedenergistics2.creative_energy_cell.name=Творческая энергетическая ячейка
|
tile.appliedenergistics2.creative_energy_cell.name=Творческая энергетическая ячейка
|
||||||
tile.appliedenergistics2.dense_energy_cell.name=Плотная энергетическая ячейка
|
tile.appliedenergistics2.dense_energy_cell.name=Плотная энергетическая ячейка
|
||||||
tile.appliedenergistics2.energy_cell.name=Энергетическая ячейка
|
tile.appliedenergistics2.energy_cell.name=Энергетическая ячейка
|
||||||
tile.appliedenergistics2.drive.name=МЭ накопитель
|
tile.appliedenergistics2.drive.name=МЭ Накопитель
|
||||||
tile.appliedenergistics2.energy_acceptor.name=Приёмщик энергии
|
tile.appliedenergistics2.energy_acceptor.name=Приёмщик энергии
|
||||||
tile.appliedenergistics2.grindstone.name=Кварцевый дробитель
|
tile.appliedenergistics2.grindstone.name=Кварцевый дробитель
|
||||||
tile.appliedenergistics2.matrix_frame.name=Каркас матрицы
|
tile.appliedenergistics2.matrix_frame.name=Каркас матрицы
|
||||||
tile.appliedenergistics2.io_port.name=МЭ порт ввода\вывода
|
tile.appliedenergistics2.io_port.name=МЭ Порт ввода\вывода
|
||||||
tile.appliedenergistics2.inscriber.name=Высекатель
|
tile.appliedenergistics2.inscriber.name=Высекатель
|
||||||
tile.appliedenergistics2.interface.name=МЭ интерфейс
|
tile.appliedenergistics2.interface.name=МЭ Интерфейс
|
||||||
tile.appliedenergistics2.fluid_interface.name=МЭ жидкостный интерфейс
|
tile.appliedenergistics2.fluid_interface.name=МЭ Жидкостный интерфейс
|
||||||
tile.appliedenergistics2.quantum_link.name=МЭ камера квантовой связи
|
tile.appliedenergistics2.quantum_link.name=МЭ Камера квантовой связи
|
||||||
tile.appliedenergistics2.quantum_ring.name=МЭ квантовое кольцо
|
tile.appliedenergistics2.quantum_ring.name=МЭ Квантовое кольцо
|
||||||
tile.appliedenergistics2.fluix_block.name=Изменчивый блок
|
tile.appliedenergistics2.fluix_block.name=Изменчивый блок
|
||||||
tile.appliedenergistics2.quartz_block.name=Блок истинного кварца
|
tile.appliedenergistics2.quartz_block.name=Блок истинного кварца
|
||||||
tile.appliedenergistics2.chiseled_quartz_block.name=Резной блок истинного кварца
|
tile.appliedenergistics2.chiseled_quartz_block.name=Резной блок истинного кварца
|
||||||
@@ -31,10 +31,10 @@ tile.appliedenergistics2.spatial_io_port.name=Пространственный
|
|||||||
tile.appliedenergistics2.spatial_pylon.name=Пространственный пилон
|
tile.appliedenergistics2.spatial_pylon.name=Пространственный пилон
|
||||||
tile.appliedenergistics2.tiny_tnt.name=Маленький динамит
|
tile.appliedenergistics2.tiny_tnt.name=Маленький динамит
|
||||||
tile.appliedenergistics2.vibration_chamber.name=Вибрационная камера
|
tile.appliedenergistics2.vibration_chamber.name=Вибрационная камера
|
||||||
tile.appliedenergistics2.wireless_access_point.name=МЭ беспроводная точка доступа
|
tile.appliedenergistics2.wireless_access_point.name=МЭ Беспроводная точка доступа
|
||||||
tile.appliedenergistics2.quartz_ore.name=Руда истинного кварца
|
tile.appliedenergistics2.quartz_ore.name=Руда истинного кварца
|
||||||
tile.appliedenergistics2.charged_quartz_ore.name=Заряженная руда истинного кварца
|
tile.appliedenergistics2.charged_quartz_ore.name=Заряженная руда истинного кварца
|
||||||
tile.appliedenergistics2.security_station.name=МЭ терминал безопасности
|
tile.appliedenergistics2.security_station.name=МЭ Терминал безопасности
|
||||||
tile.appliedenergistics2.quartz_growth_accelerator.name=Ускоритель роста кристаллов
|
tile.appliedenergistics2.quartz_growth_accelerator.name=Ускоритель роста кристаллов
|
||||||
tile.appliedenergistics2.sky_stone_block.name=Небесный камень
|
tile.appliedenergistics2.sky_stone_block.name=Небесный камень
|
||||||
tile.appliedenergistics2.smooth_sky_stone_block.name=Блок небесного камня
|
tile.appliedenergistics2.smooth_sky_stone_block.name=Блок небесного камня
|
||||||
@@ -73,8 +73,9 @@ tile.appliedenergistics2.sky_stone_small_brick_slab.name=Плита из мал
|
|||||||
tile.appliedenergistics2.sky_stone_slab.name=Плита из небесного камня
|
tile.appliedenergistics2.sky_stone_slab.name=Плита из небесного камня
|
||||||
|
|
||||||
// Chat Messages
|
// Chat Messages
|
||||||
chat.appliedenergistics2.ChestCannotReadStorageCell=МЭ сундук не может прочитать ячейку хранения.
|
chat.appliedenergistics2.ChestCannotReadStorageCell=МЭ Сундук не может прочитать ячейку хранения.
|
||||||
chat.appliedenergistics2.SettingCleared=Карта памяти очищена.
|
chat.appliedenergistics2.SettingCleared=Карта памяти очищена.
|
||||||
|
chat.appliedenergistics2.MissingPatternsToEncode=Недостаточно шаблонов для завершения копирования.
|
||||||
chat.appliedenergistics2.OutOfRange=Беспроводная сеть вне зоны действия.
|
chat.appliedenergistics2.OutOfRange=Беспроводная сеть вне зоны действия.
|
||||||
chat.appliedenergistics2.InvalidMachine=Неподходящий механизм.
|
chat.appliedenergistics2.InvalidMachine=Неподходящий механизм.
|
||||||
chat.appliedenergistics2.LoadedSettings=Настройки успешно загружены.
|
chat.appliedenergistics2.LoadedSettings=Настройки успешно загружены.
|
||||||
@@ -168,6 +169,8 @@ gui.appliedenergistics2.StoredFluids=Хранящиеся жидкости
|
|||||||
gui.appliedenergistics2.Terminal=Терминал
|
gui.appliedenergistics2.Terminal=Терминал
|
||||||
gui.appliedenergistics2.InterfaceTerminal=Терминал интерфейсов
|
gui.appliedenergistics2.InterfaceTerminal=Терминал интерфейсов
|
||||||
gui.appliedenergistics2.InterfaceTerminalHint=Показать или спрятать в терминале интерфейсов.
|
gui.appliedenergistics2.InterfaceTerminalHint=Показать или спрятать в терминале интерфейсов.
|
||||||
|
gui.appliedenergistics2.InterfaceConfigurationTerminal=Терминал конфигурации интерфейса
|
||||||
|
gui.appliedenergistics2.FluidInterfaceConfigurationTerminal=Терминал жидкостной конфигурации интерфейсов
|
||||||
gui.appliedenergistics2.FormationPlane=Плоскость формирования
|
gui.appliedenergistics2.FormationPlane=Плоскость формирования
|
||||||
gui.appliedenergistics2.FluidFormationPlane=Плоскость формирования жидкости
|
gui.appliedenergistics2.FluidFormationPlane=Плоскость формирования жидкости
|
||||||
gui.appliedenergistics2.VibrationChamber=Вибрационная камера
|
gui.appliedenergistics2.VibrationChamber=Вибрационная камера
|
||||||
@@ -175,7 +178,6 @@ gui.appliedenergistics2.NetworkDetails=Подробности сети
|
|||||||
gui.appliedenergistics2.StorageCells=МЭ Ячейки хранения
|
gui.appliedenergistics2.StorageCells=МЭ Ячейки хранения
|
||||||
gui.appliedenergistics2.IOBuses=МЭ Шина импорта\экспорта
|
gui.appliedenergistics2.IOBuses=МЭ Шина импорта\экспорта
|
||||||
gui.appliedenergistics2.IOBusesFluids=МЭ Жидкостная шина импорта\экспорта
|
gui.appliedenergistics2.IOBusesFluids=МЭ Жидкостная шина импорта\экспорта
|
||||||
gui.appliedenergistics2.IOBusesFluids=МЭ Шина импорта/экспорта жидкости
|
|
||||||
gui.appliedenergistics2.Stores=Хранит
|
gui.appliedenergistics2.Stores=Хранит
|
||||||
gui.appliedenergistics2.BytesUsed=Байт использовано
|
gui.appliedenergistics2.BytesUsed=Байт использовано
|
||||||
gui.appliedenergistics2.Types=Типов
|
gui.appliedenergistics2.Types=Типов
|
||||||
@@ -220,7 +222,7 @@ gui.appliedenergistics2.Crafting=Крафт
|
|||||||
gui.appliedenergistics2.Scheduled=Запланировано
|
gui.appliedenergistics2.Scheduled=Запланировано
|
||||||
gui.appliedenergistics2.CraftingStatus=Статус крафта
|
gui.appliedenergistics2.CraftingStatus=Статус крафта
|
||||||
gui.appliedenergistics2.FromStorage=Доступно
|
gui.appliedenergistics2.FromStorage=Доступно
|
||||||
gui.appliedenergistics2.ToCraft=Необходимо скрафтить
|
gui.appliedenergistics2.ToCraft=Нужно еще
|
||||||
gui.appliedenergistics2.CraftingPlan=План крафта
|
gui.appliedenergistics2.CraftingPlan=План крафта
|
||||||
gui.appliedenergistics2.Automatic=Автоматически
|
gui.appliedenergistics2.Automatic=Автоматически
|
||||||
gui.appliedenergistics2.Start=Старт
|
gui.appliedenergistics2.Start=Старт
|
||||||
@@ -261,10 +263,10 @@ gui.tooltips.appliedenergistics2.SubstitutionsOff=Замещения выклю
|
|||||||
gui.tooltips.appliedenergistics2.Encode=Закодировать шаблон
|
gui.tooltips.appliedenergistics2.Encode=Закодировать шаблон
|
||||||
gui.tooltips.appliedenergistics2.EncodeDescription=Запишите введённый шаблон на текущий закодированный шаблон, или на доступный чистый шаблон.
|
gui.tooltips.appliedenergistics2.EncodeDescription=Запишите введённый шаблон на текущий закодированный шаблон, или на доступный чистый шаблон.
|
||||||
gui.tooltips.appliedenergistics2.FuzzyMode=Нечёткое сравнение
|
gui.tooltips.appliedenergistics2.FuzzyMode=Нечёткое сравнение
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_25=Разделять урон с 25%
|
gui.tooltips.appliedenergistics2.FZPercent_25=Разделять урон с §a25%§r
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_50=Разделять урон с 50%
|
gui.tooltips.appliedenergistics2.FZPercent_50=Разделять урон с §e50%§r
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_75=Разделять урон с 75%
|
gui.tooltips.appliedenergistics2.FZPercent_75=Разделять урон с §675%§r
|
||||||
gui.tooltips.appliedenergistics2.FZPercent_99=Разделять урон с 99%
|
gui.tooltips.appliedenergistics2.FZPercent_99=Разделять урон с §499%§r
|
||||||
gui.tooltips.appliedenergistics2.SortOrder=Порядок сортировки
|
gui.tooltips.appliedenergistics2.SortOrder=Порядок сортировки
|
||||||
gui.tooltips.appliedenergistics2.SortBy=Сортировать по
|
gui.tooltips.appliedenergistics2.SortBy=Сортировать по
|
||||||
gui.tooltips.appliedenergistics2.FZIgnoreAll=Любое соответствие
|
gui.tooltips.appliedenergistics2.FZIgnoreAll=Любое соответствие
|
||||||
@@ -288,8 +290,8 @@ gui.tooltips.appliedenergistics2.TrashController=Удаление по нажа
|
|||||||
gui.tooltips.appliedenergistics2.InterfaceBlockingMode=Блокирующий режим
|
gui.tooltips.appliedenergistics2.InterfaceBlockingMode=Блокирующий режим
|
||||||
gui.tooltips.appliedenergistics2.InterfaceCraftingMode=Режим крафта
|
gui.tooltips.appliedenergistics2.InterfaceCraftingMode=Режим крафта
|
||||||
gui.tooltips.appliedenergistics2.Trash=Уничтожить предметы
|
gui.tooltips.appliedenergistics2.Trash=Уничтожить предметы
|
||||||
gui.tooltips.appliedenergistics2.MatterBalls=Конденсировать в шары материи\n%s за предмет
|
gui.tooltips.appliedenergistics2.MatterBalls=Конденсировать в шары материи\n§a%s§r за предмет
|
||||||
gui.tooltips.appliedenergistics2.Singularity=Конденсировать в сингулярности\n%s за предмет
|
gui.tooltips.appliedenergistics2.Singularity=Конденсировать в сингулярности\n§a%s§r за предмет
|
||||||
gui.tooltips.appliedenergistics2.Read=Только извлекать
|
gui.tooltips.appliedenergistics2.Read=Только извлекать
|
||||||
gui.tooltips.appliedenergistics2.Write=Только вкладывать
|
gui.tooltips.appliedenergistics2.Write=Только вкладывать
|
||||||
gui.tooltips.appliedenergistics2.ReadWrite=Двухсторонний
|
gui.tooltips.appliedenergistics2.ReadWrite=Двухсторонний
|
||||||
@@ -408,16 +410,16 @@ waila.appliedenergistics2.Locked=Заблокировано
|
|||||||
waila.appliedenergistics2.Unlocked=Разблокировано
|
waila.appliedenergistics2.Unlocked=Разблокировано
|
||||||
waila.appliedenergistics2.Showing=Показывает
|
waila.appliedenergistics2.Showing=Показывает
|
||||||
waila.appliedenergistics2.Contains=Содержит
|
waila.appliedenergistics2.Contains=Содержит
|
||||||
waila.appliedenergistics2.Channels=Каналы: %1$d из %2$d
|
waila.appliedenergistics2.Channels=Каналы: §2%1$d§r из §4%2$d§r
|
||||||
waila.appliedenergistics2.P2PUnlinked=Не связанный
|
waila.appliedenergistics2.P2PUnlinked=Не связанный
|
||||||
waila.appliedenergistics2.p2p_input_one_output=Связанный (Сторона ввода)
|
waila.appliedenergistics2.p2p_input_one_output=Связанный (Сторона входа) - 1 Выход
|
||||||
waila.appliedenergistics2.p2p_input_many_outputs=Связанный (Сторона ввода) - %d выводов
|
waila.appliedenergistics2.p2p_input_many_outputs=Связанный (Сторона входа) - §4%d§r Выходов
|
||||||
waila.appliedenergistics2.p2p_output_one_input=Связанный (Сторона вывода)
|
waila.appliedenergistics2.p2p_output_one_input=Связанный (Сторона выхода) - 1 Вход
|
||||||
waila.appliedenergistics2.p2p_output_many_inputs=Связанный (Сторона вывода) - %d выводов
|
waila.appliedenergistics2.p2p_output_many_inputs=Связанный (Сторона выхода) - §2%d§r Входов
|
||||||
waila.appliedenergistics2.P2POutput=Связанный (Сторона вывода)
|
waila.appliedenergistics2.P2POutput=Связанный (Сторона выхода)
|
||||||
|
|
||||||
// TheOneProbe
|
// TheOneProbe
|
||||||
theoneprobe.appliedenergistics2.crafting=Создается: %1$s
|
theoneprobe.appliedenergistics2.crafting=Создается: §2%1$s§r
|
||||||
theoneprobe.appliedenergistics2.device_online=Устройство включено
|
theoneprobe.appliedenergistics2.device_online=Устройство включено
|
||||||
theoneprobe.appliedenergistics2.device_offline=Устройство выключено
|
theoneprobe.appliedenergistics2.device_offline=Устройство выключено
|
||||||
theoneprobe.appliedenergistics2.device_missing_channel=У устройства нет канала.
|
theoneprobe.appliedenergistics2.device_missing_channel=У устройства нет канала.
|
||||||
@@ -425,15 +427,15 @@ theoneprobe.appliedenergistics2.locked=Заблокировано
|
|||||||
theoneprobe.appliedenergistics2.unlocked=Разблокировано
|
theoneprobe.appliedenergistics2.unlocked=Разблокировано
|
||||||
theoneprobe.appliedenergistics2.showing=Показывает
|
theoneprobe.appliedenergistics2.showing=Показывает
|
||||||
theoneprobe.appliedenergistics2.contains=Содержит
|
theoneprobe.appliedenergistics2.contains=Содержит
|
||||||
theoneprobe.appliedenergistics2.channels=Каналы: %1$d из %2$d
|
theoneprobe.appliedenergistics2.channels=Каналы: §2%1$d§r из §4%2$d§r
|
||||||
theoneprobe.appliedenergistics2.p2p_unlinked=Не связанный
|
theoneprobe.appliedenergistics2.p2p_unlinked=Не связанный
|
||||||
theoneprobe.appliedenergistics2.p2p_input_one_output=Связанный (сторона ввода)
|
theoneprobe.appliedenergistics2.p2p_input_one_output=Связанный (Сторона входа) - 1 Выход
|
||||||
theoneprobe.appliedenergistics2.p2p_input_many_outputs=Связанный (сторона ввода) - %d выводов
|
theoneprobe.appliedenergistics2.p2p_input_many_outputs=Связанный (Сторона входа) - §4%d§r Выходов
|
||||||
theoneprobe.appliedenergistics2.p2p_output_one_input=Связанный (Сторона вывода)
|
theoneprobe.appliedenergistics2.p2p_output_one_input=Связанный (Сторона выхода) - 1 Вход
|
||||||
theoneprobe.appliedenergistics2.p2p_output_many_inputs=Связанный (Сторона вывода) - %d выводов
|
theoneprobe.appliedenergistics2.p2p_output_many_inputs=Связанный (Сторона выхода) - §2%d§r Входов
|
||||||
theoneprobe.appliedenergistics2.p2p_output=Связанный (Сторона вывода)
|
theoneprobe.appliedenergistics2.p2p_output=Связанный (Сторона выхода)
|
||||||
theoneprobe.appliedenergistics2.p2p_frequency=Частота: %1$s
|
theoneprobe.appliedenergistics2.p2p_frequency=Частота: §5%1$s§r
|
||||||
theoneprobe.appliedenergistics2.stored_energy=%1$d / %2$d
|
theoneprobe.appliedenergistics2.stored_energy=§2%1$d§к / §4%2$d§r
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
item.appliedenergistics2.storage_cell_1k.name=§61k§r МЭ Ячейка хранения
|
item.appliedenergistics2.storage_cell_1k.name=§61k§r МЭ Ячейка хранения
|
||||||
@@ -444,7 +446,7 @@ item.appliedenergistics2.fluid_storage_cell_1k.name=§61k§r МЭ Жидкост
|
|||||||
item.appliedenergistics2.fluid_storage_cell_4k.name=§e4k§r МЭ Жидкостная ячейка хранения
|
item.appliedenergistics2.fluid_storage_cell_4k.name=§e4k§r МЭ Жидкостная ячейка хранения
|
||||||
item.appliedenergistics2.fluid_storage_cell_16k.name=§a16k§r МЭ Жидкостная ячейка хранения
|
item.appliedenergistics2.fluid_storage_cell_16k.name=§a16k§r МЭ Жидкостная ячейка хранения
|
||||||
item.appliedenergistics2.fluid_storage_cell_64k.name=§b64k§r МЭ Жидкостная ячейка хранения
|
item.appliedenergistics2.fluid_storage_cell_64k.name=§b64k§r МЭ Жидкостная ячейка хранения
|
||||||
item.appliedenergistics2.creative_storage_cell.name=Творческая МЭ ячейка хранения
|
item.appliedenergistics2.creative_storage_cell.name=Творческая МЭ Ячейка хранения
|
||||||
item.appliedenergistics2.encoded_pattern.name=Кодированный шаблон
|
item.appliedenergistics2.encoded_pattern.name=Кодированный шаблон
|
||||||
item.appliedenergistics2.view_cell.name=Ячейка представления
|
item.appliedenergistics2.view_cell.name=Ячейка представления
|
||||||
item.appliedenergistics2.facade.name=Кабельный фасад
|
item.appliedenergistics2.facade.name=Кабельный фасад
|
||||||
@@ -535,12 +537,12 @@ item.appliedenergistics2.multi_part.fluid_formation_plane.name=МЭ Жидкос
|
|||||||
item.appliedenergistics2.multi_part.import_bus.name=МЭ Шина импорта
|
item.appliedenergistics2.multi_part.import_bus.name=МЭ Шина импорта
|
||||||
item.appliedenergistics2.multi_part.fluid_import_bus.name=МЭ Жидкостная шина импорта
|
item.appliedenergistics2.multi_part.fluid_import_bus.name=МЭ Жидкостная шина импорта
|
||||||
item.appliedenergistics2.multi_part.interface.name=МЭ Интерфейс
|
item.appliedenergistics2.multi_part.interface.name=МЭ Интерфейс
|
||||||
item.appliedenergistics2.multi_part.fluid_interface.name=МЭ Интерфейс жидкостей
|
item.appliedenergistics2.multi_part.fluid_interface.name=МЭ Жидкостый нтерфейс
|
||||||
item.appliedenergistics2.multi_part.level_emitter.name=МЭ Излучатель уровня
|
item.appliedenergistics2.multi_part.level_emitter.name=МЭ Излучатель уровня
|
||||||
item.appliedenergistics2.multi_part.fluid_level_emitter.name=МЭ Излучатель уровня
|
item.appliedenergistics2.multi_part.fluid_level_emitter.name=МЭ Излучатель уровня
|
||||||
item.appliedenergistics2.multi_part.p2p_tunnel.name=Туннель точка-точка
|
item.appliedenergistics2.multi_part.p2p_tunnel.name=Туннель точка-точка
|
||||||
item.appliedenergistics2.multi_part.pattern_terminal.name=МЭ Терминал шаблонов
|
item.appliedenergistics2.multi_part.pattern_terminal.name=МЭ Терминал шаблонов
|
||||||
item.appliedenergistics2.multi_part.expanded_processing_pattern_terminal.name=ME терминал расширенной схемы обработки
|
item.appliedenergistics2.multi_part.expanded_processing_pattern_terminal.name=ME Терминал расширенных шаблонов
|
||||||
item.appliedenergistics2.multi_part.quartz_fiber.name=Кварцевое оптическое волокно
|
item.appliedenergistics2.multi_part.quartz_fiber.name=Кварцевое оптическое волокно
|
||||||
item.appliedenergistics2.multi_part.storage_bus.name=МЭ Шина хранения
|
item.appliedenergistics2.multi_part.storage_bus.name=МЭ Шина хранения
|
||||||
item.appliedenergistics2.multi_part.oredict_storage_bus.name=МЭ Шина хранения по словарю руд
|
item.appliedenergistics2.multi_part.oredict_storage_bus.name=МЭ Шина хранения по словарю руд
|
||||||
@@ -550,6 +552,8 @@ item.appliedenergistics2.multi_part.inverted_toggle_bus.name=МЭ Инверти
|
|||||||
item.appliedenergistics2.multi_part.toggle_bus.name=МЭ Шина переключения
|
item.appliedenergistics2.multi_part.toggle_bus.name=МЭ Шина переключения
|
||||||
item.appliedenergistics2.multi_part.crafting_monitor.name=МЭ Монитор крафта
|
item.appliedenergistics2.multi_part.crafting_monitor.name=МЭ Монитор крафта
|
||||||
item.appliedenergistics2.multi_part.interface_terminal.name=МЭ Терминал интерфейсов
|
item.appliedenergistics2.multi_part.interface_terminal.name=МЭ Терминал интерфейсов
|
||||||
|
item.appliedenergistics2.multi_part.interface_configuration_terminal.name=МЭ Терминал конфигурации интерфейсов
|
||||||
|
item.appliedenergistics2.multi_part.fluid_interface_configuration_terminal.name=МЭ Терминал жидкостной конфигурации интерфейсов
|
||||||
item.appliedenergistics2.multi_part.fluid_terminal.name=МЭ Жидкостный терминал
|
item.appliedenergistics2.multi_part.fluid_terminal.name=МЭ Жидкостный терминал
|
||||||
item.appliedenergistics2.multi_part.invalid_type.name=Отключенный предмет
|
item.appliedenergistics2.multi_part.invalid_type.name=Отключенный предмет
|
||||||
|
|
||||||
@@ -623,7 +627,7 @@ achievement.ae2.Charger.desc=Сделайте зарядник!
|
|||||||
achievement.ae2.CrystalGrowthAccelerator=Ускоритель - ещё мягко сказано!
|
achievement.ae2.CrystalGrowthAccelerator=Ускоритель - ещё мягко сказано!
|
||||||
achievement.ae2.CrystalGrowthAccelerator.desc=Сделайте ускоритель роста кристаллов!
|
achievement.ae2.CrystalGrowthAccelerator.desc=Сделайте ускоритель роста кристаллов!
|
||||||
achievement.ae2.GlassCable=Изменчивое энергетическое соединение!
|
achievement.ae2.GlassCable=Изменчивое энергетическое соединение!
|
||||||
achievement.ae2.GlassCable.desc=Сделайте МЭ стеклянный кабель!
|
achievement.ae2.GlassCable.desc=Сделайте МЭ Стеклянный кабель!
|
||||||
achievement.ae2.Networking1=Сетевое подмастерье!
|
achievement.ae2.Networking1=Сетевое подмастерье!
|
||||||
achievement.ae2.Networking1.desc=Достигните 8 каналов, подключая устройства к сети!
|
achievement.ae2.Networking1.desc=Достигните 8 каналов, подключая устройства к сети!
|
||||||
achievement.ae2.Controller=Коммутатор сети!
|
achievement.ae2.Controller=Коммутатор сети!
|
||||||
@@ -650,8 +654,8 @@ achievement.ae2.QNB=Квантовое туннелирование!
|
|||||||
achievement.ae2.QNB.desc=Сделайте квантовое соединение!
|
achievement.ae2.QNB.desc=Сделайте квантовое соединение!
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
stat.ae2.ItemsInserted=Предметов добавлено в МЭ хранилище
|
stat.ae2.ItemsInserted=Предметов добавлено в МЭ Хранилище
|
||||||
stat.ae2.ItemsExtracted=Предметов извлечено из МЭ хранилища
|
stat.ae2.ItemsExtracted=Предметов извлечено из МЭ Хранилища
|
||||||
stat.ae2.TurnedCranks=Сломано рукояток
|
stat.ae2.TurnedCranks=Сломано рукояток
|
||||||
|
|
||||||
//Keys
|
//Keys
|
||||||
|
|||||||
@@ -1,12 +1,122 @@
|
|||||||
{
|
{
|
||||||
"parent": "block/cube",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "appliedenergistics2:blocks/chest/side",
|
"up": "appliedenergistics2:blocks/chest/top",
|
||||||
"up": "appliedenergistics2:blocks/chest/top",
|
"down": "appliedenergistics2:blocks/chest/bottom",
|
||||||
"down": "appliedenergistics2:blocks/chest/bottom",
|
"north": "appliedenergistics2:blocks/chest/front",
|
||||||
"north": "appliedenergistics2:blocks/chest/front",
|
"particle": "appliedenergistics2:blocks/chest/side",
|
||||||
"east": "appliedenergistics2:blocks/chest/side",
|
"east": "appliedenergistics2:blocks/chest/side"
|
||||||
"south": "appliedenergistics2:blocks/chest/side",
|
},
|
||||||
"west": "appliedenergistics2:blocks/chest/side"
|
"elements": [
|
||||||
}
|
{
|
||||||
}
|
"name": "inside_border_right",
|
||||||
|
"from": [4, 3, 0],
|
||||||
|
"to": [5, 8, 1],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [8, 13, 1]},
|
||||||
|
"faces": {
|
||||||
|
"east": {"uv": [0, 6, 1, 11], "rotation": 180, "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_right",
|
||||||
|
"from": [2, 1, 1],
|
||||||
|
"to": [5, 12, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [9, 11, 3]},
|
||||||
|
"faces": {
|
||||||
|
"east": {"uv": [5, 2, 14, 13], "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [0, 0, 0],
|
||||||
|
"to": [16, 16, 16],
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [0, 0, 16, 16], "texture": "#north"},
|
||||||
|
"east": {"uv": [0, 0, 16, 16], "texture": "#east"},
|
||||||
|
"south": {"uv": [0, 0, 16, 16], "texture": "#east"},
|
||||||
|
"west": {"uv": [0, 0, 16, 16], "texture": "#east"},
|
||||||
|
"up": {"uv": [0, 0, 16, 16], "texture": "#up"},
|
||||||
|
"down": {"uv": [0, 0, 16, 16], "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_back",
|
||||||
|
"from": [5, 4, 7],
|
||||||
|
"to": [11, 7, 10],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [19, 11, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [3, 2, 14, 14], "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_left",
|
||||||
|
"from": [11, 1, 1],
|
||||||
|
"to": [14, 12, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [18, 11, 3]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [2, 5, 2, 5], "texture": "#down"},
|
||||||
|
"west": {"uv": [5, 2, 14, 13], "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_top",
|
||||||
|
"from": [5, 6, 1],
|
||||||
|
"to": [11, 9, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [15, 16, 3]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [14, 12, 14, 12], "texture": "#down"},
|
||||||
|
"down": {"uv": [12, 15, 12, 15], "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_bottom",
|
||||||
|
"from": [5, 1, 1],
|
||||||
|
"to": [11, 4, 11],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [15, 11, 3]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [1, 6, 1, 6], "texture": "#down"},
|
||||||
|
"up": {"uv": [6, 1, 6, 1], "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_border_bottom",
|
||||||
|
"from": [4, 0, 0],
|
||||||
|
"to": [12, 3, 9],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [15, 10, 1]},
|
||||||
|
"faces": {
|
||||||
|
"up": {"uv": [0, 4, 9, 13], "rotation": 90, "texture": "#missing"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_border_top",
|
||||||
|
"from": [5, 7, 0],
|
||||||
|
"to": [12, 10, 9],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [15, 17, 1]},
|
||||||
|
"faces": {
|
||||||
|
"down": {"uv": [0, 4, 9, 13], "rotation": 270, "texture": "#down"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "inside_border_left",
|
||||||
|
"from": [11, 3, 0],
|
||||||
|
"to": [12, 8, 1],
|
||||||
|
"rotation": {"angle": 0, "axis": "y", "origin": [15, 13, 1]},
|
||||||
|
"faces": {
|
||||||
|
"west": {"uv": [0, 8, 1, 13], "texture": "#down"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"name": "chest",
|
||||||
|
"origin": [8, 8, 8],
|
||||||
|
"color": 0,
|
||||||
|
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cells",
|
||||||
|
"origin": [8, 8, 8],
|
||||||
|
"color": 0,
|
||||||
|
"children": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+3
-23
@@ -1,24 +1,4 @@
|
|||||||
{
|
{
|
||||||
"textures": {
|
"textures": {},
|
||||||
"state": "appliedenergistics2:blocks/chest/cell_state_empty"
|
"elements": []
|
||||||
},
|
}
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"from": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"to": [
|
|
||||||
16,
|
|
||||||
16,
|
|
||||||
16
|
|
||||||
],
|
|
||||||
"faces": {
|
|
||||||
"north": {
|
|
||||||
"texture": "#state"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+37
-46
@@ -1,47 +1,38 @@
|
|||||||
{
|
{
|
||||||
"ae2_uvl_marker": true,
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"backdrop": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
"front": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
||||||
"state": "appliedenergistics2:blocks/chest/cell_state_full"
|
"state": "appliedenergistics2:blocks/chest/cell_state_full",
|
||||||
},
|
"top_front": "appliedenergistics2:blocks/drive_cell_states_emissive"
|
||||||
"elements": [
|
},
|
||||||
{
|
"elements": [
|
||||||
"from": [
|
{
|
||||||
0,
|
"name": "Cell Backdrop",
|
||||||
0,
|
"from": [5, 4, 0],
|
||||||
0
|
"to": [11, 6, 1],
|
||||||
],
|
"shade": false,
|
||||||
"to": [
|
"faces": {
|
||||||
16,
|
"north": {"uv": [5, 10, 11, 12], "texture": "#front"},
|
||||||
16,
|
"up": {"uv": [5, 10, 11, 11], "texture": "#front"}
|
||||||
16
|
}
|
||||||
],
|
},
|
||||||
"faces": {
|
{
|
||||||
"north": {
|
"name": "Cell Light",
|
||||||
"texture": "#backdrop"
|
"from": [9, 4, 0],
|
||||||
}
|
"to": [10, 5, 0],
|
||||||
}
|
"shade": false,
|
||||||
},
|
"faces": {
|
||||||
{
|
"north": {"uv": [6, 11, 7, 12], "texture": "#state"}
|
||||||
"from": [
|
}
|
||||||
0,
|
},
|
||||||
0,
|
{
|
||||||
0
|
"name": "Cell Light",
|
||||||
],
|
"from": [9, 4, 0],
|
||||||
"to": [
|
"to": [10, 5, 0],
|
||||||
16,
|
"shade": false,
|
||||||
16,
|
"faces": {
|
||||||
16
|
"north": {"uv": [1, 7, 2, 8], "texture": "#top_front"}
|
||||||
],
|
}
|
||||||
"faces": {
|
}
|
||||||
"north": {
|
]
|
||||||
"texture": "#state",
|
}
|
||||||
"uvlightmap": {
|
|
||||||
"block": 0.007,
|
|
||||||
"sky": 0.007
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+16
-23
@@ -1,24 +1,17 @@
|
|||||||
{
|
{
|
||||||
"textures": {
|
"credit": "Made with Blockbench",
|
||||||
"state": "appliedenergistics2:blocks/chest/cell_state_offline"
|
"textures": {
|
||||||
},
|
"front": "appliedenergistics2:blocks/chest/cell_state_offline"
|
||||||
"elements": [
|
},
|
||||||
{
|
"elements": [
|
||||||
"from": [
|
{
|
||||||
0,
|
"from": [5, 4, 0],
|
||||||
0,
|
"to": [11, 6, 1],
|
||||||
0
|
"shade": false,
|
||||||
],
|
"faces": {
|
||||||
"to": [
|
"north": {"uv": [5, 10, 11, 12], "texture": "#front"},
|
||||||
16,
|
"up": {"uv": [5, 10, 11, 11], "texture": "#front"}
|
||||||
16,
|
}
|
||||||
16
|
}
|
||||||
],
|
]
|
||||||
"faces": {
|
}
|
||||||
"north": {
|
|
||||||
"texture": "#state"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+37
-46
@@ -1,47 +1,38 @@
|
|||||||
{
|
{
|
||||||
"ae2_uvl_marker": true,
|
"ae2_uvl_marker": true,
|
||||||
"textures": {
|
"parent": "block/block",
|
||||||
"backdrop": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
"textures": {
|
||||||
"state": "appliedenergistics2:blocks/chest/cell_state_online"
|
"front": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
||||||
},
|
"state": "appliedenergistics2:blocks/chest/cell_state_online",
|
||||||
"elements": [
|
"top_front": "appliedenergistics2:blocks/drive_cell_states_emissive"
|
||||||
{
|
},
|
||||||
"from": [
|
"elements": [
|
||||||
0,
|
{
|
||||||
0,
|
"name": "Cell Backdrop",
|
||||||
0
|
"from": [5, 4, 0],
|
||||||
],
|
"to": [11, 6, 1],
|
||||||
"to": [
|
"shade": false,
|
||||||
16,
|
"faces": {
|
||||||
16,
|
"north": {"uv": [5, 10, 11, 12], "texture": "#front"},
|
||||||
16
|
"up": {"uv": [5, 10, 11, 11], "texture": "#front"}
|
||||||
],
|
}
|
||||||
"faces": {
|
},
|
||||||
"north": {
|
{
|
||||||
"texture": "#backdrop"
|
"name": "Cell Light",
|
||||||
}
|
"from": [9, 4, 0],
|
||||||
}
|
"to": [10, 5, 0],
|
||||||
},
|
"shade": false,
|
||||||
{
|
"faces": {
|
||||||
"from": [
|
"north": {"uv": [6, 11, 7, 12], "texture": "#state"}
|
||||||
0,
|
}
|
||||||
0,
|
},
|
||||||
0
|
{
|
||||||
],
|
"name": "Cell Light",
|
||||||
"to": [
|
"from": [9, 4, 0],
|
||||||
16,
|
"to": [10, 5, 0],
|
||||||
16,
|
"faces": {
|
||||||
16
|
"north": {"uv": [1, 3, 2, 4], "texture": "#top_front"}
|
||||||
],
|
}
|
||||||
"faces": {
|
}
|
||||||
"north": {
|
]
|
||||||
"texture": "#state",
|
}
|
||||||
"uvlightmap": {
|
|
||||||
"block": 0.007,
|
|
||||||
"sky": 0.007
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+37
-46
@@ -1,47 +1,38 @@
|
|||||||
{
|
{
|
||||||
"ae2_uvl_marker": true,
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"backdrop": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
"front": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
||||||
"state": "appliedenergistics2:blocks/chest/cell_state_types_full"
|
"state": "appliedenergistics2:blocks/chest/cell_state_types_full",
|
||||||
},
|
"top_front": "appliedenergistics2:blocks/drive_cell_states_emissive"
|
||||||
"elements": [
|
},
|
||||||
{
|
"elements": [
|
||||||
"from": [
|
{
|
||||||
0,
|
"name": "Cell Backdrop",
|
||||||
0,
|
"from": [5, 4, 0],
|
||||||
0
|
"to": [11, 6, 1],
|
||||||
],
|
"shade": false,
|
||||||
"to": [
|
"faces": {
|
||||||
16,
|
"north": {"uv": [5, 10, 11, 12], "texture": "#front"},
|
||||||
16,
|
"up": {"uv": [5, 10, 11, 11], "texture": "#front"}
|
||||||
16
|
}
|
||||||
],
|
},
|
||||||
"faces": {
|
{
|
||||||
"north": {
|
"name": "Cell Light",
|
||||||
"texture": "#backdrop"
|
"from": [9, 4, 0],
|
||||||
}
|
"to": [10, 5, 0],
|
||||||
}
|
"shade": false,
|
||||||
},
|
"faces": {
|
||||||
{
|
"north": {"uv": [6, 11, 7, 12], "texture": "#state"}
|
||||||
"from": [
|
}
|
||||||
0,
|
},
|
||||||
0,
|
{
|
||||||
0
|
"name": "Cell Light",
|
||||||
],
|
"from": [9, 4, 0],
|
||||||
"to": [
|
"to": [10, 5, 0],
|
||||||
16,
|
"shade": false,
|
||||||
16,
|
"faces": {
|
||||||
16
|
"north": {"uv": [1, 5, 2, 6], "texture": "#top_front"}
|
||||||
],
|
}
|
||||||
"faces": {
|
}
|
||||||
"north": {
|
]
|
||||||
"texture": "#state",
|
}
|
||||||
"uvlightmap": {
|
|
||||||
"block": 0.007,
|
|
||||||
"sky": 0.007
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user