Remove RSUtils and move to specific util classes
This commit is contained in:
@@ -1,661 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDiskProvider;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.init.PotionTypes;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.potion.PotionUtils;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.text.Style;
|
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
|
||||||
import net.minecraftforge.common.util.Constants;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
|
||||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
|
||||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
|
||||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.vecmath.Matrix4f;
|
|
||||||
import javax.vecmath.Vector3f;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.DecimalFormatSymbols;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public final class RSUtils {
|
|
||||||
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
|
|
||||||
public static final ItemStack EMPTY_BOTTLE = new ItemStack(Items.GLASS_BOTTLE);
|
|
||||||
public static final ItemStack WATER_BOTTLE = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER);
|
|
||||||
|
|
||||||
public static final Comparator<IStorage> STORAGE_COMPARATOR = (left, right) -> {
|
|
||||||
int compare = Integer.compare(right.getPriority(), left.getPriority());
|
|
||||||
|
|
||||||
return compare != 0 ? compare : Integer.compare(right.getStored(), left.getStored());
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final DecimalFormat QUANTITY_FORMATTER = new DecimalFormat("####0.#", DecimalFormatSymbols.getInstance(Locale.US));
|
|
||||||
|
|
||||||
private static final String NBT_INVENTORY = "Inventory_%d";
|
|
||||||
private static final String NBT_SLOT = "Slot";
|
|
||||||
private static final String NBT_ACCESS_TYPE = "AccessType";
|
|
||||||
|
|
||||||
private static final Map<Integer, List<ItemStack>> OREDICT_CACHE = new HashMap<>();
|
|
||||||
private static final Map<Integer, Boolean> OREDICT_EQUIVALENCY_CACHE = new HashMap<>();
|
|
||||||
|
|
||||||
private static final NonNullList<Object> EMPTY_NON_NULL_LIST = NonNullList.create();
|
|
||||||
|
|
||||||
static {
|
|
||||||
QUANTITY_FORMATTER.setRoundingMode(RoundingMode.DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<ItemStack> getEquivalentStacks(ItemStack stack) {
|
|
||||||
int hash = API.instance().getItemStackHashCode(stack, false);
|
|
||||||
|
|
||||||
if (OREDICT_CACHE.containsKey(hash)) {
|
|
||||||
return OREDICT_CACHE.get(hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ItemStack> ores = new ArrayList<>();
|
|
||||||
|
|
||||||
for (int id : OreDictionary.getOreIDs(stack)) {
|
|
||||||
ores.addAll(OreDictionary.getOres(OreDictionary.getOreName(id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
OREDICT_CACHE.put(hash, ores);
|
|
||||||
|
|
||||||
return ores;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean areStacksEquivalent(ItemStack left, ItemStack right) {
|
|
||||||
int code = API.instance().getItemStackHashCode(left, false);
|
|
||||||
code = 31 * code + API.instance().getItemStackHashCode(right, false);
|
|
||||||
|
|
||||||
if (OREDICT_EQUIVALENCY_CACHE.containsKey(code)) {
|
|
||||||
return OREDICT_EQUIVALENCY_CACHE.get(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] leftIds = OreDictionary.getOreIDs(left);
|
|
||||||
int[] rightIds = OreDictionary.getOreIDs(right);
|
|
||||||
|
|
||||||
for (int i : rightIds) {
|
|
||||||
if (ArrayUtils.contains(leftIds, i)) {
|
|
||||||
OREDICT_EQUIVALENCY_CACHE.put(code, true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OREDICT_EQUIVALENCY_CACHE.put(code, false);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeItemStack(ByteBuf buf, ItemStack stack) {
|
|
||||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
|
||||||
buf.writeInt(stack.getCount());
|
|
||||||
buf.writeInt(stack.getItemDamage());
|
|
||||||
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack readItemStack(ByteBuf buf) {
|
|
||||||
ItemStack stack = new ItemStack(Item.getItemById(buf.readInt()), buf.readInt(), buf.readInt());
|
|
||||||
stack.setTagCompound(ByteBufUtils.readTag(buf));
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeItemStack(ByteBuf buf, ItemStack stack, @Nullable INetwork network, boolean displayCraftText) {
|
|
||||||
writeItemStack(buf, stack);
|
|
||||||
|
|
||||||
buf.writeInt(API.instance().getItemStackHashCode(stack));
|
|
||||||
|
|
||||||
if (network != null) {
|
|
||||||
buf.writeBoolean(network.getCraftingManager().hasPattern(stack));
|
|
||||||
buf.writeBoolean(displayCraftText);
|
|
||||||
} else {
|
|
||||||
buf.writeBoolean(false);
|
|
||||||
buf.writeBoolean(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeFluidStack(ByteBuf buf, FluidStack stack) {
|
|
||||||
buf.writeInt(API.instance().getFluidStackHashCode(stack));
|
|
||||||
ByteBufUtils.writeUTF8String(buf, FluidRegistry.getFluidName(stack.getFluid()));
|
|
||||||
buf.writeInt(stack.amount);
|
|
||||||
ByteBufUtils.writeTag(buf, stack.tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Pair<Integer, FluidStack> readFluidStack(ByteBuf buf) {
|
|
||||||
return Pair.of(buf.readInt(), new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack transformNullToEmpty(@Nullable ItemStack stack) {
|
|
||||||
return stack == null ? ItemStack.EMPTY : stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static ItemStack transformEmptyToNull(@Nonnull ItemStack stack) {
|
|
||||||
return stack.isEmpty() ? null : stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static void createStorages(ItemStack disk, int slot, IStorageDisk<ItemStack>[] itemStorages, IStorageDisk<FluidStack>[] fluidStorages, Function<IStorageDisk<ItemStack>, IStorageDisk> itemStorageWrapper, Function<IStorageDisk<FluidStack>, IStorageDisk> fluidStorageWrapper) {
|
|
||||||
if (disk.isEmpty()) {
|
|
||||||
itemStorages[slot] = null;
|
|
||||||
fluidStorages[slot] = null;
|
|
||||||
} else {
|
|
||||||
IStorageDiskProvider provider = (IStorageDiskProvider) disk.getItem();
|
|
||||||
IStorageDisk storage = provider.create(disk);
|
|
||||||
|
|
||||||
storage.readFromNBT();
|
|
||||||
|
|
||||||
switch (storage.getType()) {
|
|
||||||
case ITEMS:
|
|
||||||
itemStorages[slot] = itemStorageWrapper.apply(storage);
|
|
||||||
break;
|
|
||||||
case FLUIDS:
|
|
||||||
fluidStorages[slot] = fluidStorageWrapper.apply(storage);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NonNullList<ItemStack> toNonNullList(List<ItemStack> list) {
|
|
||||||
NonNullList<ItemStack> other = NonNullList.create();
|
|
||||||
|
|
||||||
for (ItemStack item : list) {
|
|
||||||
if (item != null) {
|
|
||||||
other.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> NonNullList<T> emptyNonNullList() {
|
|
||||||
return (NonNullList<T>) EMPTY_NON_NULL_LIST;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeItems(IItemHandler handler, int id, NBTTagCompound tag) {
|
|
||||||
NBTTagList tagList = new NBTTagList();
|
|
||||||
|
|
||||||
for (int i = 0; i < handler.getSlots(); i++) {
|
|
||||||
if (!handler.getStackInSlot(i).isEmpty()) {
|
|
||||||
NBTTagCompound stackTag = new NBTTagCompound();
|
|
||||||
|
|
||||||
stackTag.setInteger(NBT_SLOT, i);
|
|
||||||
|
|
||||||
handler.getStackInSlot(i).writeToNBT(stackTag);
|
|
||||||
|
|
||||||
tagList.appendTag(stackTag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tag.setTag(String.format(NBT_INVENTORY, id), tagList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readItems(IItemHandlerModifiable handler, int id, NBTTagCompound tag) {
|
|
||||||
String name = String.format(NBT_INVENTORY, id);
|
|
||||||
|
|
||||||
if (tag.hasKey(name)) {
|
|
||||||
NBTTagList tagList = tag.getTagList(name, Constants.NBT.TAG_COMPOUND);
|
|
||||||
|
|
||||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
|
||||||
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
|
||||||
|
|
||||||
if (slot >= 0 && slot < handler.getSlots()) {
|
|
||||||
handler.setStackInSlot(slot, new ItemStack(tagList.getCompoundTagAt(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeItemsLegacy(IInventory inventory, int id, NBTTagCompound tag) {
|
|
||||||
NBTTagList tagList = new NBTTagList();
|
|
||||||
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
|
||||||
if (!inventory.getStackInSlot(i).isEmpty()) {
|
|
||||||
NBTTagCompound stackTag = new NBTTagCompound();
|
|
||||||
|
|
||||||
stackTag.setInteger(NBT_SLOT, i);
|
|
||||||
|
|
||||||
inventory.getStackInSlot(i).writeToNBT(stackTag);
|
|
||||||
|
|
||||||
tagList.appendTag(stackTag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tag.setTag(String.format(NBT_INVENTORY, id), tagList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readItemsLegacy(IInventory inventory, int id, NBTTagCompound tag) {
|
|
||||||
String name = String.format(NBT_INVENTORY, id);
|
|
||||||
|
|
||||||
if (tag.hasKey(name)) {
|
|
||||||
NBTTagList tagList = tag.getTagList(name, Constants.NBT.TAG_COMPOUND);
|
|
||||||
|
|
||||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
|
||||||
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(tagList.getCompoundTagAt(i));
|
|
||||||
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NBTTagList serializeFluidStackList(IStackList<FluidStack> list) {
|
|
||||||
NBTTagList tagList = new NBTTagList();
|
|
||||||
|
|
||||||
for (FluidStack stack : list.getStacks()) {
|
|
||||||
tagList.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return tagList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IStackList<FluidStack> readFluidStackList(NBTTagList tagList) {
|
|
||||||
IStackList<FluidStack> list = API.instance().createFluidStackList();
|
|
||||||
|
|
||||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
|
||||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(tagList.getCompoundTagAt(i));
|
|
||||||
|
|
||||||
if (stack != null) {
|
|
||||||
list.add(stack, stack.amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeAccessType(NBTTagCompound tag, AccessType type) {
|
|
||||||
tag.setInteger(NBT_ACCESS_TYPE, type.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AccessType readAccessType(NBTTagCompound tag) {
|
|
||||||
return tag.hasKey(NBT_ACCESS_TYPE) ? getAccessType(tag.getInteger(NBT_ACCESS_TYPE)) : AccessType.INSERT_EXTRACT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AccessType getAccessType(int id) {
|
|
||||||
for (AccessType type : AccessType.values()) {
|
|
||||||
if (type.getId() == id) {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return AccessType.INSERT_EXTRACT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateBlock(World world, BlockPos pos) {
|
|
||||||
if (world != null) {
|
|
||||||
world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 1 | 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IItemHandler getItemHandler(@Nullable TileEntity tile, EnumFacing side) {
|
|
||||||
if (tile == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IItemHandler handler = tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) ? tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) : null;
|
|
||||||
|
|
||||||
if (handler == null) {
|
|
||||||
if (side != null && tile instanceof ISidedInventory) {
|
|
||||||
handler = new SidedInvWrapper((ISidedInventory) tile, side);
|
|
||||||
} else if (tile instanceof IInventory) {
|
|
||||||
handler = new InvWrapper((IInventory) tile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IFluidHandler getFluidHandler(TileEntity tile, EnumFacing side) {
|
|
||||||
return (tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) ? tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Pair<ItemStack, FluidStack> getFluidFromStack(ItemStack stack, boolean simulate) {
|
|
||||||
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
|
||||||
IFluidHandlerItem fluidHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
|
|
||||||
|
|
||||||
FluidStack result = fluidHandler.drain(Fluid.BUCKET_VOLUME, !simulate);
|
|
||||||
|
|
||||||
return Pair.of(fluidHandler.getContainer(), result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Pair.of(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasFluidBucket(FluidStack stack) {
|
|
||||||
return stack.getFluid() == FluidRegistry.WATER || stack.getFluid() == FluidRegistry.LAVA || stack.getFluid().getName().equals("milk") || FluidRegistry.getBucketFluids().contains(stack.getFluid());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FluidStack copyStackWithSize(FluidStack stack, int size) {
|
|
||||||
FluidStack copy = stack.copy();
|
|
||||||
copy.amount = size;
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FluidStack copyStack(@Nullable FluidStack stack) {
|
|
||||||
return stack == null ? null : stack.copy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendNoPermissionMessage(EntityPlayer player) {
|
|
||||||
player.sendMessage(new TextComponentTranslation("misc.refinedstorage:security.no_permission").setStyle(new Style().setColor(TextFormatting.RED)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String formatQuantity(int qty) {
|
|
||||||
if (qty >= 1000000) {
|
|
||||||
return QUANTITY_FORMATTER.format((float) qty / 1000000F) + "M";
|
|
||||||
} else if (qty >= 1000) {
|
|
||||||
return QUANTITY_FORMATTER.format((float) qty / 1000F) + "K";
|
|
||||||
}
|
|
||||||
|
|
||||||
return String.valueOf(qty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AxisAlignedBB getAABB(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
|
|
||||||
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInAABB(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
|
|
||||||
return hitX >= aabb.minX && hitX <= aabb.maxX && hitY >= aabb.minY && hitY <= aabb.maxY && hitZ >= aabb.minZ && hitZ <= aabb.maxZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class AdvancedRayTraceResultBase<T extends RayTraceResult> {
|
|
||||||
public final AxisAlignedBB bounds;
|
|
||||||
public final T hit;
|
|
||||||
|
|
||||||
public AdvancedRayTraceResultBase(T mop, AxisAlignedBB bounds) {
|
|
||||||
|
|
||||||
this.hit = mop;
|
|
||||||
this.bounds = bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean valid() {
|
|
||||||
return hit != null && bounds != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double squareDistanceTo(Vec3d vec) {
|
|
||||||
return hit.hitVec.squareDistanceTo(vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AdvancedRayTraceResult extends AdvancedRayTraceResultBase<RayTraceResult> {
|
|
||||||
public AdvancedRayTraceResult(RayTraceResult mop, AxisAlignedBB bounds) {
|
|
||||||
super(mop, bounds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vec3d getStart(EntityPlayer player) {
|
|
||||||
return new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vec3d getEnd(EntityPlayer player) {
|
|
||||||
double reachDistance = player instanceof EntityPlayerMP ? ((EntityPlayerMP) player).interactionManager.getBlockReachDistance() : (player.capabilities.isCreativeMode ? 5.0D : 4.5D);
|
|
||||||
|
|
||||||
Vec3d lookVec = player.getLookVec();
|
|
||||||
Vec3d start = getStart(player);
|
|
||||||
|
|
||||||
return start.addVector(lookVec.x * reachDistance, lookVec.y * reachDistance, lookVec.z * reachDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3d start, Vec3d end, Collection<AxisAlignedBB> boxes) {
|
|
||||||
double minDistance = Double.POSITIVE_INFINITY;
|
|
||||||
AdvancedRayTraceResult hit = null;
|
|
||||||
int i = -1;
|
|
||||||
|
|
||||||
for (AxisAlignedBB aabb : boxes) {
|
|
||||||
AdvancedRayTraceResult result = aabb == null ? null : collisionRayTrace(pos, start, end, aabb, i, null);
|
|
||||||
|
|
||||||
if (result != null) {
|
|
||||||
double d = result.squareDistanceTo(start);
|
|
||||||
if (d < minDistance) {
|
|
||||||
minDistance = d;
|
|
||||||
hit = result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, Object hitInfo) {
|
|
||||||
RayTraceResult result = bounds.offset(pos).calculateIntercept(start, end);
|
|
||||||
|
|
||||||
if (result == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = new RayTraceResult(RayTraceResult.Type.BLOCK, result.hitVec, result.sideHit, pos);
|
|
||||||
result.subHit = subHit;
|
|
||||||
result.hitInfo = hitInfo;
|
|
||||||
|
|
||||||
return new AdvancedRayTraceResult(result, bounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class FluidRenderer {
|
|
||||||
private static final int TEX_WIDTH = 16;
|
|
||||||
private static final int TEX_HEIGHT = 16;
|
|
||||||
private static final int MIN_FLUID_HEIGHT = 1;
|
|
||||||
|
|
||||||
private final int capacityMb;
|
|
||||||
private final int width;
|
|
||||||
private final int height;
|
|
||||||
|
|
||||||
public FluidRenderer(int capacityMb, int width, int height) {
|
|
||||||
this.capacityMb = capacityMb;
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
|
||||||
GlStateManager.enableBlend();
|
|
||||||
GlStateManager.enableAlpha();
|
|
||||||
|
|
||||||
drawFluid(minecraft, xPosition, yPosition, fluidStack);
|
|
||||||
|
|
||||||
GlStateManager.color(1, 1, 1, 1);
|
|
||||||
|
|
||||||
GlStateManager.disableAlpha();
|
|
||||||
GlStateManager.disableBlend();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawFluid(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
|
||||||
if (fluidStack == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Fluid fluid = fluidStack.getFluid();
|
|
||||||
|
|
||||||
if (fluid == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
|
||||||
ResourceLocation fluidStill = fluid.getStill();
|
|
||||||
TextureAtlasSprite fluidStillSprite = null;
|
|
||||||
|
|
||||||
if (fluidStill != null) {
|
|
||||||
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fluidStillSprite == null) {
|
|
||||||
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
|
||||||
}
|
|
||||||
|
|
||||||
int fluidColor = fluid.getColor(fluidStack);
|
|
||||||
|
|
||||||
int scaledAmount = height;
|
|
||||||
|
|
||||||
if (capacityMb != -1) {
|
|
||||||
scaledAmount = (fluidStack.amount * height) / capacityMb;
|
|
||||||
|
|
||||||
if (fluidStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) {
|
|
||||||
scaledAmount = MIN_FLUID_HEIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scaledAmount > height) {
|
|
||||||
scaledAmount = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
|
||||||
setGLColorFromInt(fluidColor);
|
|
||||||
|
|
||||||
int xTileCount = width / TEX_WIDTH;
|
|
||||||
int xRemainder = width - (xTileCount * TEX_WIDTH);
|
|
||||||
int yTileCount = scaledAmount / TEX_HEIGHT;
|
|
||||||
int yRemainder = scaledAmount - (yTileCount * TEX_HEIGHT);
|
|
||||||
|
|
||||||
int yStart = yPosition + height;
|
|
||||||
|
|
||||||
for (int xTile = 0; xTile <= xTileCount; xTile++) {
|
|
||||||
for (int yTile = 0; yTile <= yTileCount; yTile++) {
|
|
||||||
int width = (xTile == xTileCount) ? xRemainder : TEX_WIDTH;
|
|
||||||
int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT;
|
|
||||||
int x = xPosition + (xTile * TEX_WIDTH);
|
|
||||||
int y = yStart - ((yTile + 1) * TEX_HEIGHT);
|
|
||||||
|
|
||||||
if (width > 0 && height > 0) {
|
|
||||||
int maskTop = TEX_HEIGHT - height;
|
|
||||||
int maskRight = TEX_WIDTH - width;
|
|
||||||
|
|
||||||
drawFluidTexture(x, y, fluidStillSprite, maskTop, maskRight, 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setGLColorFromInt(int color) {
|
|
||||||
float red = (color >> 16 & 0xFF) / 255.0F;
|
|
||||||
float green = (color >> 8 & 0xFF) / 255.0F;
|
|
||||||
float blue = (color & 0xFF) / 255.0F;
|
|
||||||
|
|
||||||
GlStateManager.color(red, green, blue, 1.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
|
||||||
double uMin = (double) textureSprite.getMinU();
|
|
||||||
double uMax = (double) textureSprite.getMaxU();
|
|
||||||
double vMin = (double) textureSprite.getMinV();
|
|
||||||
double vMax = (double) textureSprite.getMaxV();
|
|
||||||
uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
|
|
||||||
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
|
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
|
|
||||||
BufferBuilder vertexBuffer = tessellator.getBuffer();
|
|
||||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
|
||||||
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
|
||||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
|
|
||||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
|
|
||||||
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Matrix4f EMPTY_MATRIX_TRANSFORM = getTransform(0, 0, 0, 0, 0, 0, 1.0f).getMatrix();
|
|
||||||
|
|
||||||
// From ForgeBlockStateV1
|
|
||||||
private static final TRSRTransformation FLIP_X = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
|
||||||
|
|
||||||
private static TRSRTransformation leftifyTransform(TRSRTransformation transform) {
|
|
||||||
return TRSRTransformation.blockCenterToCorner(FLIP_X.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(FLIP_X));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static TRSRTransformation getTransform(float tx, float ty, float tz, float ax, float ay, float az, float s) {
|
|
||||||
return new TRSRTransformation(
|
|
||||||
new javax.vecmath.Vector3f(tx / 16, ty / 16, tz / 16),
|
|
||||||
TRSRTransformation.quatFromXYZDegrees(new javax.vecmath.Vector3f(ax, ay, az)),
|
|
||||||
new javax.vecmath.Vector3f(s, s, s),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> DEFAULT_ITEM_TRANSFORM;
|
|
||||||
private static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> DEFAULT_BLOCK_TRANSFORM;
|
|
||||||
|
|
||||||
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getDefaultItemTransforms() {
|
|
||||||
if (DEFAULT_ITEM_TRANSFORM != null) {
|
|
||||||
return DEFAULT_ITEM_TRANSFORM;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DEFAULT_ITEM_TRANSFORM = ImmutableMap.<ItemCameraTransforms.TransformType, TRSRTransformation>builder()
|
|
||||||
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(0, 3, 1, 0, 0, 0, 0.55f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransform(0, 3, 1, 0, 0, 0, 0.55f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 2, 0, 0, 0, 0, 0.5f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.HEAD, getTransform(0, 13, 7, 0, 180, 0, 1))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getDefaultBlockTransforms() {
|
|
||||||
if (DEFAULT_BLOCK_TRANSFORM != null) {
|
|
||||||
return DEFAULT_BLOCK_TRANSFORM;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRSRTransformation thirdperson = getTransform(0, 2.5f, 0, 75, 45, 0, 0.375f);
|
|
||||||
|
|
||||||
return DEFAULT_BLOCK_TRANSFORM = ImmutableMap.<ItemCameraTransforms.TransformType, TRSRTransformation>builder()
|
|
||||||
.put(ItemCameraTransforms.TransformType.GUI, getTransform(0, 0, 0, 30, 225, 0, 0.625f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 3, 0, 0, 0, 0, 0.25f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.FIXED, getTransform(0, 0, 0, 0, 0, 0, 0.5f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, thirdperson)
|
|
||||||
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, leftifyTransform(thirdperson))
|
|
||||||
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(0, 0, 0, 0, 45, 0, 0.4f))
|
|
||||||
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(0, 0, 0, 0, 225, 0, 0.4f))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,15 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
public interface IStorage<T> {
|
public interface IStorage<T> {
|
||||||
|
Comparator<IStorage> COMPARATOR = (left, right) -> {
|
||||||
|
int compare = Integer.compare(right.getPriority(), left.getPriority());
|
||||||
|
|
||||||
|
return compare != 0 ? compare : Integer.compare(right.getStored(), left.getStored());
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return stacks stored in this storage, empty stacks are allowed
|
* @return stacks stored in this storage, empty stacks are allowed
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||||
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
|
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@@ -34,7 +35,7 @@ public class CraftingMonitorElementFluidRender implements ICraftingMonitorElemen
|
|||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.scale(scale, scale, 1);
|
GlStateManager.scale(scale, scale, 1);
|
||||||
|
|
||||||
drawers.getStringDrawer().draw(GuiBase.calculateOffsetOnScale(x + 21 + offset, scale), GuiBase.calculateOffsetOnScale(y + 7, scale), RSUtils.QUANTITY_FORMATTER.format((float) stack.amount / 1000F) + "x " + stack.getLocalizedName());
|
drawers.getStringDrawer().draw(GuiBase.calculateOffsetOnScale(x + 21 + offset, scale), GuiBase.calculateOffsetOnScale(y + 7, scale), RenderUtils.QUANTITY_FORMATTER.format((float) stack.amount / 1000F) + "x " + stack.getLocalizedName());
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
@@ -57,7 +58,7 @@ public class CraftingMonitorElementFluidRender implements ICraftingMonitorElemen
|
|||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buf) {
|
public void write(ByteBuf buf) {
|
||||||
buf.writeInt(taskId);
|
buf.writeInt(taskId);
|
||||||
RSUtils.writeFluidStack(buf, stack);
|
StackUtils.writeFluidStack(buf, stack);
|
||||||
buf.writeInt(offset);
|
buf.writeInt(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
|
||||||
@@ -10,6 +9,7 @@ import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task.CraftingStep;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task.CraftingStep;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task.CraftingTask;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task.CraftingTask;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.minecraft.nbt.NBTTagList;
|
||||||
@@ -56,7 +56,7 @@ public class CraftingTaskFactory implements ICraftingTaskFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IStackList<FluidStack> toTakeFluids = RSUtils.readFluidStackList(tag.getTagList(CraftingTask.NBT_TO_TAKE_FLUIDS, Constants.NBT.TAG_COMPOUND));
|
IStackList<FluidStack> toTakeFluids = StackUtils.readFluidStackList(tag.getTagList(CraftingTask.NBT_TO_TAKE_FLUIDS, Constants.NBT.TAG_COMPOUND));
|
||||||
|
|
||||||
NBTTagList toInsertFluidsList = tag.getTagList(CraftingTask.NBT_TO_INSERT_FLUIDS, Constants.NBT.TAG_COMPOUND);
|
NBTTagList toInsertFluidsList = tag.getTagList(CraftingTask.NBT_TO_INSERT_FLUIDS, Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||||
@@ -11,6 +10,7 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.util.Comparer;
|
import com.raoulvdberge.refinedstorage.apiimpl.util.Comparer;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.minecraft.nbt.NBTTagList;
|
||||||
@@ -211,15 +211,15 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
if (actualStack == null || actualStack.isEmpty() || !items.trackedRemove(actualStack, stack.getCount())) {
|
if (actualStack == null || actualStack.isEmpty() || !items.trackedRemove(actualStack, stack.getCount())) {
|
||||||
FluidStack fluidInItem;
|
FluidStack fluidInItem;
|
||||||
|
|
||||||
if (API.instance().getComparer().isEqual(stack, RSUtils.WATER_BOTTLE)) {
|
if (API.instance().getComparer().isEqual(stack, StackUtils.WATER_BOTTLE)) {
|
||||||
FluidStack fluidStack = fluids.get(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), compare);
|
FluidStack fluidStack = fluids.get(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), compare);
|
||||||
ItemStack emptyBottle = items.get(RSUtils.EMPTY_BOTTLE, compare);
|
ItemStack emptyBottle = items.get(StackUtils.EMPTY_BOTTLE, compare);
|
||||||
if (emptyBottle != null && fluidStack != null && !emptyBottle.isEmpty() && items.trackedRemove(RSUtils.EMPTY_BOTTLE, 1)) {
|
if (emptyBottle != null && fluidStack != null && !emptyBottle.isEmpty() && items.trackedRemove(StackUtils.EMPTY_BOTTLE, 1)) {
|
||||||
return AvailableType.FLUID;
|
return AvailableType.FLUID;
|
||||||
}
|
}
|
||||||
} else if ((fluidInItem = RSUtils.getFluidFromStack(stack, true).getValue()) != null && RSUtils.hasFluidBucket(fluidInItem)) {
|
} else if ((fluidInItem = StackUtils.getFluid(stack, true).getValue()) != null && StackUtils.hasFluidBucket(fluidInItem)) {
|
||||||
FluidStack fluidStack = fluids.get(fluidInItem, compare);
|
FluidStack fluidStack = fluids.get(fluidInItem, compare);
|
||||||
ItemStack bucket = items.get(RSUtils.EMPTY_BUCKET, compare);
|
ItemStack bucket = items.get(StackUtils.EMPTY_BUCKET, compare);
|
||||||
if (bucket != null && fluidStack != null && !bucket.isEmpty() && fluids.trackedRemove(fluidStack, fluidInItem.amount) && items.trackedRemove(bucket, 1)) {
|
if (bucket != null && fluidStack != null && !bucket.isEmpty() && fluids.trackedRemove(fluidStack, fluidInItem.amount) && items.trackedRemove(bucket, 1)) {
|
||||||
return AvailableType.FLUID;
|
return AvailableType.FLUID;
|
||||||
}
|
}
|
||||||
@@ -244,16 +244,16 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
} else {
|
} else {
|
||||||
boolean abort = true;
|
boolean abort = true;
|
||||||
FluidStack fluidInItem;
|
FluidStack fluidInItem;
|
||||||
if (API.instance().getComparer().isEqual(insertStack, RSUtils.WATER_BOTTLE)) {
|
if (API.instance().getComparer().isEqual(insertStack, StackUtils.WATER_BOTTLE)) {
|
||||||
FluidStack fluidStack = network.extractFluid(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), Fluid.BUCKET_VOLUME, compare, true); // Simulate is true because we won't actually get the fluid out of the storage for bottles!
|
FluidStack fluidStack = network.extractFluid(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), Fluid.BUCKET_VOLUME, compare, true); // Simulate is true because we won't actually get the fluid out of the storage for bottles!
|
||||||
ItemStack emptyBottleStack = network.extractItem(RSUtils.EMPTY_BOTTLE, 1, compare, false);
|
ItemStack emptyBottleStack = network.extractItem(StackUtils.EMPTY_BOTTLE, 1, compare, false);
|
||||||
if (fluidStack != null && fluidStack.amount == Fluid.BUCKET_VOLUME && emptyBottleStack != null) {
|
if (fluidStack != null && fluidStack.amount == Fluid.BUCKET_VOLUME && emptyBottleStack != null) {
|
||||||
abort = false;
|
abort = false;
|
||||||
actualInputs.add(insertStack.copy());
|
actualInputs.add(insertStack.copy());
|
||||||
}
|
}
|
||||||
} else if ((fluidInItem = RSUtils.getFluidFromStack(insertStack, true).getValue()) != null) {
|
} else if ((fluidInItem = StackUtils.getFluid(insertStack, true).getValue()) != null) {
|
||||||
FluidStack fluidStack = network.extractFluid(fluidInItem, fluidInItem.amount, compare, false);
|
FluidStack fluidStack = network.extractFluid(fluidInItem, fluidInItem.amount, compare, false);
|
||||||
ItemStack bucketStack = network.extractItem(RSUtils.EMPTY_BUCKET, 1, compare, false);
|
ItemStack bucketStack = network.extractItem(StackUtils.EMPTY_BUCKET, 1, compare, false);
|
||||||
if (fluidStack != null && fluidStack.amount == fluidInItem.amount && bucketStack != null) {
|
if (fluidStack != null && fluidStack.amount == fluidInItem.amount && bucketStack != null) {
|
||||||
abort = false;
|
abort = false;
|
||||||
actualInputs.add(insertStack.copy());
|
actualInputs.add(insertStack.copy());
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
@@ -20,6 +19,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.Craf
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewElementFluidStack;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewElementFluidStack;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewElementItemStack;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewElementItemStack;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.util.StackListItem;
|
import com.raoulvdberge.refinedstorage.apiimpl.util.StackListItem;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.minecraft.nbt.NBTTagList;
|
||||||
@@ -277,70 +277,70 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
private boolean doFluidCalculation(IStackList<ItemStack> networkList, IStackList<FluidStack> networkFluidList, ItemStack input, IStackList<ItemStack> toInsert, List<ICraftingStep> previousSteps) {
|
private boolean doFluidCalculation(IStackList<ItemStack> networkList, IStackList<FluidStack> networkFluidList, ItemStack input, IStackList<ItemStack> toInsert, List<ICraftingStep> previousSteps) {
|
||||||
FluidStack fluidInItem;
|
FluidStack fluidInItem;
|
||||||
|
|
||||||
if (API.instance().getComparer().isEqual(input, RSUtils.WATER_BOTTLE)) {
|
if (API.instance().getComparer().isEqual(input, StackUtils.WATER_BOTTLE)) {
|
||||||
FluidStack fluidInStorage = networkFluidList.get(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME));
|
FluidStack fluidInStorage = networkFluidList.get(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME));
|
||||||
|
|
||||||
if (fluidInStorage == null || fluidInStorage.amount < Fluid.BUCKET_VOLUME) {
|
if (fluidInStorage == null || fluidInStorage.amount < Fluid.BUCKET_VOLUME) {
|
||||||
missing.add(input);
|
missing.add(input);
|
||||||
} else {
|
} else {
|
||||||
ItemStack emptyBottle = toInsert.get(RSUtils.EMPTY_BOTTLE);
|
ItemStack emptyBottle = toInsert.get(StackUtils.EMPTY_BOTTLE);
|
||||||
boolean hasBottle = false;
|
boolean hasBottle = false;
|
||||||
if (emptyBottle != null && emptyBottle.getCount() > 0) {
|
if (emptyBottle != null && emptyBottle.getCount() > 0) {
|
||||||
hasBottle = toInsert.remove(RSUtils.EMPTY_BOTTLE, 1);
|
hasBottle = toInsert.remove(StackUtils.EMPTY_BOTTLE, 1);
|
||||||
}
|
}
|
||||||
if (!hasBottle) {
|
if (!hasBottle) {
|
||||||
emptyBottle = networkList.get(RSUtils.EMPTY_BOTTLE);
|
emptyBottle = networkList.get(StackUtils.EMPTY_BOTTLE);
|
||||||
if (emptyBottle != null && emptyBottle.getCount() > 0) {
|
if (emptyBottle != null && emptyBottle.getCount() > 0) {
|
||||||
hasBottle = networkList.remove(RSUtils.EMPTY_BOTTLE);
|
hasBottle = networkList.remove(StackUtils.EMPTY_BOTTLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICraftingPattern emptyBottlePattern = network.getCraftingManager().getPattern(RSUtils.EMPTY_BOTTLE);
|
ICraftingPattern emptyBottlePattern = network.getCraftingManager().getPattern(StackUtils.EMPTY_BOTTLE);
|
||||||
|
|
||||||
if (!hasBottle) {
|
if (!hasBottle) {
|
||||||
if (emptyBottlePattern == null) {
|
if (emptyBottlePattern == null) {
|
||||||
missing.add(RSUtils.EMPTY_BOTTLE.copy());
|
missing.add(StackUtils.EMPTY_BOTTLE.copy());
|
||||||
} else {
|
} else {
|
||||||
toCraft.add(RSUtils.EMPTY_BOTTLE.copy());
|
toCraft.add(StackUtils.EMPTY_BOTTLE.copy());
|
||||||
previousSteps.add(calculate(networkList, networkFluidList, emptyBottlePattern, toInsert));
|
previousSteps.add(calculate(networkList, networkFluidList, emptyBottlePattern, toInsert));
|
||||||
toInsert.remove(RSUtils.EMPTY_BOTTLE, 1);
|
toInsert.remove(StackUtils.EMPTY_BOTTLE, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBottle || emptyBottlePattern != null) {
|
if (hasBottle || emptyBottlePattern != null) {
|
||||||
toTake.add(RSUtils.EMPTY_BOTTLE.copy());
|
toTake.add(StackUtils.EMPTY_BOTTLE.copy());
|
||||||
networkList.remove(RSUtils.EMPTY_BOTTLE);
|
networkList.remove(StackUtils.EMPTY_BOTTLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if ((fluidInItem = RSUtils.getFluidFromStack(input, true).getValue()) != null && RSUtils.hasFluidBucket(fluidInItem)) {
|
} else if ((fluidInItem = StackUtils.getFluid(input, true).getValue()) != null && StackUtils.hasFluidBucket(fluidInItem)) {
|
||||||
FluidStack fluidInStorage = networkFluidList.get(fluidInItem);
|
FluidStack fluidInStorage = networkFluidList.get(fluidInItem);
|
||||||
|
|
||||||
if (fluidInStorage == null || fluidInStorage.amount < fluidInItem.amount) {
|
if (fluidInStorage == null || fluidInStorage.amount < fluidInItem.amount) {
|
||||||
missing.add(input);
|
missing.add(input);
|
||||||
} else {
|
} else {
|
||||||
ItemStack bucket = toInsert.get(RSUtils.EMPTY_BUCKET);
|
ItemStack bucket = toInsert.get(StackUtils.EMPTY_BUCKET);
|
||||||
boolean hasBucket = false;
|
boolean hasBucket = false;
|
||||||
if (bucket != null && bucket.getCount() > 0) {
|
if (bucket != null && bucket.getCount() > 0) {
|
||||||
hasBucket = toInsert.remove(RSUtils.EMPTY_BUCKET, 1);
|
hasBucket = toInsert.remove(StackUtils.EMPTY_BUCKET, 1);
|
||||||
}
|
}
|
||||||
if (!hasBucket) {
|
if (!hasBucket) {
|
||||||
bucket = networkList.get(RSUtils.EMPTY_BUCKET);
|
bucket = networkList.get(StackUtils.EMPTY_BUCKET);
|
||||||
if (bucket != null && bucket.getCount() > 0) {
|
if (bucket != null && bucket.getCount() > 0) {
|
||||||
hasBucket = networkList.remove(RSUtils.EMPTY_BUCKET, 1);
|
hasBucket = networkList.remove(StackUtils.EMPTY_BUCKET, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICraftingPattern bucketPattern = network.getCraftingManager().getPattern(RSUtils.EMPTY_BUCKET);
|
ICraftingPattern bucketPattern = network.getCraftingManager().getPattern(StackUtils.EMPTY_BUCKET);
|
||||||
|
|
||||||
if (!hasBucket) {
|
if (!hasBucket) {
|
||||||
if (bucketPattern == null) {
|
if (bucketPattern == null) {
|
||||||
missing.add(RSUtils.EMPTY_BUCKET.copy());
|
missing.add(StackUtils.EMPTY_BUCKET.copy());
|
||||||
} else {
|
} else {
|
||||||
toCraft.add(RSUtils.EMPTY_BUCKET.copy());
|
toCraft.add(StackUtils.EMPTY_BUCKET.copy());
|
||||||
previousSteps.add(calculate(networkList, networkFluidList, bucketPattern, toInsert));
|
previousSteps.add(calculate(networkList, networkFluidList, bucketPattern, toInsert));
|
||||||
toInsert.remove(RSUtils.EMPTY_BUCKET, 1);
|
toInsert.remove(StackUtils.EMPTY_BUCKET, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,7 +520,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
|
|
||||||
tag.setTag(NBT_TO_INSERT_ITEMS, toInsertItemsList);
|
tag.setTag(NBT_TO_INSERT_ITEMS, toInsertItemsList);
|
||||||
|
|
||||||
tag.setTag(NBT_TO_TAKE_FLUIDS, RSUtils.serializeFluidStackList(toTakeFluids));
|
tag.setTag(NBT_TO_TAKE_FLUIDS, StackUtils.serializeFluidStackList(toTakeFluids));
|
||||||
|
|
||||||
NBTTagList toInsertFluidsList = new NBTTagList();
|
NBTTagList toInsertFluidsList = new NBTTagList();
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network;
|
package com.raoulvdberge.refinedstorage.apiimpl.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
@@ -42,7 +42,7 @@ public class NetworkNodeListener {
|
|||||||
INetworkNode node = nodeProxy.getNode();
|
INetworkNode node = nodeProxy.getNode();
|
||||||
|
|
||||||
if (node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
|
if (node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
|
||||||
RSUtils.sendNoPermissionMessage(e.getPlayer());
|
WorldUtils.sendNoPermissionMessage(e.getPlayer());
|
||||||
|
|
||||||
e.setCanceled(true);
|
e.setCanceled(true);
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public class NetworkNodeListener {
|
|||||||
INetworkNode node = nodeProxy.getNode();
|
INetworkNode node = nodeProxy.getNode();
|
||||||
|
|
||||||
if (node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
|
if (node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
|
||||||
RSUtils.sendNoPermissionMessage(e.getPlayer());
|
WorldUtils.sendNoPermissionMessage(e.getPlayer());
|
||||||
|
|
||||||
e.setCanceled(true);
|
e.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IFluidGridHandler;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IFluidGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.inventory.InventoryHelper;
|
import net.minecraft.inventory.InventoryHelper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -31,14 +31,14 @@ public class FluidGridHandler implements IFluidGridHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RSUtils.hasFluidBucket(stack)) {
|
if (StackUtils.hasFluidBucket(stack)) {
|
||||||
ItemStack bucket = null;
|
ItemStack bucket = null;
|
||||||
|
|
||||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||||
ItemStack slot = player.inventory.getStackInSlot(i);
|
ItemStack slot = player.inventory.getStackInSlot(i);
|
||||||
|
|
||||||
if (API.instance().getComparer().isEqualNoQuantity(RSUtils.EMPTY_BUCKET, slot)) {
|
if (API.instance().getComparer().isEqualNoQuantity(StackUtils.EMPTY_BUCKET, slot)) {
|
||||||
bucket = RSUtils.EMPTY_BUCKET.copy();
|
bucket = StackUtils.EMPTY_BUCKET.copy();
|
||||||
|
|
||||||
player.inventory.decrStackSize(i, 1);
|
player.inventory.decrStackSize(i, 1);
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class FluidGridHandler implements IFluidGridHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bucket == null) {
|
if (bucket == null) {
|
||||||
bucket = network.extractItem(RSUtils.EMPTY_BUCKET, 1, false);
|
bucket = network.extractItem(StackUtils.EMPTY_BUCKET, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bucket != null) {
|
if (bucket != null) {
|
||||||
@@ -74,10 +74,10 @@ public class FluidGridHandler implements IFluidGridHandler {
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<ItemStack, FluidStack> result = RSUtils.getFluidFromStack(container, true);
|
Pair<ItemStack, FluidStack> result = StackUtils.getFluid(container, true);
|
||||||
|
|
||||||
if (result.getValue() != null && network.insertFluid(result.getValue(), result.getValue().amount, true) == null) {
|
if (result.getValue() != null && network.insertFluid(result.getValue(), result.getValue().amount, true) == null) {
|
||||||
result = RSUtils.getFluidFromStack(container, false);
|
result = StackUtils.getFluid(container, false);
|
||||||
|
|
||||||
network.insertFluid(result.getValue(), result.getValue().amount, false);
|
network.insertFluid(result.getValue(), result.getValue().amount, false);
|
||||||
|
|
||||||
@@ -89,12 +89,12 @@ public class FluidGridHandler implements IFluidGridHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInsertHeldContainer(EntityPlayerMP player) {
|
public void onInsertHeldContainer(EntityPlayerMP player) {
|
||||||
player.inventory.setItemStack(RSUtils.transformNullToEmpty(onInsert(player, player.inventory.getItemStack())));
|
player.inventory.setItemStack(StackUtils.nullToEmpty(onInsert(player, player.inventory.getItemStack())));
|
||||||
player.updateHeldItem();
|
player.updateHeldItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onShiftClick(EntityPlayerMP player, ItemStack container) {
|
public ItemStack onShiftClick(EntityPlayerMP player, ItemStack container) {
|
||||||
return RSUtils.transformNullToEmpty(onInsert(player, container));
|
return StackUtils.nullToEmpty(onInsert(player, container));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||||
@@ -16,6 +15,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.item.NetworkItemWirelessC
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.item.NetworkItemWirelessGrid;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.item.NetworkItemWirelessGrid;
|
||||||
import com.raoulvdberge.refinedstorage.network.MessageGridCraftingPreviewResponse;
|
import com.raoulvdberge.refinedstorage.network.MessageGridCraftingPreviewResponse;
|
||||||
import com.raoulvdberge.refinedstorage.network.MessageGridCraftingStartResponse;
|
import com.raoulvdberge.refinedstorage.network.MessageGridCraftingStartResponse;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -137,7 +137,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.inventory.setItemStack(RSUtils.transformNullToEmpty(network.insertItem(stack, size, false)));
|
player.inventory.setItemStack(StackUtils.nullToEmpty(network.insertItem(stack, size, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.updateHeldItem();
|
player.updateHeldItem();
|
||||||
@@ -151,7 +151,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onShiftClick(EntityPlayerMP player, ItemStack stack) {
|
public ItemStack onShiftClick(EntityPlayerMP player, ItemStack stack) {
|
||||||
return RSUtils.transformNullToEmpty(onInsert(player, stack));
|
return StackUtils.nullToEmpty(onInsert(player, stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.grid;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -129,7 +129,7 @@ public class ItemGridHandlerPortable implements IItemGridHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.inventory.setItemStack(RSUtils.transformNullToEmpty(portableGrid.getStorage().insert(stack, size, false)));
|
player.inventory.setItemStack(StackUtils.nullToEmpty(portableGrid.getStorage().insert(stack, size, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.updateHeldItem();
|
player.updateHeldItem();
|
||||||
@@ -139,7 +139,7 @@ public class ItemGridHandlerPortable implements IItemGridHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onShiftClick(EntityPlayerMP player, ItemStack stack) {
|
public ItemStack onShiftClick(EntityPlayerMP player, ItemStack stack) {
|
||||||
return RSUtils.transformNullToEmpty(onInsert(player, stack));
|
return StackUtils.nullToEmpty(onInsert(player, stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.item;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemWirelessCraftingMonitor;
|
import com.raoulvdberge.refinedstorage.item.ItemWirelessCraftingMonitor;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
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.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -39,7 +39,7 @@ public class NetworkItemWirelessCraftingMonitor implements INetworkItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player) || !network.getSecurityManager().hasPermission(Permission.AUTOCRAFTING, player)) {
|
if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player) || !network.getSecurityManager().hasPermission(Permission.AUTOCRAFTING, player)) {
|
||||||
RSUtils.sendNoPermissionMessage(player);
|
WorldUtils.sendNoPermissionMessage(player);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.item;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemWirelessFluidGrid;
|
import com.raoulvdberge.refinedstorage.item.ItemWirelessFluidGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessFluidGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.WirelessFluidGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
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.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -40,7 +40,7 @@ public class NetworkItemWirelessFluidGrid implements INetworkItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
|
if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
|
||||||
RSUtils.sendNoPermissionMessage(player);
|
WorldUtils.sendNoPermissionMessage(player);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.item;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItem;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid;
|
import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
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.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -40,7 +40,7 @@ public class NetworkItemWirelessGrid implements INetworkItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
|
if (!network.getSecurityManager().hasPermission(Permission.MODIFY, player)) {
|
||||||
RSUtils.sendNoPermissionMessage(player);
|
WorldUtils.sendNoPermissionMessage(player);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeVisitor;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeVisitor;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||||
@@ -10,6 +9,7 @@ import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
|||||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -113,7 +113,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
|
|||||||
couldUpdate = canUpdate;
|
couldUpdate = canUpdate;
|
||||||
|
|
||||||
if (hasConnectivityState()) {
|
if (hasConnectivityState()) {
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
@@ -13,6 +12,7 @@ import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockSkull;
|
import net.minecraft.block.BlockSkull;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
@@ -264,7 +264,7 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -276,7 +276,7 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -289,8 +289,8 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
|||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
tag.setBoolean(NBT_DROP, drop);
|
tag.setBoolean(NBT_DROP, drop);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 0, tag);
|
StackUtils.writeItems(itemFilters, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 2, tag);
|
StackUtils.writeItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -311,8 +311,8 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
|||||||
drop = tag.getBoolean(NBT_DROP);
|
drop = tag.getBoolean(NBT_DROP);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 0, tag);
|
StackUtils.readItems(itemFilters, 0, tag);
|
||||||
RSUtils.readItems(fluidFilters, 2, tag);
|
StackUtils.readItems(fluidFilters, 2, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDrop() {
|
public boolean isDrop() {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||||
@@ -10,6 +9,8 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -105,8 +106,8 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(patterns, 0, tag);
|
StackUtils.readItems(patterns, 0, tag);
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_BLOCKED)) {
|
if (tag.hasKey(NBT_BLOCKED)) {
|
||||||
blocked = tag.getBoolean(NBT_BLOCKED);
|
blocked = tag.getBoolean(NBT_BLOCKED);
|
||||||
@@ -122,8 +123,8 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(patterns, 0, tag);
|
StackUtils.writeItems(patterns, 0, tag);
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
|
|
||||||
tag.setBoolean(NBT_BLOCKED, blocked);
|
tag.setBoolean(NBT_BLOCKED, blocked);
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemHandler getFacingInventory() {
|
public IItemHandler getFacingInventory() {
|
||||||
return RSUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
return WorldUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||||
@@ -10,6 +9,7 @@ import com.raoulvdberge.refinedstorage.tile.craftingmonitor.ICraftingMonitor;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -100,7 +100,7 @@ public class NetworkNodeCraftingMonitor extends NetworkNode implements ICrafting
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(filter, 0, tag);
|
StackUtils.writeItems(filter, 0, tag);
|
||||||
|
|
||||||
tag.setBoolean(NBT_VIEW_AUTOMATED, viewAutomated);
|
tag.setBoolean(NBT_VIEW_AUTOMATED, viewAutomated);
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ public class NetworkNodeCraftingMonitor extends NetworkNode implements ICrafting
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(filter, 0, tag);
|
StackUtils.readItems(filter, 0, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_VIEW_AUTOMATED)) {
|
if (tag.hasKey(NBT_VIEW_AUTOMATED)) {
|
||||||
viewAutomated = tag.getBoolean(NBT_VIEW_AUTOMATED);
|
viewAutomated = tag.getBoolean(NBT_VIEW_AUTOMATED);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||||
@@ -12,6 +11,7 @@ import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
@@ -186,7 +186,7 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -198,7 +198,7 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -212,8 +212,8 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
|
|||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
tag.setBoolean(NBT_PICKUP, pickupItem);
|
tag.setBoolean(NBT_PICKUP, pickupItem);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 0, tag);
|
StackUtils.writeItems(itemFilters, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 2, tag);
|
StackUtils.writeItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -238,8 +238,8 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
|
|||||||
pickupItem = tag.getBoolean(NBT_PICKUP);
|
pickupItem = tag.getBoolean(NBT_PICKUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 0, tag);
|
StackUtils.readItems(itemFilters, 0, tag);
|
||||||
RSUtils.readItems(fluidFilters, 2, tag);
|
StackUtils.readItems(fluidFilters, 2, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IItemHandler getUpgrades() {
|
public IItemHandler getUpgrades() {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
@@ -14,6 +13,8 @@ import com.raoulvdberge.refinedstorage.tile.TileDetector;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -65,7 +66,7 @@ public class NetworkNodeDetector extends NetworkNode implements IComparable, ITy
|
|||||||
|
|
||||||
world.notifyNeighborsOfStateChange(pos, RSBlocks.DETECTOR, true);
|
world.notifyNeighborsOfStateChange(pos, RSBlocks.DETECTOR, true);
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network != null && canUpdate() && ticks % SPEED == 0) {
|
if (network != null && canUpdate() && ticks % SPEED == 0) {
|
||||||
@@ -195,8 +196,8 @@ public class NetworkNodeDetector extends NetworkNode implements IComparable, ITy
|
|||||||
tag.setInteger(NBT_AMOUNT, amount);
|
tag.setInteger(NBT_AMOUNT, amount);
|
||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 0, tag);
|
StackUtils.writeItems(itemFilters, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 1, tag);
|
StackUtils.writeItems(fluidFilters, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -221,8 +222,8 @@ public class NetworkNodeDetector extends NetworkNode implements IComparable, ITy
|
|||||||
type = tag.getInteger(NBT_TYPE);
|
type = tag.getInteger(NBT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 0, tag);
|
StackUtils.readItems(itemFilters, 0, tag);
|
||||||
RSUtils.readItems(fluidFilters, 1, tag);
|
StackUtils.readItems(fluidFilters, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IItemHandler getInventory() {
|
public IItemHandler getInventory() {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
@@ -15,6 +14,8 @@ import com.raoulvdberge.refinedstorage.item.filter.ItemFilter;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -61,7 +62,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
|||||||
|
|
||||||
if (network != null && canUpdate() && ticks % upgrades.getSpeed() == 0) {
|
if (network != null && canUpdate() && ticks % upgrades.getSpeed() == 0) {
|
||||||
if (type == IType.ITEMS) {
|
if (type == IType.ITEMS) {
|
||||||
IItemHandler handler = RSUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
IItemHandler handler = WorldUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
||||||
|
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
for (int i = 0; i < itemFilters.getSlots(); ++i) {
|
for (int i = 0; i < itemFilters.getSlots(); ++i) {
|
||||||
@@ -81,7 +82,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == IType.FLUIDS) {
|
} else if (type == IType.FLUIDS) {
|
||||||
IFluidHandler handler = RSUtils.getFluidHandler(getFacingTile(), getDirection().getOpposite());
|
IFluidHandler handler = WorldUtils.getFluidHandler(getFacingTile(), getDirection().getOpposite());
|
||||||
|
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
for (FluidStack stack : fluidFilters.getFluids()) {
|
for (FluidStack stack : fluidFilters.getFluids()) {
|
||||||
@@ -208,7 +209,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -220,7 +221,7 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -234,8 +235,8 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
|||||||
tag.setBoolean(NBT_REGULATOR, regulator);
|
tag.setBoolean(NBT_REGULATOR, regulator);
|
||||||
tag.setBoolean(NBT_CRAFT_ONLY, craftOnly);
|
tag.setBoolean(NBT_CRAFT_ONLY, craftOnly);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 0, tag);
|
StackUtils.writeItems(itemFilters, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 2, tag);
|
StackUtils.writeItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -260,8 +261,8 @@ public class NetworkNodeExporter extends NetworkNode implements IComparable, ITy
|
|||||||
craftOnly = tag.getBoolean(NBT_CRAFT_ONLY);
|
craftOnly = tag.getBoolean(NBT_CRAFT_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 0, tag);
|
StackUtils.readItems(itemFilters, 0, tag);
|
||||||
RSUtils.readItems(fluidFilters, 2, tag);
|
StackUtils.readItems(fluidFilters, 2, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IItemHandler getUpgrades() {
|
public IItemHandler getUpgrades() {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.*;
|
import com.raoulvdberge.refinedstorage.inventory.*;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -79,10 +79,10 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
ItemStack container = in.getStackInSlot(0);
|
ItemStack container = in.getStackInSlot(0);
|
||||||
|
|
||||||
if (!container.isEmpty()) {
|
if (!container.isEmpty()) {
|
||||||
Pair<ItemStack, FluidStack> result = RSUtils.getFluidFromStack(container, true);
|
Pair<ItemStack, FluidStack> result = StackUtils.getFluid(container, true);
|
||||||
|
|
||||||
if (result.getValue() != null && tankIn.fillInternal(result.getValue(), false) == result.getValue().amount) {
|
if (result.getValue() != null && tankIn.fillInternal(result.getValue(), false) == result.getValue().amount) {
|
||||||
result = RSUtils.getFluidFromStack(container, false);
|
result = StackUtils.getFluid(container, false);
|
||||||
|
|
||||||
tankIn.fillInternal(result.getValue(), true);
|
tankIn.fillInternal(result.getValue(), true);
|
||||||
|
|
||||||
@@ -151,8 +151,8 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 0, tag);
|
StackUtils.writeItems(upgrades, 0, tag);
|
||||||
RSUtils.writeItems(in, 1, tag);
|
StackUtils.writeItems(in, 1, tag);
|
||||||
|
|
||||||
tag.setTag(NBT_TANK_IN, tankIn.writeToNBT(new NBTTagCompound()));
|
tag.setTag(NBT_TANK_IN, tankIn.writeToNBT(new NBTTagCompound()));
|
||||||
tag.setTag(NBT_TANK_OUT, tankOut.writeToNBT(new NBTTagCompound()));
|
tag.setTag(NBT_TANK_OUT, tankOut.writeToNBT(new NBTTagCompound()));
|
||||||
@@ -164,8 +164,8 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 0, tag);
|
StackUtils.readItems(upgrades, 0, tag);
|
||||||
RSUtils.readItems(in, 1, tag);
|
StackUtils.readItems(in, 1, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_TANK_IN)) {
|
if (tag.hasKey(NBT_TANK_IN)) {
|
||||||
tankIn.readFromNBT(tag.getCompoundTag(NBT_TANK_IN));
|
tankIn.readFromNBT(tag.getCompoundTag(NBT_TANK_IN));
|
||||||
@@ -185,7 +185,7 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(out, 2, tag);
|
StackUtils.writeItems(out, 2, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ public class NetworkNodeFluidInterface extends NetworkNode implements IComparabl
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(out, 2, tag);
|
StackUtils.readItems(out, 2, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_COMPARE)) {
|
if (tag.hasKey(NBT_COMPARE)) {
|
||||||
compare = tag.getInteger(NBT_COMPARE);
|
compare = tag.getInteger(NBT_COMPARE);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
@@ -16,6 +15,8 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileFluidStorage;
|
import com.raoulvdberge.refinedstorage.tile.TileFluidStorage;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -49,7 +50,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IGuiStorage,
|
|||||||
@Nullable
|
@Nullable
|
||||||
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(filters, mode, compare, stack)) {
|
if (!IFilterable.canTakeFluids(filters, mode, compare, stack)) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.insert(stack, size, simulate);
|
return super.insert(stack, size, simulate);
|
||||||
@@ -160,14 +161,14 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IGuiStorage,
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(filters, 0, tag);
|
StackUtils.writeItems(filters, 0, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_PRIORITY, priority);
|
tag.setInteger(NBT_PRIORITY, priority);
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
tag.setInteger(NBT_MODE, mode);
|
tag.setInteger(NBT_MODE, mode);
|
||||||
tag.setBoolean(NBT_VOID_EXCESS, voidExcess);
|
tag.setBoolean(NBT_VOID_EXCESS, voidExcess);
|
||||||
|
|
||||||
RSUtils.writeAccessType(tag, accessType);
|
AccessTypeUtils.writeAccessType(tag, accessType);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -176,7 +177,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IGuiStorage,
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(filters, 0, tag);
|
StackUtils.readItems(filters, 0, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_PRIORITY)) {
|
if (tag.hasKey(NBT_PRIORITY)) {
|
||||||
priority = tag.getInteger(NBT_PRIORITY);
|
priority = tag.getInteger(NBT_PRIORITY);
|
||||||
@@ -194,7 +195,7 @@ public class NetworkNodeFluidStorage extends NetworkNode implements IGuiStorage,
|
|||||||
voidExcess = tag.getBoolean(NBT_VOID_EXCESS);
|
voidExcess = tag.getBoolean(NBT_VOID_EXCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
accessType = RSUtils.readAccessType(tag);
|
accessType = AccessTypeUtils.readAccessType(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FluidStorageType getType() {
|
public FluidStorageType getType() {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
@@ -20,6 +19,7 @@ import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.inventory.*;
|
import net.minecraft.inventory.*;
|
||||||
@@ -291,7 +291,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGrid {
|
|||||||
ItemStack took = network.extractItem(possibility, 1, IComparer.COMPARE_NBT | IComparer.COMPARE_STRIP_NBT | (possibility.getItem().isDamageable() ? 0 : IComparer.COMPARE_DAMAGE), false);
|
ItemStack took = network.extractItem(possibility, 1, IComparer.COMPARE_NBT | IComparer.COMPARE_STRIP_NBT | (possibility.getItem().isDamageable() ? 0 : IComparer.COMPARE_DAMAGE), false);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
matrix.setInventorySlotContents(i, RSUtils.transformNullToEmpty(took));
|
matrix.setInventorySlotContents(i, StackUtils.nullToEmpty(took));
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGrid {
|
|||||||
}
|
}
|
||||||
} else if (!slot.isEmpty()) {
|
} else if (!slot.isEmpty()) {
|
||||||
if (slot.getCount() == 1 && network != null) {
|
if (slot.getCount() == 1 && network != null) {
|
||||||
matrix.setInventorySlotContents(i, RSUtils.transformNullToEmpty(network.extractItem(slot, 1, false)));
|
matrix.setInventorySlotContents(i, StackUtils.nullToEmpty(network.extractItem(slot, 1, false)));
|
||||||
} else {
|
} else {
|
||||||
matrix.decrStackSize(i, 1);
|
matrix.decrStackSize(i, 1);
|
||||||
}
|
}
|
||||||
@@ -545,10 +545,10 @@ public class NetworkNodeGrid extends NetworkNode implements IGrid {
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItemsLegacy(matrix, 0, tag);
|
StackUtils.readItems(matrix, 0, tag);
|
||||||
RSUtils.readItems(patterns, 1, tag);
|
StackUtils.readItems(patterns, 1, tag);
|
||||||
RSUtils.readItems(filter, 2, tag);
|
StackUtils.readItems(filter, 2, tag);
|
||||||
RSUtils.readItems(matrixProcessing, 3, tag);
|
StackUtils.readItems(matrixProcessing, 3, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_TAB_SELECTED)) {
|
if (tag.hasKey(NBT_TAB_SELECTED)) {
|
||||||
tabSelected = tag.getInteger(NBT_TAB_SELECTED);
|
tabSelected = tag.getInteger(NBT_TAB_SELECTED);
|
||||||
@@ -564,10 +564,10 @@ public class NetworkNodeGrid extends NetworkNode implements IGrid {
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItemsLegacy(matrix, 0, tag);
|
StackUtils.writeItems(matrix, 0, tag);
|
||||||
RSUtils.writeItems(patterns, 1, tag);
|
StackUtils.writeItems(patterns, 1, tag);
|
||||||
RSUtils.writeItems(filter, 2, tag);
|
StackUtils.writeItems(filter, 2, tag);
|
||||||
RSUtils.writeItems(matrixProcessing, 3, tag);
|
StackUtils.writeItems(matrixProcessing, 3, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_TAB_SELECTED, tabSelected);
|
tag.setInteger(NBT_TAB_SELECTED, tabSelected);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||||
@@ -13,6 +12,8 @@ import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -60,7 +61,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
|||||||
|
|
||||||
if (type == IType.ITEMS) {
|
if (type == IType.ITEMS) {
|
||||||
TileEntity facing = getFacingTile();
|
TileEntity facing = getFacingTile();
|
||||||
IItemHandler handler = RSUtils.getItemHandler(facing, getDirection().getOpposite());
|
IItemHandler handler = WorldUtils.getItemHandler(facing, getDirection().getOpposite());
|
||||||
|
|
||||||
if (facing instanceof TileDiskDrive || handler == null) {
|
if (facing instanceof TileDiskDrive || handler == null) {
|
||||||
return;
|
return;
|
||||||
@@ -88,7 +89,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == IType.FLUIDS && ticks % upgrades.getSpeed() == 0) {
|
} else if (type == IType.FLUIDS && ticks % upgrades.getSpeed() == 0) {
|
||||||
IFluidHandler handler = RSUtils.getFluidHandler(getFacingTile(), getDirection().getOpposite());
|
IFluidHandler handler = WorldUtils.getFluidHandler(getFacingTile(), getDirection().getOpposite());
|
||||||
|
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
||||||
@@ -136,7 +137,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -148,7 +149,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -161,8 +162,8 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
|||||||
tag.setInteger(NBT_MODE, mode);
|
tag.setInteger(NBT_MODE, mode);
|
||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 0, tag);
|
StackUtils.writeItems(itemFilters, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 2, tag);
|
StackUtils.writeItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -183,8 +184,8 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
|||||||
type = tag.getInteger(NBT_TYPE);
|
type = tag.getInteger(NBT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 0, tag);
|
StackUtils.readItems(itemFilters, 0, tag);
|
||||||
RSUtils.readItems(fluidFilters, 2, tag);
|
StackUtils.readItems(fluidFilters, 2, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IItemHandler getUpgrades() {
|
public IItemHandler getUpgrades() {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
@@ -9,6 +8,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.Stor
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.*;
|
import com.raoulvdberge.refinedstorage.inventory.*;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -80,10 +80,10 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
|
|
||||||
if (wanted.isEmpty()) {
|
if (wanted.isEmpty()) {
|
||||||
if (!got.isEmpty()) {
|
if (!got.isEmpty()) {
|
||||||
exportItems.setStackInSlot(i, RSUtils.transformNullToEmpty(network.insertItemTracked(got, got.getCount())));
|
exportItems.setStackInSlot(i, StackUtils.nullToEmpty(network.insertItemTracked(got, got.getCount())));
|
||||||
}
|
}
|
||||||
} else if (!got.isEmpty() && !API.instance().getComparer().isEqualNoQuantity(wanted, got)) {
|
} else if (!got.isEmpty() && !API.instance().getComparer().isEqualNoQuantity(wanted, got)) {
|
||||||
exportItems.setStackInSlot(i, RSUtils.transformNullToEmpty(network.insertItemTracked(got, got.getCount())));
|
exportItems.setStackInSlot(i, StackUtils.nullToEmpty(network.insertItemTracked(got, got.getCount())));
|
||||||
} else {
|
} else {
|
||||||
int delta = got.isEmpty() ? wanted.getCount() : (wanted.getCount() - got.getCount());
|
int delta = got.isEmpty() ? wanted.getCount() : (wanted.getCount() - got.getCount());
|
||||||
|
|
||||||
@@ -149,9 +149,9 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(importItems, 0, tag);
|
StackUtils.readItems(importItems, 0, tag);
|
||||||
RSUtils.readItems(exportItems, 2, tag);
|
StackUtils.readItems(exportItems, 2, tag);
|
||||||
RSUtils.readItems(upgrades, 3, tag);
|
StackUtils.readItems(upgrades, 3, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,9 +163,9 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(importItems, 0, tag);
|
StackUtils.writeItems(importItems, 0, tag);
|
||||||
RSUtils.writeItems(exportItems, 2, tag);
|
StackUtils.writeItems(exportItems, 2, tag);
|
||||||
RSUtils.writeItems(upgrades, 3, tag);
|
StackUtils.writeItems(upgrades, 3, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(exportSpecimenItems, 1, tag);
|
StackUtils.writeItems(exportSpecimenItems, 1, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ public class NetworkNodeInterface extends NetworkNode implements IComparable {
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(exportSpecimenItems, 1, tag);
|
StackUtils.readItems(exportSpecimenItems, 1, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_COMPARE)) {
|
if (tag.hasKey(NBT_COMPARE)) {
|
||||||
compare = tag.getInteger(NBT_COMPARE);
|
compare = tag.getInteger(NBT_COMPARE);
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemValidatorBasic;
|
import com.raoulvdberge.refinedstorage.inventory.ItemValidatorBasic;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemNetworkCard;
|
import com.raoulvdberge.refinedstorage.item.ItemNetworkCard;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -64,8 +64,8 @@ public class NetworkNodeNetworkTransmitter extends NetworkNode {
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(networkCard, 0, tag);
|
StackUtils.writeItems(networkCard, 0, tag);
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -74,8 +74,8 @@ public class NetworkNodeNetworkTransmitter extends NetworkNode {
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(networkCard, 0, tag);
|
StackUtils.readItems(networkCard, 0, tag);
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.ISecurityCard;
|
import com.raoulvdberge.refinedstorage.api.network.security.ISecurityCard;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.ISecurityCardContainer;
|
import com.raoulvdberge.refinedstorage.api.network.security.ISecurityCardContainer;
|
||||||
@@ -12,6 +11,7 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemValidatorBasic;
|
import com.raoulvdberge.refinedstorage.inventory.ItemValidatorBasic;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemSecurityCard;
|
import com.raoulvdberge.refinedstorage.item.ItemSecurityCard;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -119,8 +119,8 @@ public class NetworkNodeSecurityManager extends NetworkNode implements ISecurity
|
|||||||
owner = UUID.fromString(tag.getString(NBT_OWNER));
|
owner = UUID.fromString(tag.getString(NBT_OWNER));
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(cards, 0, tag);
|
StackUtils.readItems(cards, 0, tag);
|
||||||
RSUtils.readItems(editCard, 1, tag);
|
StackUtils.readItems(editCard, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -136,8 +136,8 @@ public class NetworkNodeSecurityManager extends NetworkNode implements ISecurity
|
|||||||
tag.setString(NBT_OWNER, owner.toString());
|
tag.setString(NBT_OWNER, owner.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(cards, 0, tag);
|
StackUtils.writeItems(cards, 0, tag);
|
||||||
RSUtils.writeItems(editCard, 1, tag);
|
StackUtils.writeItems(editCard, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
@@ -11,6 +10,8 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerProxy;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerProxy;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -78,7 +79,7 @@ public class NetworkNodeSolderer extends NetworkNode {
|
|||||||
|
|
||||||
markDirty();
|
markDirty();
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network == null || !canUpdate()) {
|
if (network == null || !canUpdate()) {
|
||||||
@@ -147,9 +148,9 @@ public class NetworkNodeSolderer extends NetworkNode {
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(ingredients, 0, tag);
|
StackUtils.readItems(ingredients, 0, tag);
|
||||||
RSUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
RSUtils.readItems(result, 2, tag);
|
StackUtils.readItems(result, 2, tag);
|
||||||
|
|
||||||
recipe = API.instance().getSoldererRegistry().getRecipe(ingredients);
|
recipe = API.instance().getSoldererRegistry().getRecipe(ingredients);
|
||||||
|
|
||||||
@@ -172,9 +173,9 @@ public class NetworkNodeSolderer extends NetworkNode {
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(ingredients, 0, tag);
|
StackUtils.writeItems(ingredients, 0, tag);
|
||||||
RSUtils.writeItems(upgrades, 1, tag);
|
StackUtils.writeItems(upgrades, 1, tag);
|
||||||
RSUtils.writeItems(result, 2, tag);
|
StackUtils.writeItems(result, 2, tag);
|
||||||
|
|
||||||
tag.setBoolean(NBT_WORKING, working);
|
tag.setBoolean(NBT_WORKING, working);
|
||||||
tag.setInteger(NBT_PROGRESS, progress);
|
tag.setInteger(NBT_PROGRESS, progress);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
@@ -16,6 +15,8 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileStorage;
|
import com.raoulvdberge.refinedstorage.tile.TileStorage;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -155,14 +156,14 @@ public class NetworkNodeStorage extends NetworkNode implements IGuiStorage, ISto
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(filters, 0, tag);
|
StackUtils.writeItems(filters, 0, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_PRIORITY, priority);
|
tag.setInteger(NBT_PRIORITY, priority);
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
tag.setInteger(NBT_MODE, mode);
|
tag.setInteger(NBT_MODE, mode);
|
||||||
tag.setBoolean(NBT_VOID_EXCESS, voidExcess);
|
tag.setBoolean(NBT_VOID_EXCESS, voidExcess);
|
||||||
|
|
||||||
RSUtils.writeAccessType(tag, accessType);
|
AccessTypeUtils.writeAccessType(tag, accessType);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -171,7 +172,7 @@ public class NetworkNodeStorage extends NetworkNode implements IGuiStorage, ISto
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(filters, 0, tag);
|
StackUtils.readItems(filters, 0, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_PRIORITY)) {
|
if (tag.hasKey(NBT_PRIORITY)) {
|
||||||
priority = tag.getInteger(NBT_PRIORITY);
|
priority = tag.getInteger(NBT_PRIORITY);
|
||||||
@@ -189,7 +190,7 @@ public class NetworkNodeStorage extends NetworkNode implements IGuiStorage, ISto
|
|||||||
voidExcess = tag.getBoolean(NBT_VOID_EXCESS);
|
voidExcess = tag.getBoolean(NBT_VOID_EXCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
accessType = RSUtils.readAccessType(tag);
|
accessType = AccessTypeUtils.readAccessType(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStorageType getType() {
|
public ItemStorageType getType() {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
@@ -11,6 +10,8 @@ import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryHelper;
|
import net.minecraft.inventory.InventoryHelper;
|
||||||
@@ -39,7 +40,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
public void onContentsChanged(int slot) {
|
public void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
public void onContentsChanged(int slot) {
|
public void onContentsChanged(int slot) {
|
||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
} else if (oldAmount != newAmount) {
|
} else if (oldAmount != newAmount) {
|
||||||
oldAmount = newAmount;
|
oldAmount = newAmount;
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
ItemStack toInsert = player.inventory.getStackInSlot(i);
|
ItemStack toInsert = player.inventory.getStackInSlot(i);
|
||||||
|
|
||||||
if (API.instance().getComparer().isEqual(inserted, toInsert, compare)) {
|
if (API.instance().getComparer().isEqual(inserted, toInsert, compare)) {
|
||||||
player.inventory.setInventorySlotContents(i, RSUtils.transformNullToEmpty(network.insertItemTracked(toInsert, toInsert.getCount())));
|
player.inventory.setInventorySlotContents(i, StackUtils.nullToEmpty(network.insertItemTracked(toInsert, toInsert.getCount())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +122,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
ItemStack filter = itemFilter.getStackInSlot(0);
|
ItemStack filter = itemFilter.getStackInSlot(0);
|
||||||
|
|
||||||
if (!filter.isEmpty() && API.instance().getComparer().isEqual(filter, toInsert, compare)) {
|
if (!filter.isEmpty() && API.instance().getComparer().isEqual(filter, toInsert, compare)) {
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, RSUtils.transformNullToEmpty(network.insertItemTracked(toInsert, toInsert.getCount())));
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, StackUtils.nullToEmpty(network.insertItemTracked(toInsert, toInsert.getCount())));
|
||||||
|
|
||||||
deposits.put(player.getGameProfile().getName(), Pair.of(toInsert, Minecraft.getSystemTime()));
|
deposits.put(player.getGameProfile().getName(), Pair.of(toInsert, Minecraft.getSystemTime()));
|
||||||
}
|
}
|
||||||
@@ -172,7 +173,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
public void setCompare(int compare) {
|
public void setCompare(int compare) {
|
||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
@@ -186,7 +187,7 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
@@ -203,8 +204,8 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilter, 0, tag);
|
StackUtils.writeItems(itemFilter, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilter, 1, tag);
|
StackUtils.writeItems(fluidFilter, 1, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -221,8 +222,8 @@ public class NetworkNodeStorageMonitor extends NetworkNode implements IComparabl
|
|||||||
type = tag.getInteger(NBT_TYPE);
|
type = tag.getInteger(NBT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(itemFilter, 0, tag);
|
StackUtils.readItems(itemFilter, 0, tag);
|
||||||
RSUtils.readItems(fluidFilter, 1, tag);
|
StackUtils.readItems(fluidFilter, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemHandlerBase getItemFilter() {
|
public ItemHandlerBase getItemFilter() {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.IWirelessTransmitter;
|
import com.raoulvdberge.refinedstorage.api.network.IWirelessTransmitter;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerUpgrade;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -33,7 +33,7 @@ public class NetworkNodeWirelessTransmitter extends NetworkNode implements IWire
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 0, tag);
|
StackUtils.readItems(upgrades, 0, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +45,7 @@ public class NetworkNodeWirelessTransmitter extends NetworkNode implements IWire
|
|||||||
public NBTTagCompound write(NBTTagCompound tag) {
|
public NBTTagCompound write(NBTTagCompound tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 0, tag);
|
StackUtils.writeItems(upgrades, 0, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.*;
|
import com.raoulvdberge.refinedstorage.api.storage.*;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
@@ -13,6 +12,9 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -42,7 +44,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||||
RSUtils.createStorages(
|
StackUtils.createStorages(
|
||||||
getStackInSlot(slot),
|
getStackInSlot(slot),
|
||||||
slot,
|
slot,
|
||||||
itemStorages,
|
itemStorages,
|
||||||
@@ -56,7 +58,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
network.getFluidStorageCache().invalidate();
|
network.getFluidStorageCache().invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +135,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
network.getItemStorageCache().invalidate();
|
network.getItemStorageCache().invalidate();
|
||||||
network.getFluidStorageCache().invalidate();
|
network.getFluidStorageCache().invalidate();
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,7 +160,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(disks, 0, tag);
|
StackUtils.readItems(disks, 0, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -180,7 +182,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(disks, 0, tag);
|
StackUtils.writeItems(disks, 0, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -189,8 +191,8 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 1, tag);
|
StackUtils.writeItems(itemFilters, 1, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 2, tag);
|
StackUtils.writeItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_PRIORITY, priority);
|
tag.setInteger(NBT_PRIORITY, priority);
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
@@ -198,7 +200,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
tag.setBoolean(NBT_VOID_EXCESS, voidExcess);
|
tag.setBoolean(NBT_VOID_EXCESS, voidExcess);
|
||||||
|
|
||||||
RSUtils.writeAccessType(tag, accessType);
|
AccessTypeUtils.writeAccessType(tag, accessType);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -207,8 +209,8 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 1, tag);
|
StackUtils.readItems(itemFilters, 1, tag);
|
||||||
RSUtils.readItems(fluidFilters, 2, tag);
|
StackUtils.readItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_PRIORITY)) {
|
if (tag.hasKey(NBT_PRIORITY)) {
|
||||||
priority = tag.getInteger(NBT_PRIORITY);
|
priority = tag.getInteger(NBT_PRIORITY);
|
||||||
@@ -230,7 +232,7 @@ public class NetworkNodeDiskDrive extends NetworkNode implements IGuiStorage, IS
|
|||||||
voidExcess = tag.getBoolean(NBT_VOID_EXCESS);
|
voidExcess = tag.getBoolean(NBT_VOID_EXCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
accessType = RSUtils.readAccessType(tag);
|
accessType = AccessTypeUtils.readAccessType(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ public class StorageFluidDiskDrive implements IStorageDisk<FluidStack> {
|
|||||||
if (lastState != currentState) {
|
if (lastState != currentState) {
|
||||||
lastState = currentState;
|
lastState = currentState;
|
||||||
|
|
||||||
RSUtils.updateBlock(diskDrive.getWorld(), diskDrive.getPos());
|
WorldUtils.updateBlock(diskDrive.getWorld(), diskDrive.getPos());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
diskDrive::getVoidExcess,
|
diskDrive::getVoidExcess,
|
||||||
@@ -59,7 +60,7 @@ public class StorageFluidDiskDrive implements IStorageDisk<FluidStack> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(diskDrive.getFluidFilters(), diskDrive.getMode(), diskDrive.getCompare(), stack)) {
|
if (!IFilterable.canTakeFluids(diskDrive.getFluidFilters(), diskDrive.getMode(), diskDrive.getCompare(), stack)) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent.insert(stack, size, simulate);
|
return parent.insert(stack, size, simulate);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public class StorageItemDiskDrive implements IStorageDisk<ItemStack> {
|
|||||||
if (lastState != currentState) {
|
if (lastState != currentState) {
|
||||||
lastState = currentState;
|
lastState = currentState;
|
||||||
|
|
||||||
RSUtils.updateBlock(diskDrive.getWorld(), diskDrive.getPos());
|
WorldUtils.updateBlock(diskDrive.getWorld(), diskDrive.getPos());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
diskDrive::getVoidExcess,
|
diskDrive::getVoidExcess,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskmanipulator;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskmanipulator;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||||
@@ -15,6 +14,8 @@ import com.raoulvdberge.refinedstorage.tile.TileDiskManipulator;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -56,7 +57,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||||
RSUtils.createStorages(
|
StackUtils.createStorages(
|
||||||
getStackInSlot(slot),
|
getStackInSlot(slot),
|
||||||
slot,
|
slot,
|
||||||
itemStorages,
|
itemStorages,
|
||||||
@@ -65,7 +66,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
s -> new StorageFluidDiskManipulator(NetworkNodeDiskManipulator.this, s)
|
s -> new StorageFluidDiskManipulator(NetworkNodeDiskManipulator.this, s)
|
||||||
);
|
);
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
super.onContentsChanged(slot);
|
super.onContentsChanged(slot);
|
||||||
|
|
||||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||||
RSUtils.createStorages(
|
StackUtils.createStorages(
|
||||||
getStackInSlot(slot),
|
getStackInSlot(slot),
|
||||||
3 + slot,
|
3 + slot,
|
||||||
itemStorages,
|
itemStorages,
|
||||||
@@ -99,7 +100,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
s -> new StorageFluidDiskManipulator(NetworkNodeDiskManipulator.this, s)
|
s -> new StorageFluidDiskManipulator(NetworkNodeDiskManipulator.this, s)
|
||||||
);
|
);
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -422,9 +423,9 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
public void read(NBTTagCompound tag) {
|
public void read(NBTTagCompound tag) {
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
RSUtils.readItems(upgrades, 3, tag);
|
StackUtils.readItems(upgrades, 3, tag);
|
||||||
RSUtils.readItems(inputDisks, 4, tag);
|
StackUtils.readItems(inputDisks, 4, tag);
|
||||||
RSUtils.readItems(outputDisks, 5, tag);
|
StackUtils.readItems(outputDisks, 5, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -438,9 +439,9 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
|
|
||||||
onBreak();
|
onBreak();
|
||||||
|
|
||||||
RSUtils.writeItems(upgrades, 3, tag);
|
StackUtils.writeItems(upgrades, 3, tag);
|
||||||
RSUtils.writeItems(inputDisks, 4, tag);
|
StackUtils.writeItems(inputDisks, 4, tag);
|
||||||
RSUtils.writeItems(outputDisks, 5, tag);
|
StackUtils.writeItems(outputDisks, 5, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -449,8 +450,8 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 1, tag);
|
StackUtils.writeItems(itemFilters, 1, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 2, tag);
|
StackUtils.writeItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
tag.setInteger(NBT_MODE, mode);
|
tag.setInteger(NBT_MODE, mode);
|
||||||
@@ -464,8 +465,8 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 1, tag);
|
StackUtils.readItems(itemFilters, 1, tag);
|
||||||
RSUtils.readItems(fluidFilters, 2, tag);
|
StackUtils.readItems(fluidFilters, 2, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_COMPARE)) {
|
if (tag.hasKey(NBT_COMPARE)) {
|
||||||
compare = tag.getInteger(NBT_COMPARE);
|
compare = tag.getInteger(NBT_COMPARE);
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskmanipulator;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskmanipulator;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ public class StorageFluidDiskManipulator implements IStorageDisk<FluidStack> {
|
|||||||
if (lastState != currentState) {
|
if (lastState != currentState) {
|
||||||
lastState = currentState;
|
lastState = currentState;
|
||||||
|
|
||||||
RSUtils.updateBlock(diskManipulator.getWorld(), diskManipulator.getPos());
|
WorldUtils.updateBlock(diskManipulator.getWorld(), diskManipulator.getPos());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() -> false,
|
() -> false,
|
||||||
@@ -79,7 +80,7 @@ public class StorageFluidDiskManipulator implements IStorageDisk<FluidStack> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (!IFilterable.canTakeFluids(diskManipulator.getFluidFilters(), diskManipulator.getMode(), diskManipulator.getCompare(), stack)) {
|
if (!IFilterable.canTakeFluids(diskManipulator.getFluidFilters(), diskManipulator.getMode(), diskManipulator.getCompare(), stack)) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent.insert(stack, size, simulate);
|
return parent.insert(stack, size, simulate);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskmanipulator;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.diskmanipulator;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public class StorageItemDiskManipulator implements IStorageDisk<ItemStack> {
|
|||||||
if (lastState != currentState) {
|
if (lastState != currentState) {
|
||||||
lastState = currentState;
|
lastState = currentState;
|
||||||
|
|
||||||
RSUtils.updateBlock(diskManipulator.getWorld(), diskManipulator.getPos());
|
WorldUtils.updateBlock(diskManipulator.getWorld(), diskManipulator.getPos());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() -> false,
|
() -> false,
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
||||||
|
|
||||||
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
|
|
||||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
@@ -19,6 +17,9 @@ import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileExternalStorage;
|
import com.raoulvdberge.refinedstorage.tile.TileExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.*;
|
import com.raoulvdberge.refinedstorage.tile.config.*;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -111,15 +112,15 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
|
||||||
super.writeConfiguration(tag);
|
super.writeConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.writeItems(itemFilters, 0, tag);
|
StackUtils.writeItems(itemFilters, 0, tag);
|
||||||
RSUtils.writeItems(fluidFilters, 1, tag);
|
StackUtils.writeItems(fluidFilters, 1, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_PRIORITY, priority);
|
tag.setInteger(NBT_PRIORITY, priority);
|
||||||
tag.setInteger(NBT_COMPARE, compare);
|
tag.setInteger(NBT_COMPARE, compare);
|
||||||
tag.setInteger(NBT_MODE, mode);
|
tag.setInteger(NBT_MODE, mode);
|
||||||
tag.setInteger(NBT_TYPE, type);
|
tag.setInteger(NBT_TYPE, type);
|
||||||
|
|
||||||
RSUtils.writeAccessType(tag, accessType);
|
AccessTypeUtils.writeAccessType(tag, accessType);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -128,8 +129,8 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
public void readConfiguration(NBTTagCompound tag) {
|
public void readConfiguration(NBTTagCompound tag) {
|
||||||
super.readConfiguration(tag);
|
super.readConfiguration(tag);
|
||||||
|
|
||||||
RSUtils.readItems(itemFilters, 0, tag);
|
StackUtils.readItems(itemFilters, 0, tag);
|
||||||
RSUtils.readItems(fluidFilters, 1, tag);
|
StackUtils.readItems(fluidFilters, 1, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_PRIORITY)) {
|
if (tag.hasKey(NBT_PRIORITY)) {
|
||||||
priority = tag.getInteger(NBT_PRIORITY);
|
priority = tag.getInteger(NBT_PRIORITY);
|
||||||
@@ -147,7 +148,7 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
type = tag.getInteger(NBT_TYPE);
|
type = tag.getInteger(NBT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
accessType = RSUtils.readAccessType(tag);
|
accessType = AccessTypeUtils.readAccessType(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -209,17 +210,17 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
|||||||
return (f != null && f.hasCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite())) ? f.getCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite()) : null;
|
return (f != null && f.hasCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite())) ? f.getCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite()) : null;
|
||||||
}));
|
}));
|
||||||
} else if (!(facing.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()) && facing.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()).getNode() instanceof IStorageProvider)) {
|
} else if (!(facing.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()) && facing.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()).getNode() instanceof IStorageProvider)) {
|
||||||
IItemHandler itemHandler = RSUtils.getItemHandler(facing, getDirection().getOpposite());
|
IItemHandler itemHandler = WorldUtils.getItemHandler(facing, getDirection().getOpposite());
|
||||||
|
|
||||||
if (itemHandler != null) {
|
if (itemHandler != null) {
|
||||||
itemStorages.add(new StorageItemItemHandler(this, () -> RSUtils.getItemHandler(getFacingTile(), getDirection().getOpposite())));
|
itemStorages.add(new StorageItemItemHandler(this, () -> WorldUtils.getItemHandler(getFacingTile(), getDirection().getOpposite())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == IType.FLUIDS) {
|
} else if (type == IType.FLUIDS) {
|
||||||
IFluidHandler fluidHandler = RSUtils.getFluidHandler(facing, getDirection().getOpposite());
|
IFluidHandler fluidHandler = WorldUtils.getFluidHandler(facing, getDirection().getOpposite());
|
||||||
|
|
||||||
if (fluidHandler != null) {
|
if (fluidHandler != null) {
|
||||||
fluidStorages.add(new StorageFluidExternal(this, () -> RSUtils.getFluidHandler(getFacingTile(), getDirection().getOpposite())));
|
fluidStorages.add(new StorageFluidExternal(this, () -> WorldUtils.getFluidHandler(getFacingTile(), getDirection().getOpposite())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||||
@@ -46,16 +46,16 @@ public class StorageFluidExternal implements IStorage<FluidStack> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public FluidStack insert(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (getProperties() != null && IFilterable.canTakeFluids(externalStorage.getFluidFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack) && getProperties().canFillFluidType(stack)) {
|
if (getProperties() != null && IFilterable.canTakeFluids(externalStorage.getFluidFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack) && getProperties().canFillFluidType(stack)) {
|
||||||
int filled = handlerSupplier.get().fill(RSUtils.copyStackWithSize(stack, size), !simulate);
|
int filled = handlerSupplier.get().fill(StackUtils.copy(stack, size), !simulate);
|
||||||
|
|
||||||
if (filled == size) {
|
if (filled == size) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.copyStackWithSize(stack, size - filled);
|
return StackUtils.copy(stack, size - filled);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,7 +67,7 @@ public class StorageFluidExternal implements IStorage<FluidStack> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidStack toDrain = RSUtils.copyStackWithSize(stack, size);
|
FluidStack toDrain = StackUtils.copy(stack, size);
|
||||||
|
|
||||||
if (API.instance().getComparer().isEqual(getContents(), toDrain, flags)) {
|
if (API.instance().getComparer().isEqual(getContents(), toDrain, flags)) {
|
||||||
return handler.drain(toDrain, !simulate);
|
return handler.drain(toDrain, !simulate);
|
||||||
@@ -107,9 +107,9 @@ public class StorageFluidExternal implements IStorage<FluidStack> {
|
|||||||
FluidStack stack = getContents();
|
FluidStack stack = getContents();
|
||||||
|
|
||||||
if (cache == null) {
|
if (cache == null) {
|
||||||
cache = RSUtils.copyStack(stack);
|
cache = StackUtils.copy(stack);
|
||||||
} else if (!API.instance().getComparer().isEqual(stack, cache, IComparer.COMPARE_NBT | IComparer.COMPARE_QUANTITY)) {
|
} else if (!API.instance().getComparer().isEqual(stack, cache, IComparer.COMPARE_NBT | IComparer.COMPARE_QUANTITY)) {
|
||||||
cache = RSUtils.copyStack(stack);
|
cache = StackUtils.copy(stack);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -118,6 +118,6 @@ public class StorageFluidExternal implements IStorage<FluidStack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCacheForcefully() {
|
public void updateCacheForcefully() {
|
||||||
cache = RSUtils.copyStack(getContents());
|
cache = StackUtils.copy(getContents());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
import com.raoulvdberge.refinedstorage.tile.config.IFilterable;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
@@ -68,7 +68,7 @@ public class StorageItemItemHandler extends StorageItemExternal {
|
|||||||
IItemHandler handler = handlerSupplier.get();
|
IItemHandler handler = handlerSupplier.get();
|
||||||
|
|
||||||
if (handler != null && IFilterable.canTake(externalStorage.getItemFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack)) {
|
if (handler != null && IFilterable.canTake(externalStorage.getItemFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack)) {
|
||||||
return RSUtils.transformEmptyToNull(ItemHandlerHelper.insertItem(handler, ItemHandlerHelper.copyStackWithSize(stack, size), simulate));
|
return StackUtils.emptyToNull(ItemHandlerHelper.insertItem(handler, ItemHandlerHelper.copyStackWithSize(stack, size), simulate));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemHandlerHelper.copyStackWithSize(stack, size);
|
return ItemHandlerHelper.copyStackWithSize(stack, size);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
@@ -102,7 +102,7 @@ public class ReaderWriterHandlerFluids implements IReaderWriterHandler {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.singletonList(new TextComponentString(RSUtils.QUANTITY_FORMATTER.format((float) stack.amount / 1000F) + "x ").appendSibling(new TextComponentTranslation(stack.getUnlocalizedName())));
|
return Collections.singletonList(new TextComponentString(RenderUtils.QUANTITY_FORMATTER.format((float) stack.amount / 1000F) + "x ").appendSibling(new TextComponentTranslation(stack.getUnlocalizedName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FluidTankReaderWriter implements IFluidTank, IFluidHandler {
|
private class FluidTankReaderWriter implements IFluidTank, IFluidHandler {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.readerwriter;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReader;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
@@ -32,7 +32,7 @@ public class ReaderWriterHandlerItems implements IReaderWriterHandler {
|
|||||||
this.itemsReader = new ItemHandlerReaderWriter(items, true, false);
|
this.itemsReader = new ItemHandlerReaderWriter(items, true, false);
|
||||||
|
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
RSUtils.readItems(items, 0, tag);
|
StackUtils.readItems(items, 0, tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class ReaderWriterHandlerItems implements IReaderWriterHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||||
RSUtils.writeItems(items, 0, tag);
|
StackUtils.writeItems(items, 0, tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import com.google.gson.JsonArray;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.JsonUtils;
|
import net.minecraft.util.JsonUtils;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
@@ -37,7 +37,7 @@ public class SoldererRecipeFactory {
|
|||||||
|
|
||||||
for (JsonElement element : rowsArray) {
|
for (JsonElement element : rowsArray) {
|
||||||
if (element.isJsonNull()) {
|
if (element.isJsonNull()) {
|
||||||
rows.add(RSUtils.emptyNonNullList());
|
rows.add(StackUtils.emptyNonNullList());
|
||||||
} else {
|
} else {
|
||||||
rows.add(NonNullList.from(ItemStack.EMPTY, CraftingHelper.getIngredient(element, context).getMatchingStacks()));
|
rows.add(NonNullList.from(ItemStack.EMPTY, CraftingHelper.getIngredient(element, context).getMatchingStacks()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
@@ -83,7 +82,7 @@ public class StorageCacheFluid implements IStorageCache<FluidStack> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sort() {
|
public void sort() {
|
||||||
storages.sort(RSUtils.STORAGE_COMPARATOR);
|
storages.sort(IStorage.COMPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
@@ -85,7 +84,7 @@ public class StorageCacheItem implements IStorageCache<ItemStack> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sort() {
|
public void sort() {
|
||||||
storages.sort(RSUtils.STORAGE_COMPARATOR);
|
storages.sort(IStorage.COMPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||||
@@ -9,6 +8,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.API;
|
|||||||
import com.raoulvdberge.refinedstorage.network.MessageGridItemDelta;
|
import com.raoulvdberge.refinedstorage.network.MessageGridItemDelta;
|
||||||
import com.raoulvdberge.refinedstorage.network.MessageGridItemUpdate;
|
import com.raoulvdberge.refinedstorage.network.MessageGridItemUpdate;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -89,7 +89,7 @@ public class StorageCacheItemPortable implements IStorageCache<ItemStack> {
|
|||||||
buf.writeInt(list.getStacks().size());
|
buf.writeInt(list.getStacks().size());
|
||||||
|
|
||||||
for (ItemStack stack : list.getStacks()) {
|
for (ItemStack stack : list.getStacks()) {
|
||||||
RSUtils.writeItemStack(buf, stack, null, false);
|
StackUtils.writeItemStack(buf, stack, null, false);
|
||||||
}
|
}
|
||||||
}, false), (EntityPlayerMP) player);
|
}, false), (EntityPlayerMP) player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
|||||||
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
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.minecraft.nbt.NBTTagList;
|
||||||
@@ -93,7 +93,7 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
@@ -104,7 +104,7 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
|
|||||||
listener.run();
|
listener.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
return voidExcess.get() ? null : RSUtils.copyStackWithSize(otherStack, size - remainingSpace);
|
return voidExcess.get() ? null : StackUtils.copy(otherStack, size - remainingSpace);
|
||||||
} else {
|
} else {
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
tag.setInteger(NBT_STORED, getStored() + size);
|
tag.setInteger(NBT_STORED, getStored() + size);
|
||||||
@@ -127,23 +127,23 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
tag.setInteger(NBT_STORED, getStored() + remainingSpace);
|
tag.setInteger(NBT_STORED, getStored() + remainingSpace);
|
||||||
|
|
||||||
stacks.put(stack.getFluid(), RSUtils.copyStackWithSize(stack, remainingSpace));
|
stacks.put(stack.getFluid(), StackUtils.copy(stack, remainingSpace));
|
||||||
|
|
||||||
listener.run();
|
listener.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
return voidExcess.get() ? null : RSUtils.copyStackWithSize(stack, size - remainingSpace);
|
return voidExcess.get() ? null : StackUtils.copy(stack, size - remainingSpace);
|
||||||
} else {
|
} else {
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
tag.setInteger(NBT_STORED, getStored() + size);
|
tag.setInteger(NBT_STORED, getStored() + size);
|
||||||
|
|
||||||
stacks.put(stack.getFluid(), RSUtils.copyStackWithSize(stack, size));
|
stacks.put(stack.getFluid(), StackUtils.copy(stack, size));
|
||||||
|
|
||||||
listener.run();
|
listener.run();
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ public class StorageDiskFluid implements IStorageDisk<FluidStack> {
|
|||||||
listener.run();
|
listener.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.copyStackWithSize(otherStack, size);
|
return StackUtils.copy(otherStack, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
|||||||
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -196,7 +196,7 @@ public class StorageDiskItem implements IStorageDisk<ItemStack> {
|
|||||||
Collection<ItemStack> toAttempt = null;
|
Collection<ItemStack> toAttempt = null;
|
||||||
|
|
||||||
if ((flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT) {
|
if ((flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT) {
|
||||||
for (ItemStack ore : RSUtils.getEquivalentStacks(stack)) {
|
for (ItemStack ore : StackUtils.getEquivalentStacks(stack)) {
|
||||||
if (toAttempt == null) {
|
if (toAttempt == null) {
|
||||||
toAttempt = new ArrayList<>(stacks.get(ore.getItem()));
|
toAttempt = new ArrayList<>(stacks.get(ore.getItem()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.util;
|
package com.raoulvdberge.refinedstorage.apiimpl.util;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.block.BlockNode;
|
import com.raoulvdberge.refinedstorage.block.BlockNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@@ -114,7 +114,7 @@ public class Comparer implements IComparer {
|
|||||||
return validity == EnumActionResult.SUCCESS;
|
return validity == EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.areStacksEquivalent(left, right);
|
return StackUtils.areStacksEquivalent(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumActionResult validityCheck(@Nullable ItemStack left, @Nullable ItemStack right) {
|
private EnumActionResult validityCheck(@Nullable ItemStack left, @Nullable ItemStack right) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
@@ -11,6 +10,7 @@ import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
|||||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemBlockBase;
|
import com.raoulvdberge.refinedstorage.item.ItemBlockBase;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
@@ -103,7 +103,7 @@ public abstract class BlockBase extends Block {
|
|||||||
|
|
||||||
tile.setDirection(getDirection().cycle(tile.getDirection()));
|
tile.setDirection(getDirection().cycle(tile.getDirection()));
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ public abstract class BlockBase extends Block {
|
|||||||
if (node.getNetwork() != null) {
|
if (node.getNetwork() != null) {
|
||||||
for (Permission permission : permissions) {
|
for (Permission permission : permissions) {
|
||||||
if (!node.getNetwork().getSecurityManager().hasPermission(permission, player)) {
|
if (!node.getNetwork().getSecurityManager().hasPermission(permission, player)) {
|
||||||
RSUtils.sendNoPermissionMessage(player);
|
WorldUtils.sendNoPermissionMessage(player);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
||||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileCable;
|
import com.raoulvdberge.refinedstorage.tile.TileCable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
@@ -27,13 +27,13 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCable extends BlockNode {
|
public class BlockCable extends BlockNode {
|
||||||
public static final AxisAlignedBB CORE_AABB = RSUtils.getAABB(6, 6, 6, 10, 10, 10);
|
public static final AxisAlignedBB CORE_AABB = RenderUtils.getBounds(6, 6, 6, 10, 10, 10);
|
||||||
private static final AxisAlignedBB NORTH_AABB = RSUtils.getAABB(6, 6, 0, 10, 10, 6);
|
private static final AxisAlignedBB NORTH_AABB = RenderUtils.getBounds(6, 6, 0, 10, 10, 6);
|
||||||
private static final AxisAlignedBB EAST_AABB = RSUtils.getAABB(10, 6, 6, 16, 10, 10);
|
private static final AxisAlignedBB EAST_AABB = RenderUtils.getBounds(10, 6, 6, 16, 10, 10);
|
||||||
private static final AxisAlignedBB SOUTH_AABB = RSUtils.getAABB(6, 6, 10, 10, 10, 16);
|
private static final AxisAlignedBB SOUTH_AABB = RenderUtils.getBounds(6, 6, 10, 10, 10, 16);
|
||||||
private static final AxisAlignedBB WEST_AABB = RSUtils.getAABB(0, 6, 6, 6, 10, 10);
|
private static final AxisAlignedBB WEST_AABB = RenderUtils.getBounds(0, 6, 6, 6, 10, 10);
|
||||||
private static final AxisAlignedBB UP_AABB = RSUtils.getAABB(6, 10, 6, 10, 16, 10);
|
private static final AxisAlignedBB UP_AABB = RenderUtils.getBounds(6, 10, 6, 10, 16, 10);
|
||||||
private static final AxisAlignedBB DOWN_AABB = RSUtils.getAABB(6, 0, 6, 10, 6, 10);
|
private static final AxisAlignedBB DOWN_AABB = RenderUtils.getBounds(6, 0, 6, 10, 6, 10);
|
||||||
|
|
||||||
protected static final PropertyBool NORTH = PropertyBool.create("north");
|
protected static final PropertyBool NORTH = PropertyBool.create("north");
|
||||||
protected static final PropertyBool EAST = PropertyBool.create("east");
|
protected static final PropertyBool EAST = PropertyBool.create("east");
|
||||||
@@ -127,13 +127,13 @@ public class BlockCable extends BlockNode {
|
|||||||
protected boolean hitCablePart(IBlockState state, World world, BlockPos pos, float hitX, float hitY, float hitZ) {
|
protected boolean hitCablePart(IBlockState state, World world, BlockPos pos, float hitX, float hitY, float hitZ) {
|
||||||
state = getActualState(state, world, pos);
|
state = getActualState(state, world, pos);
|
||||||
|
|
||||||
return RSUtils.isInAABB(CORE_AABB, hitX, hitY, hitZ) ||
|
return RenderUtils.isInBounds(CORE_AABB, hitX, hitY, hitZ) ||
|
||||||
(state.getValue(NORTH) && RSUtils.isInAABB(NORTH_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(NORTH) && RenderUtils.isInBounds(NORTH_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(EAST) && RSUtils.isInAABB(EAST_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(EAST) && RenderUtils.isInBounds(EAST_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(SOUTH) && RSUtils.isInAABB(SOUTH_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(SOUTH) && RenderUtils.isInBounds(SOUTH_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(WEST) && RSUtils.isInAABB(WEST_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(WEST) && RenderUtils.isInBounds(WEST_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(UP) && RSUtils.isInAABB(UP_AABB, hitX, hitY, hitZ)) ||
|
(state.getValue(UP) && RenderUtils.isInBounds(UP_AABB, hitX, hitY, hitZ)) ||
|
||||||
(state.getValue(DOWN) && RSUtils.isInAABB(DOWN_AABB, hitX, hitY, hitZ));
|
(state.getValue(DOWN) && RenderUtils.isInBounds(DOWN_AABB, hitX, hitY, hitZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AxisAlignedBB> getUnionizedCollisionBoxes(IBlockState state) {
|
public List<AxisAlignedBB> getUnionizedCollisionBoxes(IBlockState state) {
|
||||||
@@ -192,7 +192,7 @@ public class BlockCable extends BlockNode {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) {
|
public RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) {
|
||||||
RSUtils.AdvancedRayTraceResult result = RSUtils.collisionRayTrace(pos, start, end, getCollisionBoxes(this.getActualState(state, world, pos)));
|
RenderUtils.AdvancedRayTraceResult result = RenderUtils.collisionRayTrace(pos, start, end, getCollisionBoxes(this.getActualState(state, world, pos)));
|
||||||
|
|
||||||
return result != null ? result.hit : null;
|
return result != null ? result.hit : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
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.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -17,19 +17,19 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockConstructor extends BlockCable {
|
public class BlockConstructor extends BlockCable {
|
||||||
public static final AxisAlignedBB HOLDER_NORTH_AABB = RSUtils.getAABB(7, 7, 2, 9, 9, 6);
|
public static final AxisAlignedBB HOLDER_NORTH_AABB = RenderUtils.getBounds(7, 7, 2, 9, 9, 6);
|
||||||
public static final AxisAlignedBB HOLDER_EAST_AABB = RSUtils.getAABB(10, 7, 7, 14, 9, 9);
|
public static final AxisAlignedBB HOLDER_EAST_AABB = RenderUtils.getBounds(10, 7, 7, 14, 9, 9);
|
||||||
public static final AxisAlignedBB HOLDER_SOUTH_AABB = RSUtils.getAABB(7, 7, 10, 9, 9, 14);
|
public static final AxisAlignedBB HOLDER_SOUTH_AABB = RenderUtils.getBounds(7, 7, 10, 9, 9, 14);
|
||||||
public static final AxisAlignedBB HOLDER_WEST_AABB = RSUtils.getAABB(2, 7, 7, 6, 9, 9);
|
public static final AxisAlignedBB HOLDER_WEST_AABB = RenderUtils.getBounds(2, 7, 7, 6, 9, 9);
|
||||||
public static final AxisAlignedBB HOLDER_UP_AABB = RSUtils.getAABB(7, 10, 7, 9, 14, 9);
|
public static final AxisAlignedBB HOLDER_UP_AABB = RenderUtils.getBounds(7, 10, 7, 9, 14, 9);
|
||||||
public static final AxisAlignedBB HOLDER_DOWN_AABB = RSUtils.getAABB(7, 2, 7, 9, 6, 9);
|
public static final AxisAlignedBB HOLDER_DOWN_AABB = RenderUtils.getBounds(7, 2, 7, 9, 6, 9);
|
||||||
|
|
||||||
public static final AxisAlignedBB HEAD_NORTH_AABB = RSUtils.getAABB(0, 0, 0, 16, 16, 2);
|
public static final AxisAlignedBB HEAD_NORTH_AABB = RenderUtils.getBounds(0, 0, 0, 16, 16, 2);
|
||||||
public static final AxisAlignedBB HEAD_EAST_AABB = RSUtils.getAABB(14, 0, 0, 16, 16, 16);
|
public static final AxisAlignedBB HEAD_EAST_AABB = RenderUtils.getBounds(14, 0, 0, 16, 16, 16);
|
||||||
public static final AxisAlignedBB HEAD_SOUTH_AABB = RSUtils.getAABB(0, 0, 14, 16, 16, 16);
|
public static final AxisAlignedBB HEAD_SOUTH_AABB = RenderUtils.getBounds(0, 0, 14, 16, 16, 16);
|
||||||
public static final AxisAlignedBB HEAD_WEST_AABB = RSUtils.getAABB(0, 0, 0, 2, 16, 16);
|
public static final AxisAlignedBB HEAD_WEST_AABB = RenderUtils.getBounds(0, 0, 0, 2, 16, 16);
|
||||||
public static final AxisAlignedBB HEAD_DOWN_AABB = RSUtils.getAABB(0, 0, 0, 16, 2, 16);
|
public static final AxisAlignedBB HEAD_DOWN_AABB = RenderUtils.getBounds(0, 0, 0, 16, 2, 16);
|
||||||
public static final AxisAlignedBB HEAD_UP_AABB = RSUtils.getAABB(0, 14, 0, 16, 16, 16);
|
public static final AxisAlignedBB HEAD_UP_AABB = RenderUtils.getBounds(0, 14, 0, 16, 16, 16);
|
||||||
|
|
||||||
public BlockConstructor() {
|
public BlockConstructor() {
|
||||||
super("constructor");
|
super("constructor");
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
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.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -17,24 +17,24 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockExporter extends BlockCable {
|
public class BlockExporter extends BlockCable {
|
||||||
private static final AxisAlignedBB LINE_NORTH_1_AABB = RSUtils.getAABB(6, 6, 0, 10, 10, 2);
|
private static final AxisAlignedBB LINE_NORTH_1_AABB = RenderUtils.getBounds(6, 6, 0, 10, 10, 2);
|
||||||
private static final AxisAlignedBB LINE_NORTH_2_AABB = RSUtils.getAABB(5, 5, 2, 11, 11, 4);
|
private static final AxisAlignedBB LINE_NORTH_2_AABB = RenderUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||||
private static final AxisAlignedBB LINE_NORTH_3_AABB = RSUtils.getAABB(3, 3, 4, 13, 13, 6);
|
private static final AxisAlignedBB LINE_NORTH_3_AABB = RenderUtils.getBounds(3, 3, 4, 13, 13, 6);
|
||||||
private static final AxisAlignedBB LINE_EAST_1_AABB = RSUtils.getAABB(14, 6, 6, 16, 10, 10);
|
private static final AxisAlignedBB LINE_EAST_1_AABB = RenderUtils.getBounds(14, 6, 6, 16, 10, 10);
|
||||||
private static final AxisAlignedBB LINE_EAST_2_AABB = RSUtils.getAABB(12, 5, 5, 14, 11, 11);
|
private static final AxisAlignedBB LINE_EAST_2_AABB = RenderUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||||
private static final AxisAlignedBB LINE_EAST_3_AABB = RSUtils.getAABB(10, 3, 3, 12, 13, 13);
|
private static final AxisAlignedBB LINE_EAST_3_AABB = RenderUtils.getBounds(10, 3, 3, 12, 13, 13);
|
||||||
private static final AxisAlignedBB LINE_SOUTH_1_AABB = RSUtils.getAABB(6, 6, 14, 10, 10, 16);
|
private static final AxisAlignedBB LINE_SOUTH_1_AABB = RenderUtils.getBounds(6, 6, 14, 10, 10, 16);
|
||||||
private static final AxisAlignedBB LINE_SOUTH_2_AABB = RSUtils.getAABB(5, 5, 12, 11, 11, 14);
|
private static final AxisAlignedBB LINE_SOUTH_2_AABB = RenderUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||||
private static final AxisAlignedBB LINE_SOUTH_3_AABB = RSUtils.getAABB(3, 3, 10, 13, 13, 12);
|
private static final AxisAlignedBB LINE_SOUTH_3_AABB = RenderUtils.getBounds(3, 3, 10, 13, 13, 12);
|
||||||
private static final AxisAlignedBB LINE_WEST_1_AABB = RSUtils.getAABB(0, 6, 6, 2, 10, 10);
|
private static final AxisAlignedBB LINE_WEST_1_AABB = RenderUtils.getBounds(0, 6, 6, 2, 10, 10);
|
||||||
private static final AxisAlignedBB LINE_WEST_2_AABB = RSUtils.getAABB(2, 5, 5, 4, 11, 11);
|
private static final AxisAlignedBB LINE_WEST_2_AABB = RenderUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||||
private static final AxisAlignedBB LINE_WEST_3_AABB = RSUtils.getAABB(4, 3, 3, 6, 13, 13);
|
private static final AxisAlignedBB LINE_WEST_3_AABB = RenderUtils.getBounds(4, 3, 3, 6, 13, 13);
|
||||||
private static final AxisAlignedBB LINE_UP_1_AABB = RSUtils.getAABB(6, 14, 6, 10, 16, 10);
|
private static final AxisAlignedBB LINE_UP_1_AABB = RenderUtils.getBounds(6, 14, 6, 10, 16, 10);
|
||||||
private static final AxisAlignedBB LINE_UP_2_AABB = RSUtils.getAABB(5, 12, 5, 11, 14, 11);
|
private static final AxisAlignedBB LINE_UP_2_AABB = RenderUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||||
private static final AxisAlignedBB LINE_UP_3_AABB = RSUtils.getAABB(3, 10, 3, 13, 12, 13);
|
private static final AxisAlignedBB LINE_UP_3_AABB = RenderUtils.getBounds(3, 10, 3, 13, 12, 13);
|
||||||
private static final AxisAlignedBB LINE_DOWN_1_AABB = RSUtils.getAABB(6, 0, 6, 10, 2, 10);
|
private static final AxisAlignedBB LINE_DOWN_1_AABB = RenderUtils.getBounds(6, 0, 6, 10, 2, 10);
|
||||||
private static final AxisAlignedBB LINE_DOWN_2_AABB = RSUtils.getAABB(5, 2, 5, 11, 4, 11);
|
private static final AxisAlignedBB LINE_DOWN_2_AABB = RenderUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||||
private static final AxisAlignedBB LINE_DOWN_3_AABB = RSUtils.getAABB(3, 4, 3, 13, 6, 13);
|
private static final AxisAlignedBB LINE_DOWN_3_AABB = RenderUtils.getBounds(3, 4, 3, 13, 6, 13);
|
||||||
|
|
||||||
public BlockExporter() {
|
public BlockExporter() {
|
||||||
super("exporter");
|
super("exporter");
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.NetworkNodeExternalStorage;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.NetworkNodeExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileExternalStorage;
|
import com.raoulvdberge.refinedstorage.tile.TileExternalStorage;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -19,12 +19,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockExternalStorage extends BlockCable {
|
public class BlockExternalStorage extends BlockCable {
|
||||||
private static final AxisAlignedBB HEAD_NORTH_AABB = RSUtils.getAABB(3, 3, 0, 13, 13, 2);
|
private static final AxisAlignedBB HEAD_NORTH_AABB = RenderUtils.getBounds(3, 3, 0, 13, 13, 2);
|
||||||
private static final AxisAlignedBB HEAD_EAST_AABB = RSUtils.getAABB(14, 3, 3, 16, 13, 13);
|
private static final AxisAlignedBB HEAD_EAST_AABB = RenderUtils.getBounds(14, 3, 3, 16, 13, 13);
|
||||||
private static final AxisAlignedBB HEAD_SOUTH_AABB = RSUtils.getAABB(3, 3, 14, 13, 13, 16);
|
private static final AxisAlignedBB HEAD_SOUTH_AABB = RenderUtils.getBounds(3, 3, 14, 13, 13, 16);
|
||||||
private static final AxisAlignedBB HEAD_WEST_AABB = RSUtils.getAABB(0, 3, 3, 2, 13, 13);
|
private static final AxisAlignedBB HEAD_WEST_AABB = RenderUtils.getBounds(0, 3, 3, 2, 13, 13);
|
||||||
private static final AxisAlignedBB HEAD_UP_AABB = RSUtils.getAABB(3, 14, 3, 13, 16, 13);
|
private static final AxisAlignedBB HEAD_UP_AABB = RenderUtils.getBounds(3, 14, 3, 13, 16, 13);
|
||||||
private static final AxisAlignedBB HEAD_DOWN_AABB = RSUtils.getAABB(3, 0, 3, 13, 2, 13);
|
private static final AxisAlignedBB HEAD_DOWN_AABB = RenderUtils.getBounds(3, 0, 3, 13, 2, 13);
|
||||||
|
|
||||||
public BlockExternalStorage() {
|
public BlockExternalStorage() {
|
||||||
super("external_storage");
|
super("external_storage");
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
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.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -17,24 +17,24 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockImporter extends BlockCable {
|
public class BlockImporter extends BlockCable {
|
||||||
private static final AxisAlignedBB LINE_NORTH_1_AABB = RSUtils.getAABB(6, 6, 4, 10, 10, 6);
|
private static final AxisAlignedBB LINE_NORTH_1_AABB = RenderUtils.getBounds(6, 6, 4, 10, 10, 6);
|
||||||
private static final AxisAlignedBB LINE_NORTH_2_AABB = RSUtils.getAABB(5, 5, 2, 11, 11, 4);
|
private static final AxisAlignedBB LINE_NORTH_2_AABB = RenderUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||||
private static final AxisAlignedBB LINE_NORTH_3_AABB = RSUtils.getAABB(3, 3, 0, 13, 13, 2);
|
private static final AxisAlignedBB LINE_NORTH_3_AABB = RenderUtils.getBounds(3, 3, 0, 13, 13, 2);
|
||||||
private static final AxisAlignedBB LINE_EAST_1_AABB = RSUtils.getAABB(10, 6, 6, 12, 10, 10);
|
private static final AxisAlignedBB LINE_EAST_1_AABB = RenderUtils.getBounds(10, 6, 6, 12, 10, 10);
|
||||||
private static final AxisAlignedBB LINE_EAST_2_AABB = RSUtils.getAABB(12, 5, 5, 14, 11, 11);
|
private static final AxisAlignedBB LINE_EAST_2_AABB = RenderUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||||
private static final AxisAlignedBB LINE_EAST_3_AABB = RSUtils.getAABB(14, 3, 3, 16, 13, 13);
|
private static final AxisAlignedBB LINE_EAST_3_AABB = RenderUtils.getBounds(14, 3, 3, 16, 13, 13);
|
||||||
private static final AxisAlignedBB LINE_SOUTH_1_AABB = RSUtils.getAABB(6, 6, 10, 10, 10, 12);
|
private static final AxisAlignedBB LINE_SOUTH_1_AABB = RenderUtils.getBounds(6, 6, 10, 10, 10, 12);
|
||||||
private static final AxisAlignedBB LINE_SOUTH_2_AABB = RSUtils.getAABB(5, 5, 12, 11, 11, 14);
|
private static final AxisAlignedBB LINE_SOUTH_2_AABB = RenderUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||||
private static final AxisAlignedBB LINE_SOUTH_3_AABB = RSUtils.getAABB(3, 3, 14, 13, 13, 16);
|
private static final AxisAlignedBB LINE_SOUTH_3_AABB = RenderUtils.getBounds(3, 3, 14, 13, 13, 16);
|
||||||
private static final AxisAlignedBB LINE_WEST_1_AABB = RSUtils.getAABB(4, 6, 6, 6, 10, 10);
|
private static final AxisAlignedBB LINE_WEST_1_AABB = RenderUtils.getBounds(4, 6, 6, 6, 10, 10);
|
||||||
private static final AxisAlignedBB LINE_WEST_2_AABB = RSUtils.getAABB(2, 5, 5, 4, 11, 11);
|
private static final AxisAlignedBB LINE_WEST_2_AABB = RenderUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||||
private static final AxisAlignedBB LINE_WEST_3_AABB = RSUtils.getAABB(0, 3, 3, 2, 13, 13);
|
private static final AxisAlignedBB LINE_WEST_3_AABB = RenderUtils.getBounds(0, 3, 3, 2, 13, 13);
|
||||||
private static final AxisAlignedBB LINE_UP_1_AABB = RSUtils.getAABB(6, 10, 6, 10, 12, 10);
|
private static final AxisAlignedBB LINE_UP_1_AABB = RenderUtils.getBounds(6, 10, 6, 10, 12, 10);
|
||||||
private static final AxisAlignedBB LINE_UP_2_AABB = RSUtils.getAABB(5, 12, 5, 11, 14, 11);
|
private static final AxisAlignedBB LINE_UP_2_AABB = RenderUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||||
private static final AxisAlignedBB LINE_UP_3_AABB = RSUtils.getAABB(3, 14, 3, 13, 16, 13);
|
private static final AxisAlignedBB LINE_UP_3_AABB = RenderUtils.getBounds(3, 14, 3, 13, 16, 13);
|
||||||
private static final AxisAlignedBB LINE_DOWN_1_AABB = RSUtils.getAABB(6, 4, 6, 10, 6, 10);
|
private static final AxisAlignedBB LINE_DOWN_1_AABB = RenderUtils.getBounds(6, 4, 6, 10, 6, 10);
|
||||||
private static final AxisAlignedBB LINE_DOWN_2_AABB = RSUtils.getAABB(5, 2, 5, 11, 4, 11);
|
private static final AxisAlignedBB LINE_DOWN_2_AABB = RenderUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||||
private static final AxisAlignedBB LINE_DOWN_3_AABB = RSUtils.getAABB(3, 0, 3, 13, 2, 13);
|
private static final AxisAlignedBB LINE_DOWN_3_AABB = RenderUtils.getBounds(3, 0, 3, 13, 2, 13);
|
||||||
|
|
||||||
public BlockImporter() {
|
public BlockImporter() {
|
||||||
super("importer");
|
super("importer");
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui;
|
package com.raoulvdberge.refinedstorage.gui;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.render.IElementDrawer;
|
import com.raoulvdberge.refinedstorage.api.render.IElementDrawer;
|
||||||
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
|
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
|
||||||
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButton;
|
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButton;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
@@ -30,7 +30,7 @@ import java.util.Map;
|
|||||||
public abstract class GuiBase extends GuiContainer {
|
public abstract class GuiBase extends GuiContainer {
|
||||||
private static final Map<String, ResourceLocation> TEXTURE_CACHE = new HashMap<>();
|
private static final Map<String, ResourceLocation> TEXTURE_CACHE = new HashMap<>();
|
||||||
|
|
||||||
public static final RSUtils.FluidRenderer FLUID_RENDERER = new RSUtils.FluidRenderer(-1, 16, 16);
|
public static final RenderUtils.FluidRenderer FLUID_RENDERER = new RenderUtils.FluidRenderer(-1, 16, 16);
|
||||||
|
|
||||||
public class ElementDrawers implements IElementDrawers {
|
public class ElementDrawers implements IElementDrawers {
|
||||||
private IElementDrawer<FluidStack> fluidDrawer = (x, y, element) -> FLUID_RENDERER.draw(GuiBase.this.mc, x, y, element);
|
private IElementDrawer<FluidStack> fluidDrawer = (x, y, element) -> FLUID_RENDERER.draw(GuiBase.this.mc, x, y, element);
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui;
|
package com.raoulvdberge.refinedstorage.gui;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeFluidInterface;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeFluidInterface;
|
||||||
import com.raoulvdberge.refinedstorage.container.ContainerFluidInterface;
|
import com.raoulvdberge.refinedstorage.container.ContainerFluidInterface;
|
||||||
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButtonCompare;
|
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||||
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import com.raoulvdberge.refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
|
|
||||||
public class GuiFluidInterface extends GuiBase {
|
public class GuiFluidInterface extends GuiBase {
|
||||||
private static final RSUtils.FluidRenderer TANK_RENDERER = new RSUtils.FluidRenderer(NetworkNodeFluidInterface.TANK_CAPACITY, 12, 47);
|
private static final RenderUtils.FluidRenderer TANK_RENDERER = new RenderUtils.FluidRenderer(NetworkNodeFluidInterface.TANK_CAPACITY, 12, 47);
|
||||||
|
|
||||||
public GuiFluidInterface(ContainerFluidInterface container) {
|
public GuiFluidInterface(ContainerFluidInterface container) {
|
||||||
super(container, 211, 204);
|
super(container, 211, 204);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui;
|
package com.raoulvdberge.refinedstorage.gui;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiStorage;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiStorage;
|
||||||
import com.raoulvdberge.refinedstorage.container.ContainerBase;
|
import com.raoulvdberge.refinedstorage.container.ContainerBase;
|
||||||
import com.raoulvdberge.refinedstorage.gui.sidebutton.*;
|
import com.raoulvdberge.refinedstorage.gui.sidebutton.*;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ public class GuiStorage extends GuiBase {
|
|||||||
public void drawForeground(int mouseX, int mouseY) {
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
drawString(7, 7, t(gui.getGuiTitle()));
|
drawString(7, 7, t(gui.getGuiTitle()));
|
||||||
drawString(7, 42, gui.getCapacity() == -1 ?
|
drawString(7, 42, gui.getCapacity() == -1 ?
|
||||||
t("misc.refinedstorage:storage.stored_minimal", RSUtils.formatQuantity(gui.getStored())) :
|
t("misc.refinedstorage:storage.stored_minimal", RenderUtils.formatQuantity(gui.getStored())) :
|
||||||
t("misc.refinedstorage:storage.stored_capacity_minimal", RSUtils.formatQuantity(gui.getStored()), RSUtils.formatQuantity(gui.getCapacity()))
|
t("misc.refinedstorage:storage.stored_capacity_minimal", RenderUtils.formatQuantity(gui.getStored()), RenderUtils.formatQuantity(gui.getCapacity()))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (texture.contains("disk_drive")) { // HACK!
|
if (texture.contains("disk_drive")) { // HACK!
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui.grid.stack;
|
package com.raoulvdberge.refinedstorage.gui.grid.stack;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public class GridStackFluid implements IGridStack {
|
|||||||
public void draw(GuiBase gui, int x, int y, boolean isOverWithShift) {
|
public void draw(GuiBase gui, int x, int y, boolean isOverWithShift) {
|
||||||
GuiBase.FLUID_RENDERER.draw(gui.mc, x, y, stack);
|
GuiBase.FLUID_RENDERER.draw(gui.mc, x, y, stack);
|
||||||
|
|
||||||
gui.drawQuantity(x, y, RSUtils.formatQuantity((int) ((float) stack.amount / 1000F)));
|
gui.drawQuantity(x, y, RenderUtils.formatQuantity((int) ((float) stack.amount / 1000F)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui.grid.stack;
|
package com.raoulvdberge.refinedstorage.gui.grid.stack;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
@@ -23,7 +24,7 @@ public class GridStackItem implements IGridStack {
|
|||||||
private String[] oreIds = null;
|
private String[] oreIds = null;
|
||||||
|
|
||||||
public GridStackItem(ByteBuf buf) {
|
public GridStackItem(ByteBuf buf) {
|
||||||
this.stack = RSUtils.readItemStack(buf);
|
this.stack = StackUtils.readItemStack(buf);
|
||||||
this.hash = buf.readInt();
|
this.hash = buf.readInt();
|
||||||
this.craftable = buf.readBoolean();
|
this.craftable = buf.readBoolean();
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ public class GridStackItem implements IGridStack {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.formatQuantity(qty);
|
return RenderUtils.formatQuantity(qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.raoulvdberge.refinedstorage.gui.sidebutton;
|
package com.raoulvdberge.refinedstorage.gui.sidebutton;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
public class SideButtonAccessType extends SideButton {
|
public class SideButtonAccessType extends SideButton {
|
||||||
@@ -28,6 +28,6 @@ public class SideButtonAccessType extends SideButton {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed() {
|
public void actionPerformed() {
|
||||||
TileDataManager.setParameter(parameter, RSUtils.getAccessType(parameter.getValue().getId() + 1));
|
TileDataManager.setParameter(parameter, AccessTypeUtils.getAccessType(parameter.getValue().getId() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package com.raoulvdberge.refinedstorage.integration.storagedrawers;
|
|||||||
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
|
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
|
||||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.NetworkNodeExternalStorage;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.NetworkNodeExternalStorage;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.StorageItemExternal;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.StorageItemExternal;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||||
@@ -52,7 +52,7 @@ public class StorageItemItemRepository extends StorageItemExternal {
|
|||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.transformEmptyToNull(repository.insertItem(ItemHandlerHelper.copyStackWithSize(stack, size), simulate));
|
return StackUtils.emptyToNull(repository.insertItem(ItemHandlerHelper.copyStackWithSize(stack, size), simulate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -64,7 +64,7 @@ public class StorageItemItemRepository extends StorageItemExternal {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RSUtils.transformEmptyToNull(repository.extractItem(stack, size, simulate, s -> API.instance().getComparer().isEqual(stack, s, flags)));
|
return StackUtils.emptyToNull(repository.extractItem(stack, size, simulate, s -> API.instance().getComparer().isEqual(stack, s, flags)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.inventory;
|
package com.raoulvdberge.refinedstorage.inventory;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
@@ -15,7 +15,7 @@ public class ItemHandlerFilterItems extends ItemStackHandler {
|
|||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
|
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
RSUtils.readItems(this, 0, stack.getTagCompound());
|
StackUtils.readItems(this, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public class ItemHandlerFilterItems extends ItemStackHandler {
|
|||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(this, 0, stack.getTagCompound());
|
StackUtils.writeItems(this, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
public NonNullList<ItemStack> getFilteredItems() {
|
public NonNullList<ItemStack> getFilteredItems() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.inventory;
|
package com.raoulvdberge.refinedstorage.inventory;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
@@ -12,7 +12,7 @@ public class ItemHandlerFluid extends ItemHandlerBase {
|
|||||||
private FluidStack[] fluids;
|
private FluidStack[] fluids;
|
||||||
|
|
||||||
public ItemHandlerFluid(int size, @Nullable Consumer<Integer> listener) {
|
public ItemHandlerFluid(int size, @Nullable Consumer<Integer> listener) {
|
||||||
super(size, listener, s -> RSUtils.getFluidFromStack(ItemHandlerHelper.copyStackWithSize(s, 1), true).getValue() != null);
|
super(size, listener, s -> StackUtils.getFluid(ItemHandlerHelper.copyStackWithSize(s, 1), true).getValue() != null);
|
||||||
|
|
||||||
this.fluids = new FluidStack[size];
|
this.fluids = new FluidStack[size];
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ public class ItemHandlerFluid extends ItemHandlerBase {
|
|||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
fluids[slot] = null;
|
fluids[slot] = null;
|
||||||
} else {
|
} else {
|
||||||
fluids[slot] = RSUtils.getFluidFromStack(ItemHandlerHelper.copyStackWithSize(stack, 1), true).getValue();
|
fluids[slot] = StackUtils.getFluid(ItemHandlerHelper.copyStackWithSize(stack, 1), true).getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.inventory;
|
package com.raoulvdberge.refinedstorage.inventory;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ public class ItemHandlerInterface implements IItemHandler, BiConsumer<ItemStack,
|
|||||||
if (slot < importItems.getSlots()) {
|
if (slot < importItems.getSlots()) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
} else if (slot < importItems.getSlots() + storageCacheData.length) {
|
} else if (slot < importItems.getSlots() + storageCacheData.length) {
|
||||||
return RSUtils.transformNullToEmpty(network.extractItem(storageCacheData[slot - importItems.getSlots()], amount, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT, simulate));
|
return StackUtils.nullToEmpty(network.extractItem(storageCacheData[slot - importItems.getSlots()], amount, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT, simulate));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.inventory;
|
package com.raoulvdberge.refinedstorage.inventory;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
@@ -37,13 +37,13 @@ public class ItemHandlerStorage implements IItemHandler, BiConsumer<ItemStack, I
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||||
return RSUtils.transformNullToEmpty(storage.insert(stack, stack.getCount(), simulate));
|
return StackUtils.nullToEmpty(storage.insert(stack, stack.getCount(), simulate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||||
return slot >= storageCacheData.length ? ItemStack.EMPTY : RSUtils.transformNullToEmpty(storage.extract(storageCacheData[slot], amount, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT, simulate));
|
return slot >= storageCacheData.length ? ItemStack.EMPTY : StackUtils.nullToEmpty(storage.extract(storageCacheData[slot], amount, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT, simulate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.raoulvdberge.refinedstorage.item;
|
package com.raoulvdberge.refinedstorage.item;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
@@ -61,12 +61,12 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
if (GuiScreen.isShiftKeyDown() || isProcessing(stack)) {
|
if (GuiScreen.isShiftKeyDown() || isProcessing(stack)) {
|
||||||
tooltip.add(TextFormatting.YELLOW + I18n.format("misc.refinedstorage:pattern.inputs") + TextFormatting.RESET);
|
tooltip.add(TextFormatting.YELLOW + I18n.format("misc.refinedstorage:pattern.inputs") + TextFormatting.RESET);
|
||||||
|
|
||||||
combineItems(tooltip, true, RSUtils.toNonNullList(pattern.getInputs()));
|
combineItems(tooltip, true, StackUtils.toNonNullList(pattern.getInputs()));
|
||||||
|
|
||||||
tooltip.add(TextFormatting.YELLOW + I18n.format("misc.refinedstorage:pattern.outputs") + TextFormatting.RESET);
|
tooltip.add(TextFormatting.YELLOW + I18n.format("misc.refinedstorage:pattern.outputs") + TextFormatting.RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
combineItems(tooltip, true, RSUtils.toNonNullList(pattern.getOutputs()));
|
combineItems(tooltip, true, StackUtils.toNonNullList(pattern.getOutputs()));
|
||||||
|
|
||||||
if (isOredict(stack)) {
|
if (isOredict(stack)) {
|
||||||
tooltip.add(TextFormatting.BLUE + I18n.format("misc.refinedstorage:pattern.oredict") + TextFormatting.RESET);
|
tooltip.add(TextFormatting.BLUE + I18n.format("misc.refinedstorage:pattern.oredict") + TextFormatting.RESET);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.network;
|
package com.raoulvdberge.refinedstorage.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
||||||
import com.raoulvdberge.refinedstorage.block.GridType;
|
import com.raoulvdberge.refinedstorage.block.GridType;
|
||||||
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@@ -41,7 +41,7 @@ public class MessageGridClear extends MessageHandlerPlayerToServer<MessageGridCl
|
|||||||
ItemStack slot = matrix.getStackInSlot(i);
|
ItemStack slot = matrix.getStackInSlot(i);
|
||||||
|
|
||||||
if (!slot.isEmpty()) {
|
if (!slot.isEmpty()) {
|
||||||
matrix.setInventorySlotContents(i, RSUtils.transformNullToEmpty(grid.getNetwork().insertItem(slot, slot.getCount(), false)));
|
matrix.setInventorySlotContents(i, StackUtils.nullToEmpty(grid.getNetwork().insertItem(slot, slot.getCount(), false)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (grid.getType() == GridType.PATTERN) {
|
} else if (grid.getType() == GridType.PATTERN) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.network;
|
package com.raoulvdberge.refinedstorage.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid;
|
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@@ -26,13 +26,13 @@ public class MessageGridFluidDelta implements IMessage, IMessageHandler<MessageG
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromBytes(ByteBuf buf) {
|
public void fromBytes(ByteBuf buf) {
|
||||||
clientStack = new GridStackFluid(RSUtils.readFluidStack(buf));
|
clientStack = new GridStackFluid(StackUtils.readFluidStack(buf));
|
||||||
delta = buf.readInt();
|
delta = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBytes(ByteBuf buf) {
|
public void toBytes(ByteBuf buf) {
|
||||||
RSUtils.writeFluidStack(buf, stack);
|
StackUtils.writeFluidStack(buf, stack);
|
||||||
buf.writeInt(delta);
|
buf.writeInt(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.network;
|
package com.raoulvdberge.refinedstorage.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid;
|
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
@@ -33,7 +33,7 @@ public class MessageGridFluidUpdate implements IMessage, IMessageHandler<Message
|
|||||||
int items = buf.readInt();
|
int items = buf.readInt();
|
||||||
|
|
||||||
for (int i = 0; i < items; ++i) {
|
for (int i = 0; i < items; ++i) {
|
||||||
this.stacks.add(new GridStackFluid(RSUtils.readFluidStack(buf)));
|
this.stacks.add(new GridStackFluid(StackUtils.readFluidStack(buf)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class MessageGridFluidUpdate implements IMessage, IMessageHandler<Message
|
|||||||
buf.writeInt(network.getFluidStorageCache().getList().getStacks().size());
|
buf.writeInt(network.getFluidStorageCache().getList().getStacks().size());
|
||||||
|
|
||||||
for (FluidStack stack : network.getFluidStorageCache().getList().getStacks()) {
|
for (FluidStack stack : network.getFluidStorageCache().getList().getStacks()) {
|
||||||
RSUtils.writeFluidStack(buf, stack);
|
StackUtils.writeFluidStack(buf, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.network;
|
package com.raoulvdberge.refinedstorage.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackItem;
|
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackItem;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -38,7 +38,7 @@ public class MessageGridItemDelta implements IMessage, IMessageHandler<MessageGr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBytes(ByteBuf buf) {
|
public void toBytes(ByteBuf buf) {
|
||||||
RSUtils.writeItemStack(buf, stack, network, false);
|
StackUtils.writeItemStack(buf, stack, network, false);
|
||||||
buf.writeInt(delta);
|
buf.writeInt(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.network;
|
package com.raoulvdberge.refinedstorage.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackItem;
|
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackItem;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
@@ -36,13 +36,13 @@ public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageG
|
|||||||
buf.writeInt(size);
|
buf.writeInt(size);
|
||||||
|
|
||||||
for (ItemStack stack : network.getItemStorageCache().getList().getStacks()) {
|
for (ItemStack stack : network.getItemStorageCache().getList().getStacks()) {
|
||||||
RSUtils.writeItemStack(buf, stack, network, false);
|
StackUtils.writeItemStack(buf, stack, network, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ICraftingPattern pattern : network.getCraftingManager().getPatterns()) {
|
for (ICraftingPattern pattern : network.getCraftingManager().getPatterns()) {
|
||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
if (output != null) {
|
if (output != null) {
|
||||||
RSUtils.writeItemStack(buf, output, network, true);
|
StackUtils.writeItemStack(buf, output, network, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.raoulvdberge.refinedstorage.network;
|
package com.raoulvdberge.refinedstorage.network;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
||||||
import com.raoulvdberge.refinedstorage.block.GridType;
|
import com.raoulvdberge.refinedstorage.block.GridType;
|
||||||
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -33,7 +33,7 @@ public class MessageGridProcessingTransfer extends MessageHandlerPlayerToServer<
|
|||||||
this.inputs = new ArrayList<>(size);
|
this.inputs = new ArrayList<>(size);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
this.inputs.add(RSUtils.readItemStack(buf));
|
this.inputs.add(StackUtils.readItemStack(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
size = buf.readInt();
|
size = buf.readInt();
|
||||||
@@ -41,7 +41,7 @@ public class MessageGridProcessingTransfer extends MessageHandlerPlayerToServer<
|
|||||||
this.outputs = new ArrayList<>(size);
|
this.outputs = new ArrayList<>(size);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
this.outputs.add(RSUtils.readItemStack(buf));
|
this.outputs.add(StackUtils.readItemStack(buf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,13 +50,13 @@ public class MessageGridProcessingTransfer extends MessageHandlerPlayerToServer<
|
|||||||
buf.writeInt(inputs.size());
|
buf.writeInt(inputs.size());
|
||||||
|
|
||||||
for (ItemStack stack : inputs) {
|
for (ItemStack stack : inputs) {
|
||||||
RSUtils.writeItemStack(buf, stack);
|
StackUtils.writeItemStack(buf, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.writeInt(outputs.size());
|
buf.writeInt(outputs.size());
|
||||||
|
|
||||||
for (ItemStack stack : outputs) {
|
for (ItemStack stack : outputs) {
|
||||||
RSUtils.writeItemStack(buf, stack);
|
StackUtils.writeItemStack(buf, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.proxy;
|
package com.raoulvdberge.refinedstorage.proxy;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.*;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
|
import com.raoulvdberge.refinedstorage.RSKeyBindings;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.block.*;
|
import com.raoulvdberge.refinedstorage.block.*;
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiCraftingPreview;
|
import com.raoulvdberge.refinedstorage.gui.GuiCraftingPreview;
|
||||||
@@ -14,6 +17,7 @@ import com.raoulvdberge.refinedstorage.tile.TileController;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor;
|
import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -340,7 +344,7 @@ public class ProxyClient extends ProxyCommon {
|
|||||||
|
|
||||||
IBlockState state = cable.getActualStateForRendering(player.getEntityWorld(), pos);
|
IBlockState state = cable.getActualStateForRendering(player.getEntityWorld(), pos);
|
||||||
|
|
||||||
if (cable.collisionRayTrace(state, player.getEntityWorld(), pos, RSUtils.getStart(player), RSUtils.getEnd(player)) == null) {
|
if (cable.collisionRayTrace(state, player.getEntityWorld(), pos, RenderUtils.getStart(player), RenderUtils.getEnd(player)) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.google.gson.JsonSyntaxException;
|
|||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.*;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.*;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewElementFluidStack;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewElementFluidStack;
|
||||||
@@ -29,6 +28,7 @@ import com.raoulvdberge.refinedstorage.tile.data.ContainerListener;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentData;
|
import net.minecraft.enchantment.EnchantmentData;
|
||||||
@@ -72,7 +72,7 @@ public class ProxyCommon {
|
|||||||
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
||||||
|
|
||||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementItemRender.ID, buf -> new CraftingMonitorElementItemRender(buf.readInt(), ByteBufUtils.readItemStack(buf), buf.readInt(), buf.readInt()));
|
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementItemRender.ID, buf -> new CraftingMonitorElementItemRender(buf.readInt(), ByteBufUtils.readItemStack(buf), buf.readInt(), buf.readInt()));
|
||||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementFluidRender.ID, buf -> new CraftingMonitorElementFluidRender(buf.readInt(), RSUtils.readFluidStack(buf).getRight(), buf.readInt()));
|
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementFluidRender.ID, buf -> new CraftingMonitorElementFluidRender(buf.readInt(), StackUtils.readFluidStack(buf).getRight(), buf.readInt()));
|
||||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementText.ID, buf -> new CraftingMonitorElementText(ByteBufUtils.readUTF8String(buf), buf.readInt()));
|
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementText.ID, buf -> new CraftingMonitorElementText(ByteBufUtils.readUTF8String(buf), buf.readInt()));
|
||||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementError.ID, buf -> {
|
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementError.ID, buf -> {
|
||||||
String id = ByteBufUtils.readUTF8String(buf);
|
String id = ByteBufUtils.readUTF8String(buf);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.raoulvdberge.refinedstorage.render;
|
package com.raoulvdberge.refinedstorage.render;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||||
import com.raoulvdberge.refinedstorage.item.ItemPattern;
|
import com.raoulvdberge.refinedstorage.item.ItemPattern;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
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.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
@@ -31,9 +31,9 @@ public class BakedModelPattern implements IBakedModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||||
TRSRTransformation transform = RSUtils.getDefaultItemTransforms().get(cameraTransformType);
|
TRSRTransformation transform = RenderUtils.getDefaultItemTransforms().get(cameraTransformType);
|
||||||
|
|
||||||
return Pair.of(this, transform == null ? RSUtils.EMPTY_MATRIX_TRANSFORM : transform.getMatrix());
|
return Pair.of(this, transform == null ? RenderUtils.EMPTY_MATRIX_TRANSFORM : transform.getMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.render;
|
package com.raoulvdberge.refinedstorage.render;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
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;
|
||||||
@@ -24,9 +24,9 @@ public class BakedModelPortableGrid implements IBakedModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||||
TRSRTransformation transform = RSUtils.getDefaultBlockTransforms().get(cameraTransformType);
|
TRSRTransformation transform = RenderUtils.getDefaultBlockTransforms().get(cameraTransformType);
|
||||||
|
|
||||||
return Pair.of(this, transform == null ? RSUtils.EMPTY_MATRIX_TRANSFORM : transform.getMatrix());
|
return Pair.of(this, transform == null ? RenderUtils.EMPTY_MATRIX_TRANSFORM : transform.getMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.render;
|
package com.raoulvdberge.refinedstorage.render;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor;
|
import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor;
|
||||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
@@ -27,7 +27,7 @@ public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRe
|
|||||||
float rotY = 0;
|
float rotY = 0;
|
||||||
float rotZ = 0;
|
float rotZ = 0;
|
||||||
|
|
||||||
String amount = tile.getType() == IType.ITEMS ? RSUtils.formatQuantity(tile.getAmount()) : RSUtils.QUANTITY_FORMATTER.format((float) tile.getAmount() / 1000F);
|
String amount = tile.getType() == IType.ITEMS ? RenderUtils.formatQuantity(tile.getAmount()) : RenderUtils.QUANTITY_FORMATTER.format((float) tile.getAmount() / 1000F);
|
||||||
|
|
||||||
// Very bad, but I don't know how to translate a 2D font width to a 3D font width...
|
// Very bad, but I don't know how to translate a 2D font width to a 3D font width...
|
||||||
float textWidth = 0;
|
float textWidth = 0;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
@@ -59,7 +59,7 @@ public abstract class TileBase extends TileEntity {
|
|||||||
direction = EnumFacing.getFront(tag.getInteger(NBT_DIRECTION));
|
direction = EnumFacing.getFront(tag.getInteger(NBT_DIRECTION));
|
||||||
|
|
||||||
if (doRender) {
|
if (doRender) {
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.tile;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeGraph;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeGraph;
|
||||||
@@ -44,6 +43,8 @@ import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
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.entity.player.EntityPlayerMP;
|
||||||
@@ -241,7 +242,7 @@ public class TileController extends TileBase implements ITickable, INetwork, IRe
|
|||||||
if (lastEnergyDisplay != energyDisplay) {
|
if (lastEnergyDisplay != energyDisplay) {
|
||||||
lastEnergyDisplay = energyDisplay;
|
lastEnergyDisplay = energyDisplay;
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,7 +495,7 @@ public class TileController extends TileBase implements ITickable, INetwork, IRe
|
|||||||
@Override
|
@Override
|
||||||
public FluidStack insertFluid(@Nonnull FluidStack stack, int size, boolean simulate) {
|
public FluidStack insertFluid(@Nonnull FluidStack stack, int size, boolean simulate) {
|
||||||
if (fluidStorage.getStorages().isEmpty()) {
|
if (fluidStorage.getStorages().isEmpty()) {
|
||||||
return RSUtils.copyStackWithSize(stack, size);
|
return StackUtils.copy(stack, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidStack remainder = stack;
|
FluidStack remainder = stack;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile.craftingmonitor;
|
package com.raoulvdberge.refinedstorage.tile.craftingmonitor;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
|
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
|
||||||
@@ -10,6 +9,7 @@ import com.raoulvdberge.refinedstorage.item.filter.Filter;
|
|||||||
import com.raoulvdberge.refinedstorage.network.MessageWirelessCraftingMonitorViewAutomated;
|
import com.raoulvdberge.refinedstorage.network.MessageWirelessCraftingMonitorViewAutomated;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileController;
|
import com.raoulvdberge.refinedstorage.tile.TileController;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
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;
|
||||||
@@ -38,7 +38,7 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
|
|||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(this, 0, stack.getTagCompound());
|
StackUtils.writeItems(this, 0, stack.getTagCompound());
|
||||||
|
|
||||||
TileController controller = getController();
|
TileController controller = getController();
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
|
|||||||
this.viewAutomated = ItemWirelessCraftingMonitor.canViewAutomated(stack);
|
this.viewAutomated = ItemWirelessCraftingMonitor.canViewAutomated(stack);
|
||||||
|
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
RSUtils.readItems(filter, 0, stack.getTagCompound());
|
StackUtils.readItems(filter, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile.data;
|
package com.raoulvdberge.refinedstorage.tile.data;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
import com.raoulvdberge.refinedstorage.tile.ClientNode;
|
import com.raoulvdberge.refinedstorage.tile.ClientNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.AccessTypeUtils;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.network.datasync.DataParameter;
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
import net.minecraft.network.datasync.DataSerializer;
|
import net.minecraft.network.datasync.DataSerializer;
|
||||||
@@ -96,7 +96,7 @@ public final class RSSerializers {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccessType read(PacketBuffer buf) {
|
public AccessType read(PacketBuffer buf) {
|
||||||
return RSUtils.getAccessType(buf.readInt());
|
return AccessTypeUtils.getAccessType(buf.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile.grid;
|
package com.raoulvdberge.refinedstorage.tile.grid;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.block.GridType;
|
import com.raoulvdberge.refinedstorage.block.GridType;
|
||||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||||
@@ -12,6 +11,7 @@ import com.raoulvdberge.refinedstorage.item.filter.Filter;
|
|||||||
import com.raoulvdberge.refinedstorage.item.filter.FilterTab;
|
import com.raoulvdberge.refinedstorage.item.filter.FilterTab;
|
||||||
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
|
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryCraftResult;
|
import net.minecraft.inventory.InventoryCraftResult;
|
||||||
@@ -53,7 +53,7 @@ public class WirelessGrid implements IGrid {
|
|||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(this, 0, stack.getTagCompound());
|
StackUtils.writeItems(this, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class WirelessGrid implements IGrid {
|
|||||||
this.size = ItemWirelessGrid.getSize(stack);
|
this.size = ItemWirelessGrid.getSize(stack);
|
||||||
|
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
RSUtils.readItems(filter, 0, stack.getTagCompound());
|
StackUtils.readItems(filter, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
@@ -24,6 +23,7 @@ import com.raoulvdberge.refinedstorage.item.filter.FilterTab;
|
|||||||
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
|
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryCraftResult;
|
import net.minecraft.inventory.InventoryCraftResult;
|
||||||
@@ -68,7 +68,7 @@ public class PortableGrid implements IGrid, IPortableGrid {
|
|||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(this, 0, stack.getTagCompound());
|
StackUtils.writeItems(this, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private ItemHandlerBase disk = new ItemHandlerBase(1, s -> NetworkNodeDiskDrive.VALIDATOR_STORAGE_DISK.test(s) && ((IStorageDiskProvider) s.getItem()).create(s).getType() == StorageDiskType.ITEMS) {
|
private ItemHandlerBase disk = new ItemHandlerBase(1, s -> NetworkNodeDiskDrive.VALIDATOR_STORAGE_DISK.test(s) && ((IStorageDiskProvider) s.getItem()).create(s).getType() == StorageDiskType.ITEMS) {
|
||||||
@@ -94,7 +94,7 @@ public class PortableGrid implements IGrid, IPortableGrid {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
cache.invalidate();
|
cache.invalidate();
|
||||||
|
|
||||||
RSUtils.writeItems(this, 4, stack.getTagCompound());
|
StackUtils.writeItems(this, 4, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,10 +127,10 @@ public class PortableGrid implements IGrid, IPortableGrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
RSUtils.readItems(filter, 0, stack.getTagCompound());
|
StackUtils.readItems(filter, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(disk, 4, stack.getTagCompound());
|
StackUtils.readItems(disk, 4, stack.getTagCompound());
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
drainEnergy(RS.INSTANCE.config.portableGridOpenUsage);
|
drainEnergy(RS.INSTANCE.config.portableGridOpenUsage);
|
||||||
@@ -344,7 +344,7 @@ public class PortableGrid implements IGrid, IPortableGrid {
|
|||||||
if (!player.getEntityWorld().isRemote && storage != null) {
|
if (!player.getEntityWorld().isRemote && storage != null) {
|
||||||
storage.writeToNBT();
|
storage.writeToNBT();
|
||||||
|
|
||||||
RSUtils.writeItems(disk, 4, stack.getTagCompound());
|
StackUtils.writeItems(disk, 4, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.*;
|
import com.raoulvdberge.refinedstorage.api.storage.*;
|
||||||
@@ -32,6 +31,8 @@ import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryCraftResult;
|
import net.minecraft.inventory.InventoryCraftResult;
|
||||||
@@ -208,10 +209,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
|||||||
|
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
RSUtils.readItems(filter, i, stack.getTagCompound());
|
StackUtils.readItems(filter, i, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(disk, 4, stack.getTagCompound());
|
StackUtils.readItems(disk, 4, stack.getTagCompound());
|
||||||
|
|
||||||
this.redstoneMode = RedstoneMode.read(stack.getTagCompound());
|
this.redstoneMode = RedstoneMode.read(stack.getTagCompound());
|
||||||
}
|
}
|
||||||
@@ -239,10 +240,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
|||||||
stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false);
|
stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
RSUtils.writeItems(filter, i, stack.getTagCompound());
|
StackUtils.writeItems(filter, i, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.writeItems(disk, 4, stack.getTagCompound());
|
StackUtils.writeItems(disk, 4, stack.getTagCompound());
|
||||||
|
|
||||||
redstoneMode.write(stack.getTagCompound());
|
redstoneMode.write(stack.getTagCompound());
|
||||||
|
|
||||||
@@ -461,7 +462,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
|||||||
if (this.diskState != newDiskState) {
|
if (this.diskState != newDiskState) {
|
||||||
this.diskState = newDiskState;
|
this.diskState = newDiskState;
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +472,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
|||||||
if (this.connected != isConnected) {
|
if (this.connected != isConnected) {
|
||||||
this.connected = isConnected;
|
this.connected = isConnected;
|
||||||
|
|
||||||
RSUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,8 +495,8 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
|||||||
tag.setInteger(NetworkNodeGrid.NBT_SIZE, size);
|
tag.setInteger(NetworkNodeGrid.NBT_SIZE, size);
|
||||||
tag.setInteger(NetworkNodeGrid.NBT_TAB_SELECTED, tabSelected);
|
tag.setInteger(NetworkNodeGrid.NBT_TAB_SELECTED, tabSelected);
|
||||||
|
|
||||||
RSUtils.writeItems(disk, 0, tag);
|
StackUtils.writeItems(disk, 0, tag);
|
||||||
RSUtils.writeItems(filter, 1, tag);
|
StackUtils.writeItems(filter, 1, tag);
|
||||||
|
|
||||||
tag.setInteger(NBT_ENERGY, energyStorage.getEnergyStored());
|
tag.setInteger(NBT_ENERGY, energyStorage.getEnergyStored());
|
||||||
|
|
||||||
@@ -528,8 +529,8 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
|||||||
tabSelected = tag.getInteger(NetworkNodeGrid.NBT_TAB_SELECTED);
|
tabSelected = tag.getInteger(NetworkNodeGrid.NBT_TAB_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSUtils.readItems(disk, 0, tag);
|
StackUtils.readItems(disk, 0, tag);
|
||||||
RSUtils.readItems(filter, 1, tag);
|
StackUtils.readItems(filter, 1, tag);
|
||||||
|
|
||||||
if (tag.hasKey(NBT_ENERGY)) {
|
if (tag.hasKey(NBT_ENERGY)) {
|
||||||
energyStorage.setEnergyStored(tag.getInteger(NBT_ENERGY));
|
energyStorage.setEnergyStored(tag.getInteger(NBT_ENERGY));
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.util;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public final class AccessTypeUtils {
|
||||||
|
private static final String NBT_ACCESS_TYPE = "AccessType";
|
||||||
|
|
||||||
|
public static void writeAccessType(NBTTagCompound tag, AccessType type) {
|
||||||
|
tag.setInteger(NBT_ACCESS_TYPE, type.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AccessType readAccessType(NBTTagCompound tag) {
|
||||||
|
return tag.hasKey(NBT_ACCESS_TYPE) ? getAccessType(tag.getInteger(NBT_ACCESS_TYPE)) : AccessType.INSERT_EXTRACT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AccessType getAccessType(int id) {
|
||||||
|
for (AccessType type : AccessType.values()) {
|
||||||
|
if (type.getId() == id) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return AccessType.INSERT_EXTRACT;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,304 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.util;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import javax.vecmath.Matrix4f;
|
||||||
|
import javax.vecmath.Vector3f;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.DecimalFormatSymbols;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public final class RenderUtils {
|
||||||
|
public static final DecimalFormat QUANTITY_FORMATTER = new DecimalFormat("####0.#", DecimalFormatSymbols.getInstance(Locale.US));
|
||||||
|
|
||||||
|
public static final Matrix4f EMPTY_MATRIX_TRANSFORM = getTransform(0, 0, 0, 0, 0, 0, 1.0f).getMatrix();
|
||||||
|
|
||||||
|
// From ForgeBlockStateV1
|
||||||
|
private static final TRSRTransformation FLIP_X = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||||
|
|
||||||
|
private static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> DEFAULT_ITEM_TRANSFORM;
|
||||||
|
private static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> DEFAULT_BLOCK_TRANSFORM;
|
||||||
|
|
||||||
|
static {
|
||||||
|
QUANTITY_FORMATTER.setRoundingMode(RoundingMode.DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatQuantity(int qty) {
|
||||||
|
if (qty >= 1000000) {
|
||||||
|
return QUANTITY_FORMATTER.format((float) qty / 1000000F) + "M";
|
||||||
|
} else if (qty >= 1000) {
|
||||||
|
return QUANTITY_FORMATTER.format((float) qty / 1000F) + "K";
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.valueOf(qty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AxisAlignedBB getBounds(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
|
||||||
|
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isInBounds(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
|
||||||
|
return hitX >= aabb.minX && hitX <= aabb.maxX && hitY >= aabb.minY && hitY <= aabb.maxY && hitZ >= aabb.minZ && hitZ <= aabb.maxZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3d getStart(EntityPlayer player) {
|
||||||
|
return new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vec3d getEnd(EntityPlayer player) {
|
||||||
|
double reachDistance = player instanceof EntityPlayerMP ? ((EntityPlayerMP) player).interactionManager.getBlockReachDistance() : (player.capabilities.isCreativeMode ? 5.0D : 4.5D);
|
||||||
|
|
||||||
|
Vec3d lookVec = player.getLookVec();
|
||||||
|
Vec3d start = getStart(player);
|
||||||
|
|
||||||
|
return start.addVector(lookVec.x * reachDistance, lookVec.y * reachDistance, lookVec.z * reachDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3d start, Vec3d end, Collection<AxisAlignedBB> boxes) {
|
||||||
|
double minDistance = Double.POSITIVE_INFINITY;
|
||||||
|
AdvancedRayTraceResult hit = null;
|
||||||
|
int i = -1;
|
||||||
|
|
||||||
|
for (AxisAlignedBB aabb : boxes) {
|
||||||
|
AdvancedRayTraceResult result = aabb == null ? null : collisionRayTrace(pos, start, end, aabb, i, null);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
double d = result.squareDistanceTo(start);
|
||||||
|
if (d < minDistance) {
|
||||||
|
minDistance = d;
|
||||||
|
hit = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, Object hitInfo) {
|
||||||
|
RayTraceResult result = bounds.offset(pos).calculateIntercept(start, end);
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = new RayTraceResult(RayTraceResult.Type.BLOCK, result.hitVec, result.sideHit, pos);
|
||||||
|
result.subHit = subHit;
|
||||||
|
result.hitInfo = hitInfo;
|
||||||
|
|
||||||
|
return new AdvancedRayTraceResult(result, bounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setGLColorFromInt(int color) {
|
||||||
|
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||||
|
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||||
|
float blue = (color & 0xFF) / 255.0F;
|
||||||
|
|
||||||
|
GlStateManager.color(red, green, blue, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
||||||
|
double uMin = (double) textureSprite.getMinU();
|
||||||
|
double uMax = (double) textureSprite.getMaxU();
|
||||||
|
double vMin = (double) textureSprite.getMinV();
|
||||||
|
double vMax = (double) textureSprite.getMaxV();
|
||||||
|
uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
|
||||||
|
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
|
||||||
|
BufferBuilder vertexBuffer = tessellator.getBuffer();
|
||||||
|
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
|
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
||||||
|
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
|
||||||
|
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
|
||||||
|
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TRSRTransformation leftifyTransform(TRSRTransformation transform) {
|
||||||
|
return TRSRTransformation.blockCenterToCorner(FLIP_X.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(FLIP_X));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TRSRTransformation getTransform(float tx, float ty, float tz, float ax, float ay, float az, float s) {
|
||||||
|
return new TRSRTransformation(
|
||||||
|
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||||
|
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||||
|
new Vector3f(s, s, s),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getDefaultItemTransforms() {
|
||||||
|
if (DEFAULT_ITEM_TRANSFORM != null) {
|
||||||
|
return DEFAULT_ITEM_TRANSFORM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DEFAULT_ITEM_TRANSFORM = ImmutableMap.<ItemCameraTransforms.TransformType, TRSRTransformation>builder()
|
||||||
|
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransform(0, 3, 1, 0, 0, 0, 0.55f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransform(0, 3, 1, 0, 0, 0, 0.55f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 2, 0, 0, 0, 0, 0.5f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.HEAD, getTransform(0, 13, 7, 0, 180, 0, 1))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> getDefaultBlockTransforms() {
|
||||||
|
if (DEFAULT_BLOCK_TRANSFORM != null) {
|
||||||
|
return DEFAULT_BLOCK_TRANSFORM;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRSRTransformation thirdperson = getTransform(0, 2.5f, 0, 75, 45, 0, 0.375f);
|
||||||
|
|
||||||
|
return DEFAULT_BLOCK_TRANSFORM = ImmutableMap.<ItemCameraTransforms.TransformType, TRSRTransformation>builder()
|
||||||
|
.put(ItemCameraTransforms.TransformType.GUI, getTransform(0, 0, 0, 30, 225, 0, 0.625f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.GROUND, getTransform(0, 3, 0, 0, 0, 0, 0.25f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.FIXED, getTransform(0, 0, 0, 0, 0, 0, 0.5f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, thirdperson)
|
||||||
|
.put(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, leftifyTransform(thirdperson))
|
||||||
|
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransform(0, 0, 0, 0, 45, 0, 0.4f))
|
||||||
|
.put(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransform(0, 0, 0, 0, 225, 0, 0.4f))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class AdvancedRayTraceResultBase<T extends RayTraceResult> {
|
||||||
|
public final AxisAlignedBB bounds;
|
||||||
|
public final T hit;
|
||||||
|
|
||||||
|
public AdvancedRayTraceResultBase(T mop, AxisAlignedBB bounds) {
|
||||||
|
|
||||||
|
this.hit = mop;
|
||||||
|
this.bounds = bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean valid() {
|
||||||
|
return hit != null && bounds != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double squareDistanceTo(Vec3d vec) {
|
||||||
|
return hit.hitVec.squareDistanceTo(vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AdvancedRayTraceResult extends AdvancedRayTraceResultBase<RayTraceResult> {
|
||||||
|
public AdvancedRayTraceResult(RayTraceResult mop, AxisAlignedBB bounds) {
|
||||||
|
super(mop, bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FluidRenderer {
|
||||||
|
private static final int TEX_WIDTH = 16;
|
||||||
|
private static final int TEX_HEIGHT = 16;
|
||||||
|
private static final int MIN_FLUID_HEIGHT = 1;
|
||||||
|
|
||||||
|
private final int capacityMb;
|
||||||
|
private final int width;
|
||||||
|
private final int height;
|
||||||
|
|
||||||
|
public FluidRenderer(int capacityMb, int width, int height) {
|
||||||
|
this.capacityMb = capacityMb;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.enableAlpha();
|
||||||
|
|
||||||
|
drawFluid(minecraft, xPosition, yPosition, fluidStack);
|
||||||
|
|
||||||
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
GlStateManager.disableAlpha();
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawFluid(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
||||||
|
if (fluidStack == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fluid fluid = fluidStack.getFluid();
|
||||||
|
|
||||||
|
if (fluid == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||||
|
ResourceLocation fluidStill = fluid.getStill();
|
||||||
|
TextureAtlasSprite fluidStillSprite = null;
|
||||||
|
|
||||||
|
if (fluidStill != null) {
|
||||||
|
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fluidStillSprite == null) {
|
||||||
|
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
||||||
|
}
|
||||||
|
|
||||||
|
int fluidColor = fluid.getColor(fluidStack);
|
||||||
|
|
||||||
|
int scaledAmount = height;
|
||||||
|
|
||||||
|
if (capacityMb != -1) {
|
||||||
|
scaledAmount = (fluidStack.amount * height) / capacityMb;
|
||||||
|
|
||||||
|
if (fluidStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) {
|
||||||
|
scaledAmount = MIN_FLUID_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scaledAmount > height) {
|
||||||
|
scaledAmount = height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||||
|
setGLColorFromInt(fluidColor);
|
||||||
|
|
||||||
|
int xTileCount = width / TEX_WIDTH;
|
||||||
|
int xRemainder = width - (xTileCount * TEX_WIDTH);
|
||||||
|
int yTileCount = scaledAmount / TEX_HEIGHT;
|
||||||
|
int yRemainder = scaledAmount - (yTileCount * TEX_HEIGHT);
|
||||||
|
|
||||||
|
int yStart = yPosition + height;
|
||||||
|
|
||||||
|
for (int xTile = 0; xTile <= xTileCount; xTile++) {
|
||||||
|
for (int yTile = 0; yTile <= yTileCount; yTile++) {
|
||||||
|
int width = (xTile == xTileCount) ? xRemainder : TEX_WIDTH;
|
||||||
|
int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT;
|
||||||
|
int x = xPosition + (xTile * TEX_WIDTH);
|
||||||
|
int y = yStart - ((yTile + 1) * TEX_HEIGHT);
|
||||||
|
|
||||||
|
if (width > 0 && height > 0) {
|
||||||
|
int maskTop = TEX_HEIGHT - height;
|
||||||
|
int maskRight = TEX_WIDTH - width;
|
||||||
|
|
||||||
|
drawFluidTexture(x, y, fluidStillSprite, maskTop, maskRight, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,299 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.util;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.IStorageDiskProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.init.PotionTypes;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.potion.PotionUtils;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||||
|
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||||
|
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public final class StackUtils {
|
||||||
|
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
|
||||||
|
public static final ItemStack EMPTY_BOTTLE = new ItemStack(Items.GLASS_BOTTLE);
|
||||||
|
public static final ItemStack WATER_BOTTLE = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER);
|
||||||
|
|
||||||
|
private static final String NBT_INVENTORY = "Inventory_%d";
|
||||||
|
private static final String NBT_SLOT = "Slot";
|
||||||
|
|
||||||
|
private static final Map<Integer, List<ItemStack>> OREDICT_CACHE = new HashMap<>();
|
||||||
|
private static final Map<Integer, Boolean> OREDICT_EQUIVALENCY_CACHE = new HashMap<>();
|
||||||
|
|
||||||
|
private static final NonNullList<Object> EMPTY_NON_NULL_LIST = NonNullList.create();
|
||||||
|
|
||||||
|
public static List<ItemStack> getEquivalentStacks(ItemStack stack) {
|
||||||
|
int hash = API.instance().getItemStackHashCode(stack, false);
|
||||||
|
|
||||||
|
if (OREDICT_CACHE.containsKey(hash)) {
|
||||||
|
return OREDICT_CACHE.get(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ItemStack> ores = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int id : OreDictionary.getOreIDs(stack)) {
|
||||||
|
ores.addAll(OreDictionary.getOres(OreDictionary.getOreName(id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
OREDICT_CACHE.put(hash, ores);
|
||||||
|
|
||||||
|
return ores;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean areStacksEquivalent(ItemStack left, ItemStack right) {
|
||||||
|
int code = API.instance().getItemStackHashCode(left, false);
|
||||||
|
code = 31 * code + API.instance().getItemStackHashCode(right, false);
|
||||||
|
|
||||||
|
if (OREDICT_EQUIVALENCY_CACHE.containsKey(code)) {
|
||||||
|
return OREDICT_EQUIVALENCY_CACHE.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] leftIds = OreDictionary.getOreIDs(left);
|
||||||
|
int[] rightIds = OreDictionary.getOreIDs(right);
|
||||||
|
|
||||||
|
for (int i : rightIds) {
|
||||||
|
if (ArrayUtils.contains(leftIds, i)) {
|
||||||
|
OREDICT_EQUIVALENCY_CACHE.put(code, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OREDICT_EQUIVALENCY_CACHE.put(code, false);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeItemStack(ByteBuf buf, ItemStack stack) {
|
||||||
|
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||||
|
buf.writeInt(stack.getCount());
|
||||||
|
buf.writeInt(stack.getItemDamage());
|
||||||
|
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack readItemStack(ByteBuf buf) {
|
||||||
|
ItemStack stack = new ItemStack(Item.getItemById(buf.readInt()), buf.readInt(), buf.readInt());
|
||||||
|
stack.setTagCompound(ByteBufUtils.readTag(buf));
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeItemStack(ByteBuf buf, ItemStack stack, @Nullable INetwork network, boolean displayCraftText) {
|
||||||
|
writeItemStack(buf, stack);
|
||||||
|
|
||||||
|
buf.writeInt(API.instance().getItemStackHashCode(stack));
|
||||||
|
|
||||||
|
if (network != null) {
|
||||||
|
buf.writeBoolean(network.getCraftingManager().hasPattern(stack));
|
||||||
|
buf.writeBoolean(displayCraftText);
|
||||||
|
} else {
|
||||||
|
buf.writeBoolean(false);
|
||||||
|
buf.writeBoolean(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeFluidStack(ByteBuf buf, FluidStack stack) {
|
||||||
|
buf.writeInt(API.instance().getFluidStackHashCode(stack));
|
||||||
|
ByteBufUtils.writeUTF8String(buf, FluidRegistry.getFluidName(stack.getFluid()));
|
||||||
|
buf.writeInt(stack.amount);
|
||||||
|
ByteBufUtils.writeTag(buf, stack.tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Pair<Integer, FluidStack> readFluidStack(ByteBuf buf) {
|
||||||
|
return Pair.of(buf.readInt(), new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack nullToEmpty(@Nullable ItemStack stack) {
|
||||||
|
return stack == null ? ItemStack.EMPTY : stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static ItemStack emptyToNull(@Nonnull ItemStack stack) {
|
||||||
|
return stack.isEmpty() ? null : stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static void createStorages(ItemStack disk, int slot, IStorageDisk<ItemStack>[] itemStorages, IStorageDisk<FluidStack>[] fluidStorages, Function<IStorageDisk<ItemStack>, IStorageDisk> itemStorageWrapper, Function<IStorageDisk<FluidStack>, IStorageDisk> fluidStorageWrapper) {
|
||||||
|
if (disk.isEmpty()) {
|
||||||
|
itemStorages[slot] = null;
|
||||||
|
fluidStorages[slot] = null;
|
||||||
|
} else {
|
||||||
|
IStorageDiskProvider provider = (IStorageDiskProvider) disk.getItem();
|
||||||
|
IStorageDisk storage = provider.create(disk);
|
||||||
|
|
||||||
|
storage.readFromNBT();
|
||||||
|
|
||||||
|
switch (storage.getType()) {
|
||||||
|
case ITEMS:
|
||||||
|
itemStorages[slot] = itemStorageWrapper.apply(storage);
|
||||||
|
break;
|
||||||
|
case FLUIDS:
|
||||||
|
fluidStorages[slot] = fluidStorageWrapper.apply(storage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NonNullList<ItemStack> toNonNullList(List<ItemStack> list) {
|
||||||
|
NonNullList<ItemStack> other = NonNullList.create();
|
||||||
|
|
||||||
|
for (ItemStack item : list) {
|
||||||
|
if (item != null) {
|
||||||
|
other.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> NonNullList<T> emptyNonNullList() {
|
||||||
|
return (NonNullList<T>) EMPTY_NON_NULL_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeItems(IItemHandler handler, int id, NBTTagCompound tag) {
|
||||||
|
NBTTagList tagList = new NBTTagList();
|
||||||
|
|
||||||
|
for (int i = 0; i < handler.getSlots(); i++) {
|
||||||
|
if (!handler.getStackInSlot(i).isEmpty()) {
|
||||||
|
NBTTagCompound stackTag = new NBTTagCompound();
|
||||||
|
|
||||||
|
stackTag.setInteger(NBT_SLOT, i);
|
||||||
|
|
||||||
|
handler.getStackInSlot(i).writeToNBT(stackTag);
|
||||||
|
|
||||||
|
tagList.appendTag(stackTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tag.setTag(String.format(NBT_INVENTORY, id), tagList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void readItems(IItemHandlerModifiable handler, int id, NBTTagCompound tag) {
|
||||||
|
String name = String.format(NBT_INVENTORY, id);
|
||||||
|
|
||||||
|
if (tag.hasKey(name)) {
|
||||||
|
NBTTagList tagList = tag.getTagList(name, Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
|
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||||
|
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
||||||
|
|
||||||
|
if (slot >= 0 && slot < handler.getSlots()) {
|
||||||
|
handler.setStackInSlot(slot, new ItemStack(tagList.getCompoundTagAt(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeItems(IInventory inventory, int id, NBTTagCompound tag) {
|
||||||
|
NBTTagList tagList = new NBTTagList();
|
||||||
|
|
||||||
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
|
if (!inventory.getStackInSlot(i).isEmpty()) {
|
||||||
|
NBTTagCompound stackTag = new NBTTagCompound();
|
||||||
|
|
||||||
|
stackTag.setInteger(NBT_SLOT, i);
|
||||||
|
|
||||||
|
inventory.getStackInSlot(i).writeToNBT(stackTag);
|
||||||
|
|
||||||
|
tagList.appendTag(stackTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tag.setTag(String.format(NBT_INVENTORY, id), tagList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void readItems(IInventory inventory, int id, NBTTagCompound tag) {
|
||||||
|
String name = String.format(NBT_INVENTORY, id);
|
||||||
|
|
||||||
|
if (tag.hasKey(name)) {
|
||||||
|
NBTTagList tagList = tag.getTagList(name, Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
|
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||||
|
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
||||||
|
|
||||||
|
ItemStack stack = new ItemStack(tagList.getCompoundTagAt(i));
|
||||||
|
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NBTTagList serializeFluidStackList(IStackList<FluidStack> list) {
|
||||||
|
NBTTagList tagList = new NBTTagList();
|
||||||
|
|
||||||
|
for (FluidStack stack : list.getStacks()) {
|
||||||
|
tagList.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return tagList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IStackList<FluidStack> readFluidStackList(NBTTagList tagList) {
|
||||||
|
IStackList<FluidStack> list = API.instance().createFluidStackList();
|
||||||
|
|
||||||
|
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||||
|
FluidStack stack = FluidStack.loadFluidStackFromNBT(tagList.getCompoundTagAt(i));
|
||||||
|
|
||||||
|
if (stack != null) {
|
||||||
|
list.add(stack, stack.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasFluidBucket(FluidStack stack) {
|
||||||
|
return stack.getFluid() == FluidRegistry.WATER || stack.getFluid() == FluidRegistry.LAVA || stack.getFluid().getName().equals("milk") || FluidRegistry.getBucketFluids().contains(stack.getFluid());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FluidStack copy(FluidStack stack, int size) {
|
||||||
|
FluidStack copy = stack.copy();
|
||||||
|
copy.amount = size;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FluidStack copy(@Nullable FluidStack stack) {
|
||||||
|
return stack == null ? null : stack.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Pair<ItemStack, FluidStack> getFluid(ItemStack stack, boolean simulate) {
|
||||||
|
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||||
|
IFluidHandlerItem fluidHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
|
||||||
|
|
||||||
|
FluidStack result = fluidHandler.drain(Fluid.BUCKET_VOLUME, !simulate);
|
||||||
|
|
||||||
|
return Pair.of(fluidHandler.getContainer(), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pair.of(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.util;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.Style;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||||
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||||
|
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public final class WorldUtils {
|
||||||
|
public static void updateBlock(@Nullable World world, BlockPos pos) {
|
||||||
|
if (world != null) {
|
||||||
|
world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 1 | 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IItemHandler getItemHandler(@Nullable TileEntity tile, EnumFacing side) {
|
||||||
|
if (tile == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IItemHandler handler = tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) ? tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) : null;
|
||||||
|
|
||||||
|
if (handler == null) {
|
||||||
|
if (side != null && tile instanceof ISidedInventory) {
|
||||||
|
handler = new SidedInvWrapper((ISidedInventory) tile, side);
|
||||||
|
} else if (tile instanceof IInventory) {
|
||||||
|
handler = new InvWrapper((IInventory) tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IFluidHandler getFluidHandler(@Nullable TileEntity tile, EnumFacing side) {
|
||||||
|
return (tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) ? tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendNoPermissionMessage(EntityPlayer player) {
|
||||||
|
player.sendMessage(new TextComponentTranslation("misc.refinedstorage:security.no_permission").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user