mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
ab0b8f11d4
commit
69a5c0e6ee
221 files changed
+3125
-2632
No files matched your search
@@ -1,5 +1,11 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
@@ -16,10 +22,6 @@ import appeng.me.storage.MEPassThrough;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class Ae2Reflect {
|
||||
|
||||
@@ -53,8 +55,11 @@ public class Ae2Reflect {
|
||||
fContainerUpgradeable_upgradeable = Ae2Reflect.reflectField(ContainerUpgradeable.class, "upgradeable");
|
||||
mItemSlot_setExtractable = reflectMethod(ItemSlot.class, "setExtractable", boolean.class);
|
||||
mCPU_getGrid = reflectMethod(CraftingCPUCluster.class, "getGrid");
|
||||
mCPU_postChange =
|
||||
reflectMethod(CraftingCPUCluster.class, "postChange", IAEItemStack.class, BaseActionSource.class);
|
||||
mCPU_postChange = reflectMethod(
|
||||
CraftingCPUCluster.class,
|
||||
"postChange",
|
||||
IAEItemStack.class,
|
||||
BaseActionSource.class);
|
||||
mCPU_markDirty = reflectMethod(CraftingCPUCluster.class, "markDirty");
|
||||
mP2PLiquids_getTarget = reflectMethod(PartP2PLiquids.class, "getTarget");
|
||||
} catch (Exception e) {
|
||||
@@ -75,8 +80,7 @@ public class Ae2Reflect {
|
||||
try {
|
||||
f = owner.getDeclaredField(name);
|
||||
if (f != null) break;
|
||||
} catch (NoSuchFieldException ignore) {
|
||||
}
|
||||
} catch (NoSuchFieldException ignore) {}
|
||||
}
|
||||
if (f == null) throw new NoSuchFieldException("Can't find field from " + Arrays.toString(names));
|
||||
f.setAccessible(true);
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.implementations.GuiCraftingStatus;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Ae2ReflectClient {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
@@ -30,28 +41,15 @@ import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.MEMonitorIFluidHandler;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class DualityFluidInterface
|
||||
implements IGridTickable,
|
||||
IStorageMonitorable,
|
||||
IAEFluidInventory,
|
||||
IUpgradeableHost,
|
||||
IConfigManagerHost,
|
||||
IFluidHandler {
|
||||
public class DualityFluidInterface implements IGridTickable, IStorageMonitorable, IAEFluidInventory, IUpgradeableHost,
|
||||
IConfigManagerHost, IFluidHandler {
|
||||
|
||||
public static final int NUMBER_OF_TANKS = 6;
|
||||
public static final long TANK_CAPACITY = 16000;
|
||||
@@ -64,10 +62,12 @@ public class DualityFluidInterface
|
||||
private final AEFluidInventory config = new AEFluidInventory(this, NUMBER_OF_TANKS, Integer.MAX_VALUE);
|
||||
private final IAEFluidStack[] requireWork;
|
||||
private int isWorking = -1;
|
||||
private final MEMonitorPassThrough<IAEItemStack> items =
|
||||
new MEMonitorPassThrough<IAEItemStack>(new NullInventory<>(), StorageChannel.ITEMS);
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids =
|
||||
new MEMonitorPassThrough<IAEFluidStack>(new NullInventory<>(), StorageChannel.FLUIDS);
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<IAEItemStack>(
|
||||
new NullInventory<>(),
|
||||
StorageChannel.ITEMS);
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<IAEFluidStack>(
|
||||
new NullInventory<>(),
|
||||
StorageChannel.FLUIDS);
|
||||
private boolean resetConfigCache = true;
|
||||
|
||||
public DualityFluidInterface(final AENetworkProxy networkProxy, final IInterfaceHost ih) {
|
||||
@@ -147,10 +147,7 @@ public class DualityFluidInterface
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
try {
|
||||
return gridProxy
|
||||
.getGrid()
|
||||
.<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.getFluidInventory();
|
||||
return gridProxy.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
@@ -178,7 +175,10 @@ public class DualityFluidInterface
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(
|
||||
TickRates.Interface.getMin(), TickRates.Interface.getMax(), !this.hasWorkToDo(), true);
|
||||
TickRates.Interface.getMin(),
|
||||
TickRates.Interface.getMax(),
|
||||
!this.hasWorkToDo(),
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,8 +187,7 @@ public class DualityFluidInterface
|
||||
return TickRateModulation.SLEEP;
|
||||
} else {
|
||||
boolean couldDoWork = this.updateStorage();
|
||||
return this.hasWorkToDo()
|
||||
? (couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER)
|
||||
return this.hasWorkToDo() ? (couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER)
|
||||
: TickRateModulation.SLEEP;
|
||||
}
|
||||
}
|
||||
@@ -243,8 +242,7 @@ public class DualityFluidInterface
|
||||
} else {
|
||||
this.gridProxy.getTick().sleepDevice(this.gridProxy.getNode());
|
||||
}
|
||||
} catch (GridAccessException ignored) {
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,8 +301,7 @@ public class DualityFluidInterface
|
||||
toStore.setStackSize(-toStore.getStackSize());
|
||||
FluidStack canExtract = this.tanks.drain(slot, toStore.getFluidStack(), false);
|
||||
if (canExtract != null && (long) canExtract.amount == toStore.getStackSize()) {
|
||||
IAEFluidStack notStored = dest.injectItems(toStore, Actionable.MODULATE, this.mySource);
|
||||
;
|
||||
IAEFluidStack notStored = dest.injectItems(toStore, Actionable.MODULATE, this.mySource);;
|
||||
toStore.setStackSize(toStore.getStackSize() - (notStored == null ? 0L : notStored.getStackSize()));
|
||||
if (toStore.getStackSize() > 0L) {
|
||||
changed = true;
|
||||
@@ -361,8 +358,7 @@ public class DualityFluidInterface
|
||||
if (this.gridProxy.isActive()) {
|
||||
try {
|
||||
this.gridProxy.getTick().wakeDevice(this.gridProxy.getNode());
|
||||
} catch (GridAccessException ignored) {
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
TileEntity te = this.iHost.getTileEntity();
|
||||
if (te != null && te.getWorldObj() != null) {
|
||||
@@ -398,8 +394,7 @@ public class DualityFluidInterface
|
||||
} else {
|
||||
this.gridProxy.getTick().sleepDevice(this.gridProxy.getNode());
|
||||
}
|
||||
} catch (GridAccessException ignored) {
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
this.notifyNeighbors();
|
||||
@@ -445,6 +440,7 @@ public class DualityFluidInterface
|
||||
}
|
||||
|
||||
private static class InterfaceInventory extends MEMonitorIFluidHandler {
|
||||
|
||||
InterfaceInventory(DualityFluidInterface tileInterface) {
|
||||
super(tileInterface.tanks);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.helpers.PatternHelper;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -14,6 +12,11 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.helpers.PatternHelper;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<FluidPatternDetails> {
|
||||
|
||||
private final ItemStack patternStack;
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IInvTweaks;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import java.util.Comparator;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class FluidSorters {
|
||||
|
||||
private static SortDir Direction = SortDir.ASCENDING;
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_MOD = new Comparator<IAEItemStack>() {
|
||||
|
||||
@@ -19,8 +23,8 @@ public class FluidSorters {
|
||||
final Fluid f1 = ItemFluidDrop.getAeFluidStack(o1).getFluid();
|
||||
final Fluid f2 = ItemFluidDrop.getAeFluidStack(o2).getFluid();
|
||||
if (getDirection() == SortDir.ASCENDING) {
|
||||
return this.secondarySort(
|
||||
Util.getFluidModName(f2).compareToIgnoreCase(Util.getFluidModName(f1)), f1, f2);
|
||||
return this
|
||||
.secondarySort(Util.getFluidModName(f2).compareToIgnoreCase(Util.getFluidModName(f1)), f1, f2);
|
||||
}
|
||||
return this.secondarySort(Util.getFluidModName(f1).compareToIgnoreCase(Util.getFluidModName(f2)), f2, f1);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -7,7 +9,6 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public final class ModAndClassUtil {
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
|
||||
public class NameConst {
|
||||
|
||||
public static final String BLOCK_FLUID_DISCRETIZER = "fluid_discretizer";
|
||||
|
||||
@@ -6,17 +6,15 @@ import java.util.NoSuchElementException;
|
||||
/**
|
||||
* An {@link java.util.Iterator Iterator} over an array of objects.
|
||||
* <p>
|
||||
* This iterator does not support {@link #remove}, as the object array cannot be
|
||||
* structurally modified.
|
||||
* This iterator does not support {@link #remove}, as the object array cannot be structurally modified.
|
||||
* <p>
|
||||
* The iterator implements a {@link #reset} method, allowing the reset of the iterator
|
||||
* back to the start if required.
|
||||
* The iterator implements a {@link #reset} method, allowing the reset of the iterator back to the start if required.
|
||||
*
|
||||
* @param <E> the type to iterate over
|
||||
* @since 3.0
|
||||
* @version $Id: ObjectArrayIterator.java 1734648 2016-03-11 23:51:22Z ggregory $
|
||||
*/
|
||||
public class ObjectArrayIterator<E> implements /*Resettable*/ Iterator<E> {
|
||||
public class ObjectArrayIterator<E> implements /* Resettable */ Iterator<E> {
|
||||
|
||||
/** The array */
|
||||
final E[] array;
|
||||
@@ -29,8 +27,7 @@ public class ObjectArrayIterator<E> implements /*Resettable*/ Iterator<E> {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
/**
|
||||
* Constructs an ObjectArrayIterator that will iterate over the values in the
|
||||
* specified array.
|
||||
* Constructs an ObjectArrayIterator that will iterate over the values in the specified array.
|
||||
*
|
||||
* @param array the array to iterate over
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
@@ -41,12 +38,12 @@ public class ObjectArrayIterator<E> implements /*Resettable*/ Iterator<E> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an ObjectArrayIterator that will iterate over the values in the
|
||||
* specified array from a specific start index.
|
||||
* Constructs an ObjectArrayIterator that will iterate over the values in the specified array from a specific start
|
||||
* index.
|
||||
*
|
||||
* @param array the array to iterate over
|
||||
* @param start the index to start iterating at
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
* @param array the array to iterate over
|
||||
* @param start the index to start iterating at
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
* @throws IndexOutOfBoundsException if the start index is out of bounds
|
||||
*/
|
||||
public ObjectArrayIterator(final E array[], final int start) {
|
||||
@@ -54,15 +51,14 @@ public class ObjectArrayIterator<E> implements /*Resettable*/ Iterator<E> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an ObjectArrayIterator that will iterate over a range of values
|
||||
* in the specified array.
|
||||
* Construct an ObjectArrayIterator that will iterate over a range of values in the specified array.
|
||||
*
|
||||
* @param array the array to iterate over
|
||||
* @param start the index to start iterating at
|
||||
* @param end the index (exclusive) to finish iterating at
|
||||
* @param array the array to iterate over
|
||||
* @param start the index to start iterating at
|
||||
* @param end the index (exclusive) to finish iterating at
|
||||
* @throws IndexOutOfBoundsException if the start or end index is out of bounds
|
||||
* @throws IllegalArgumentException if end index is before the start
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if end index is before the start
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
*/
|
||||
public ObjectArrayIterator(final E array[], final int start, final int end) {
|
||||
super();
|
||||
@@ -101,8 +97,7 @@ public class ObjectArrayIterator<E> implements /*Resettable*/ Iterator<E> {
|
||||
* Returns the next element in the array.
|
||||
*
|
||||
* @return the next element in the array
|
||||
* @throws NoSuchElementException if all the elements in the array
|
||||
* have already been returned
|
||||
* @throws NoSuchElementException if all the elements in the array have already been returned
|
||||
*/
|
||||
@Override
|
||||
public E next() {
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
public final class RenderUtil {
|
||||
|
||||
public static void renderItemIcon(IIcon icon, double size, double z, float nx, float ny, float nz) {
|
||||
renderItemIcon(icon, 0.0D, 0.0D, size, size, z, nx, ny, nz);
|
||||
}
|
||||
|
||||
public static void renderItemIcon(
|
||||
IIcon icon,
|
||||
double xStart,
|
||||
double yStart,
|
||||
double xEnd,
|
||||
double yEnd,
|
||||
double z,
|
||||
float nx,
|
||||
float ny,
|
||||
float nz) {
|
||||
public static void renderItemIcon(IIcon icon, double xStart, double yStart, double xEnd, double yEnd, double z,
|
||||
float nx, float ny, float nz) {
|
||||
if (icon == null) {
|
||||
return;
|
||||
}
|
||||
@@ -45,8 +41,8 @@ public final class RenderUtil {
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
|
||||
public static void renderFluidIntoGui(
|
||||
Gui gui, int x, int y, int width, int height, @Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
public static void renderFluidIntoGui(Gui gui, int x, int y, int width, int height,
|
||||
@Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
if (aeFluidStack != null) {
|
||||
GL11.glDisable(2896);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
@@ -61,7 +57,11 @@ public final class RenderUtil {
|
||||
for (int th = 0; th <= hi; th += 16) {
|
||||
if (hi - th <= 0) break;
|
||||
gui.drawTexturedModelRectFromIcon(
|
||||
x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
x,
|
||||
y + height - Math.min(16, hi - th) - th,
|
||||
fluidIcon,
|
||||
width,
|
||||
Math.min(16, hi - th));
|
||||
}
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IMachineSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.Spliterator;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IMachineSet;
|
||||
|
||||
public class SetBackedMachineSet implements IMachineSet {
|
||||
|
||||
private final Class<? extends IGridHost> machineClass;
|
||||
@@ -37,7 +39,7 @@ public class SetBackedMachineSet implements IMachineSet {
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
//noinspection SuspiciousMethodCalls
|
||||
// noinspection SuspiciousMethodCalls
|
||||
return backingSet.contains(o);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -10,24 +23,17 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
public final class Util {
|
||||
|
||||
public static int findItemInPlayerInvSlot(EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
|
||||
if (player.inventory.mainInventory[i] != null && player.inventory.mainInventory[i] == itemStack) return i;
|
||||
@@ -43,8 +49,8 @@ public final class Util {
|
||||
return hasPermission(player, permission, host, ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
public static boolean hasPermission(
|
||||
EntityPlayer player, SecurityPermissions permission, IGridHost host, ForgeDirection side) {
|
||||
public static boolean hasPermission(EntityPlayer player, SecurityPermissions permission, IGridHost host,
|
||||
ForgeDirection side) {
|
||||
return host == null || hasPermission(player, permission, host.getGridNode(side));
|
||||
}
|
||||
|
||||
@@ -56,10 +62,9 @@ public final class Util {
|
||||
return part == null || hasPermission(player, permission, part.getGridNode());
|
||||
}
|
||||
|
||||
public static boolean hasPermission(
|
||||
EntityPlayer player, SecurityPermissions permission, ISecurityGrid securityGrid) {
|
||||
return player == null
|
||||
|| permission == null
|
||||
public static boolean hasPermission(EntityPlayer player, SecurityPermissions permission,
|
||||
ISecurityGrid securityGrid) {
|
||||
return player == null || permission == null
|
||||
|| securityGrid == null
|
||||
|| securityGrid.hasPermission(player, permission);
|
||||
}
|
||||
@@ -214,6 +219,7 @@ public final class Util {
|
||||
}
|
||||
|
||||
public static class FluidUtil {
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(Fluid fluid) {
|
||||
return createAEFluidStack(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
@@ -227,8 +233,7 @@ public final class Util {
|
||||
}
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(int fluidId, long amount) {
|
||||
return createAEFluidStack(new FluidStack(FluidRegistry.getFluid(fluidId), 1))
|
||||
.setStackSize(amount);
|
||||
return createAEFluidStack(new FluidStack(FluidRegistry.getFluid(fluidId), 1)).setStackSize(amount);
|
||||
}
|
||||
|
||||
public static boolean isEmpty(ItemStack itemStack) {
|
||||
|
||||
Reference in new issue
Block a user