mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 18:44:42 +00:00
spotless apply
This commit is contained in:
1 parent
6acf2bace1
commit
5e31096c7e
191 files changed
+5046
-5165
No files matched your search
@@ -20,7 +20,6 @@ import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -41,7 +40,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
//based
|
||||
// based
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,12 +63,12 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
|
||||
@Override
|
||||
public void setPriority(int newValue) {
|
||||
//do nothing
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blinkCell(int slot) {
|
||||
//do nothing
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +86,10 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
return getProxy()
|
||||
.getGrid()
|
||||
.<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
@@ -128,7 +130,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
updateState();
|
||||
}
|
||||
|
||||
private class FluidDiscretizingInventory implements IMEInventory<IAEItemStack>, IMEMonitorHandlerReceiver<IAEFluidStack> {
|
||||
private class FluidDiscretizingInventory
|
||||
implements IMEInventory<IAEItemStack>, IMEMonitorHandlerReceiver<IAEFluidStack> {
|
||||
|
||||
private final MEInventoryHandler<IAEItemStack> invHandler = new MEInventoryHandler<>(this, getChannel());
|
||||
private List<IAEItemStack> itemCache = null;
|
||||
@@ -153,8 +156,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
}
|
||||
if (type == Actionable.SIMULATE) {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.injectItems(fluidStack.copy(), Actionable.SIMULATE, src));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.injectItems(fluidStack.copy(), Actionable.MODULATE, src));
|
||||
}
|
||||
}
|
||||
@@ -175,8 +177,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
}
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.extractItems(fluidStack.copy(), Actionable.SIMULATE, src));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.extractItems(fluidStack.copy(), Actionable.MODULATE, src));
|
||||
}
|
||||
}
|
||||
@@ -213,7 +214,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
public void postChange(
|
||||
IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
itemCache = null;
|
||||
try {
|
||||
List<IAEItemStack> mappedChanges = new ArrayList<>();
|
||||
@@ -223,8 +225,10 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
mappedChanges.add(itemStack);
|
||||
}
|
||||
}
|
||||
getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.postAlterationOfStoredItems(getChannel(), mappedChanges, ownActionSource);
|
||||
getProxy()
|
||||
.getGrid()
|
||||
.<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.postAlterationOfStoredItems(getChannel(), mappedChanges, ownActionSource);
|
||||
} catch (GridAccessException e) {
|
||||
// NO-OP
|
||||
}
|
||||
@@ -254,8 +258,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
return null;
|
||||
}
|
||||
if (craftingGrid instanceof CraftingGridCache) {
|
||||
IAEStack remaining = ((CraftingGridCache)craftingGrid).injectItems(
|
||||
ItemFluidDrop.newAeStack(input), type, ownActionSource);
|
||||
IAEStack remaining = ((CraftingGridCache) craftingGrid)
|
||||
.injectItems(ItemFluidDrop.newAeStack(input), type, ownActionSource);
|
||||
if (remaining instanceof IAEItemStack) {
|
||||
return ItemFluidDrop.getAeFluidStack((IAEItemStack) remaining);
|
||||
}
|
||||
@@ -277,7 +281,5 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,8 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -32,19 +34,11 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileFluidInterface extends TileInterface implements IFluidHandler, IAEFluidInventory
|
||||
{
|
||||
|
||||
public TileFluidInterface() {
|
||||
super.getInterfaceDuality().getConfigManager()
|
||||
.registerSetting(Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
}
|
||||
public class TileFluidInterface extends TileInterface implements IFluidHandler, IAEFluidInventory {
|
||||
|
||||
private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this) {
|
||||
private final IConfigManager dualityConfigManager = getInterfaceDuality().getConfigManager();
|
||||
private final IConfigManager dualityConfigManager =
|
||||
getInterfaceDuality().getConfigManager();
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
@@ -56,6 +50,11 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
return this.getTanks().drain(from.ordinal(), maxDrain, doDrain);
|
||||
}
|
||||
};
|
||||
|
||||
public TileFluidInterface() {
|
||||
super.getInterfaceDuality().getConfigManager().registerSetting(Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
}
|
||||
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -85,12 +84,11 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
for (int i = 0; i < fluidDuality.getConfig().getSlots(); i ++) {
|
||||
for (int i = 0; i < fluidDuality.getConfig().getSlots(); i++) {
|
||||
IAEFluidStack fluid = fluidDuality.getConfig().getFluidInSlot(i);
|
||||
if (fluid == null) {
|
||||
config.setInventorySlotContents(i, null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
config.setInventorySlotContents(i, ItemFluidPacket.newDisplayStack(fluid.getFluidStack()));
|
||||
}
|
||||
}
|
||||
@@ -102,10 +100,10 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
TickingRequest item = super.getTickingRequest(node);
|
||||
TickingRequest fluid = fluidDuality.getTickingRequest(node);
|
||||
return new TickingRequest(
|
||||
Math.min(item.minTickRate, fluid.minTickRate),
|
||||
Math.max(item.maxTickRate, fluid.maxTickRate),
|
||||
item.isSleeping && fluid.isSleeping,
|
||||
true);
|
||||
Math.min(item.minTickRate, fluid.minTickRate),
|
||||
Math.max(item.maxTickRate, fluid.maxTickRate),
|
||||
item.isSleeping && fluid.isSleeping,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,11 +117,11 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
protected void writeToStream(ByteBuf data) throws IOException {
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
ByteBufUtils.writeItemStack(data, config.getStackInSlot(i));
|
||||
for (int j = 0; j < config.getSizeInventory(); j ++) {
|
||||
for (int j = 0; j < config.getSizeInventory(); j++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(j));
|
||||
fluidDuality.getConfig().setFluidInSlot(j, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -143,7 +141,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
protected boolean readFromStream(ByteBuf data) throws IOException {
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
@@ -152,7 +150,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
config.setInventorySlotContents(i, stack);
|
||||
changed = true;
|
||||
}
|
||||
for (int j = 0; j < config.getSizeInventory(); j ++) {
|
||||
for (int j = 0; j < config.getSizeInventory(); j++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(j));
|
||||
fluidDuality.getConfig().setFluidInSlot(j, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -176,17 +174,17 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
return changed;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
for (int i = 0; i < config.getSizeInventory(); i ++) {
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(i));
|
||||
fluidDuality.getConfig().setFluidInSlot(i, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
@@ -194,8 +192,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getItemFromTile( final Object obj )
|
||||
{
|
||||
protected ItemStack getItemFromTile(final Object obj) {
|
||||
if (obj instanceof TileFluidInterface) {
|
||||
return ItemAndBlockHolder.INTERFACE.stack();
|
||||
}
|
||||
@@ -203,9 +200,8 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades( final Upgrades u )
|
||||
{
|
||||
return getInterfaceDuality().getInstalledUpgrades( u );
|
||||
public int getInstalledUpgrades(final Upgrades u) {
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,7 +243,8 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
|
||||
public void setConfig(int id, IAEFluidStack fluid) {
|
||||
if (id >= 0 && id < 6) {
|
||||
config.setInventorySlotContents(id, ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
|
||||
config.setInventorySlotContents(
|
||||
id, ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
|
||||
fluidDuality.getConfig().setFluidInSlot(id, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
}
|
||||
@@ -257,5 +254,4 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
getInternalFluid().setFluidInSlot(id, fluid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,7 +66,8 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
}
|
||||
IAEFluidStack aeFluid = AEFluidStack.create(fluid.copy());
|
||||
IEnergyGrid energyGrid = node.getGrid().getCache(IEnergyGrid.class);
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = node.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
IMEMonitor<IAEFluidStack> fluidGrid =
|
||||
node.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
IAEFluidStack remaining = Platform.poweredInsert(energyGrid, fluidGrid, aeFluid, ownActionSource);
|
||||
if (remaining != null) {
|
||||
if (remaining.getStackSize() == aeFluid.getStackSize()) {
|
||||
@@ -82,7 +83,8 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
try {
|
||||
getProxy().getTick().alertDevice(getProxy().getNode());
|
||||
} catch (GridAccessException e) {
|
||||
@@ -90,13 +92,13 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
inventory.writeToNBT(data, "Inventory");
|
||||
return data;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
inventory.readFromNBT(data, "Inventory");
|
||||
}
|
||||
|
||||
@@ -10,17 +10,17 @@ import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInventory {
|
||||
|
||||
private final AppEngInternalInventory patternInv = new AppEngInternalInventory(this, 2);
|
||||
private final AeStackInventoryImpl<IAEItemStack> crafting = new AeStackInventoryImpl<>(StorageChannel.ITEMS, 9, this);
|
||||
private final AeStackInventoryImpl<IAEItemStack> crafting =
|
||||
new AeStackInventoryImpl<>(StorageChannel.ITEMS, 9, this);
|
||||
private final AeStackInventoryImpl<IAEItemStack> output = new AeStackInventoryImpl<>(StorageChannel.ITEMS, 3, this);
|
||||
|
||||
public IInventory getInventory() {
|
||||
@@ -41,7 +41,7 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops ) {
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops) {
|
||||
for (ItemStack stack : patternInv) {
|
||||
if (stack != null) {
|
||||
drops.add(stack);
|
||||
@@ -49,14 +49,14 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
patternInv.readFromNBT(data, "Inventory");
|
||||
crafting.readFromNbt(data, "CraftingSlots");
|
||||
output.readFromNbt(data, "OutputSlots");
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
patternInv.writeToNBT(data, "Inventory");
|
||||
crafting.writeToNbt(data, "CraftingSlots");
|
||||
@@ -65,8 +65,6 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
|
||||
}
|
||||
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,9 +23,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInventory, IFluidHandler {
|
||||
|
||||
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 9);
|
||||
@@ -51,7 +50,7 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +84,7 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
protected boolean readFromStream(ByteBuf data) throws IOException {
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < invItems.getSizeInventory(); i++) {
|
||||
@@ -114,13 +113,13 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
return changed;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
invItems.readFromNBT(data, "ItemInv");
|
||||
invFluids.readFromNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
invItems.writeToNBT(data, "ItemInv");
|
||||
invFluids.writeToNBT(data, "FluidInv");
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,9 +23,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileLargeIngredientBuffer extends AEBaseInvTile implements IAEFluidInventory, IFluidHandler {
|
||||
|
||||
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 27);
|
||||
@@ -51,7 +50,9 @@ public class TileLargeIngredientBuffer extends AEBaseInvTile implements IAEFluid
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
|
||||
return new int[] {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,13 +40,13 @@ import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.concurrent.Future;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInventory, IGridTickable, ICraftingRequester, IPowerChannelState {
|
||||
public class TileLevelMaintainer extends AENetworkTile
|
||||
implements IAEAppEngInventory, IGridTickable, ICraftingRequester, IPowerChannelState {
|
||||
|
||||
public static final int REQ_COUNT = 5;
|
||||
public final InventoryRequest requests = new InventoryRequest(this);
|
||||
@@ -74,10 +74,14 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
try {
|
||||
if (this.getProxy().isActive()) {
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = Math.ceil(ItemFluidDrop.isFluidStack(items) ? items.getStackSize() / 1000D : items.getStackSize());
|
||||
final double power = Math.ceil(
|
||||
ItemFluidDrop.isFluidStack(items) ? items.getStackSize() / 1000D : items.getStackSize());
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
if (ItemFluidDrop.isFluidStack(items)) {
|
||||
IAEFluidStack notInserted = this.getProxy().getStorage().getFluidInventory().injectItems(ItemFluidDrop.getAeFluidStack(items), mode, this.source);
|
||||
IAEFluidStack notInserted = this.getProxy()
|
||||
.getStorage()
|
||||
.getFluidInventory()
|
||||
.injectItems(ItemFluidDrop.getAeFluidStack(items), mode, this.source);
|
||||
items.setStackSize(notInserted.getStackSize());
|
||||
return items;
|
||||
} else {
|
||||
@@ -90,6 +94,7 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link) {
|
||||
if (this.requests.getLinks() != null) {
|
||||
@@ -120,15 +125,17 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
try {
|
||||
ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
IGrid grid = this.getProxy().getGrid();
|
||||
final IItemList<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory().getStorageList();
|
||||
final IItemList<IAEItemStack> inv =
|
||||
this.getProxy().getStorage().getItemInventory().getStorageList();
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
IAEItemStack is = requests.getRequestQtyStack(i);
|
||||
if (is != null && requests.getBatchSize(i) > 0) {
|
||||
IAEItemStack craftItem = requests.getCraftItem(i);
|
||||
if (cg.canEmitFor(craftItem) || cg.isRequesting(craftItem) ||
|
||||
(inv.findPrecise(is) != null && inv.findPrecise(is).getStackSize() >= is.getStackSize()) || !this.requests.isDone(i)
|
||||
)
|
||||
continue;
|
||||
if (cg.canEmitFor(craftItem)
|
||||
|| cg.isRequesting(craftItem)
|
||||
|| (inv.findPrecise(is) != null
|
||||
&& inv.findPrecise(is).getStackSize() >= is.getStackSize())
|
||||
|| !this.requests.isDone(i)) continue;
|
||||
// do crafting
|
||||
Future<ICraftingJob> jobTask = requests.getJobs()[i];
|
||||
if (jobTask == null) {
|
||||
@@ -162,7 +169,8 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
try {
|
||||
getProxy().getTick().alertDevice(getProxy().getNode());
|
||||
} catch (GridAccessException e) {
|
||||
@@ -175,9 +183,7 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
|
||||
}
|
||||
public void gridChanged() {}
|
||||
|
||||
@Override
|
||||
public boolean isPowered() {
|
||||
@@ -279,8 +285,8 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
|
||||
try {
|
||||
newState = this.getProxy().isActive()
|
||||
&& this.getProxy().getEnergy().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG)
|
||||
> 0.0001;
|
||||
&& this.getProxy().getEnergy().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG)
|
||||
> 0.0001;
|
||||
} catch (final GridAccessException ignored) {
|
||||
|
||||
}
|
||||
|
||||
@@ -24,12 +24,11 @@ public class TileOCPatternEditor extends AEBaseInvTile {
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) {
|
||||
public boolean isItemValidForSlot(final int i, final ItemStack itemstack) {
|
||||
return itemstack == null || itemstack.getItem() instanceof ItemEncodedPattern;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user