Initial port to MC 1.11
This commit is contained in:
21
build.gradle
21
build.gradle
@@ -20,7 +20,7 @@ apply plugin: 'maven'
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
|
|
||||||
version = "1.2.6"
|
version = "1.3"
|
||||||
group = "refinedstorage"
|
group = "refinedstorage"
|
||||||
archivesBaseName = "refinedstorage"
|
archivesBaseName = "refinedstorage"
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@ sourceCompatibility = 1.8
|
|||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.10.2-12.18.2.2151"
|
version = "1.11-13.19.0.2160"
|
||||||
runDir = "run"
|
runDir = "run"
|
||||||
useDepAts = true
|
useDepAts = true
|
||||||
mappings = "stable_29"
|
mappings = "snapshot_20161126"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -41,21 +41,12 @@ repositories {
|
|||||||
maven {
|
maven {
|
||||||
url "http://maven.epoxide.xyz"
|
url "http://maven.epoxide.xyz"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
name = "ic2"
|
|
||||||
url = "http://maven.ic2.player.to/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
url "http://maven.amadornes.com/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mezz.jei:jei_1.10.2:3.13.3.373:api"
|
deobfCompile "mezz.jei:jei_1.11:4.0.3.196:api"
|
||||||
runtime "mezz.jei:jei_1.10.2:3.13.3.373"
|
runtime "mezz.jei:jei_1.11:4.0.3.196"
|
||||||
deobfCompile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49"
|
deobfCompile "net.darkhax.tesla:Tesla:1.11-1.3.0.51"
|
||||||
deobfCompile "net.industrial-craft:industrialcraft-2:2.6.105-ex110:api"
|
|
||||||
deobfCompile "MCMultiPart:MCMultiPart:1.3.0:universal"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.proxy.ProxyCommon;
|
import com.raoulvdberge.refinedstorage.proxy.ProxyCommon;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
@@ -36,13 +35,8 @@ public final class RS {
|
|||||||
public final SimpleNetworkWrapper network = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
public final SimpleNetworkWrapper network = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
||||||
public final CreativeTabs tab = new CreativeTabs(ID) {
|
public final CreativeTabs tab = new CreativeTabs(ID) {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getIconItemStack() {
|
public ItemStack getTabIconItem() {
|
||||||
return new ItemStack(RSItems.STORAGE_HOUSING);
|
return getIconItemStack();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Item getTabIconItem() {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
import net.minecraftforge.fluids.capability.wrappers.FluidHandlerWrapper;
|
|
||||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
@@ -35,6 +34,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public final class RSUtils {
|
|||||||
|
|
||||||
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack) {
|
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack) {
|
||||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||||
buf.writeInt(stack.stackSize);
|
buf.writeInt(stack.getCount());
|
||||||
buf.writeInt(stack.getItemDamage());
|
buf.writeInt(stack.getItemDamage());
|
||||||
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
|
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
|
||||||
buf.writeInt(API.instance().getItemStackHashCode(stack));
|
buf.writeInt(API.instance().getItemStackHashCode(stack));
|
||||||
@@ -84,6 +84,18 @@ public final class RSUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
public static void writeItems(IItemHandler handler, int id, NBTTagCompound tag) {
|
public static void writeItems(IItemHandler handler, int id, NBTTagCompound tag) {
|
||||||
NBTTagList tagList = new NBTTagList();
|
NBTTagList tagList = new NBTTagList();
|
||||||
|
|
||||||
@@ -111,10 +123,8 @@ public final class RSUtils {
|
|||||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||||
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
||||||
|
|
||||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tagList.getCompoundTagAt(i));
|
|
||||||
|
|
||||||
if (slot >= 0 && slot < handler.getSlots()) {
|
if (slot >= 0 && slot < handler.getSlots()) {
|
||||||
handler.setStackInSlot(slot, stack);
|
handler.setStackInSlot(slot, new ItemStack(tagList.getCompoundTagAt(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,9 +157,11 @@ public final class RSUtils {
|
|||||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||||
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
int slot = tagList.getCompoundTagAt(i).getInteger(NBT_SLOT);
|
||||||
|
|
||||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tagList.getCompoundTagAt(i));
|
ItemStack stack = new ItemStack(tagList.getCompoundTagAt(i));
|
||||||
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
if (!stack.isEmpty()) {
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,23 +232,17 @@ public final class RSUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFluidHandler handler = null;
|
if (!tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) {
|
||||||
|
return null;
|
||||||
if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) {
|
|
||||||
handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
|
|
||||||
} else if (tile instanceof net.minecraftforge.fluids.IFluidHandler) {
|
|
||||||
handler = new FluidHandlerWrapper((net.minecraftforge.fluids.IFluidHandler) tile, side);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler;
|
return tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static FluidStack getFluidFromStack(ItemStack stack, boolean simulate) {
|
public static FluidStack getFluidFromStack(ItemStack stack, boolean simulate) {
|
||||||
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
|
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
|
||||||
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(Fluid.BUCKET_VOLUME, !simulate);
|
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(Fluid.BUCKET_VOLUME, !simulate);
|
||||||
} else if (stack.getItem() instanceof IFluidContainerItem) {
|
|
||||||
return ((IFluidContainerItem) stack.getItem()).drain(stack, Fluid.BUCKET_VOLUME, !simulate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public interface ICraftingStep {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param stack the output to check
|
* @param stack the output to check
|
||||||
* @return true if we received the given output (based upon item and stacksize), false otherwise
|
* @return true if we received the given output (based upon item and getCount()), false otherwise
|
||||||
*/
|
*/
|
||||||
boolean hasReceivedOutput(ItemStack stack);
|
boolean hasReceivedOutput(ItemStack stack);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public interface IItemStackList {
|
|||||||
* @param stack the stack
|
* @param stack the stack
|
||||||
*/
|
*/
|
||||||
default void add(@Nonnull ItemStack stack) {
|
default void add(@Nonnull ItemStack stack) {
|
||||||
add(stack, stack.stackSize);
|
add(stack, stack.getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +47,7 @@ public interface IItemStackList {
|
|||||||
* @return whether the remove was successful for the full amount
|
* @return whether the remove was successful for the full amount
|
||||||
*/
|
*/
|
||||||
default boolean remove(@Nonnull ItemStack stack, boolean removeIfReachedZero) {
|
default boolean remove(@Nonnull ItemStack stack, boolean removeIfReachedZero) {
|
||||||
return remove(stack, stack.stackSize, removeIfReachedZero);
|
return remove(stack, stack.getCount(), removeIfReachedZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +70,7 @@ public interface IItemStackList {
|
|||||||
* @return whether the remove was successful for the full amount
|
* @return whether the remove was successful for the full amount
|
||||||
*/
|
*/
|
||||||
default boolean trackedRemove(@Nonnull ItemStack stack, boolean removeIfReachedZero) {
|
default boolean trackedRemove(@Nonnull ItemStack stack, boolean removeIfReachedZero) {
|
||||||
return trackedRemove(stack, stack.stackSize, removeIfReachedZero);
|
return trackedRemove(stack, stack.getCount(), removeIfReachedZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -131,7 +131,10 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
.map(OreDictionary::getOres)
|
.map(OreDictionary::getOres)
|
||||||
.flatMap(List::stream)
|
.flatMap(List::stream)
|
||||||
.map(ItemStack::copy)
|
.map(ItemStack::copy)
|
||||||
.map(s -> {s.stackSize = input.stackSize; return s;})
|
.map(s -> {
|
||||||
|
s.setCount(input.getCount());
|
||||||
|
return s;
|
||||||
|
})
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +261,7 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
|
|
||||||
for (ItemStack output : outputs) {
|
for (ItemStack output : outputs) {
|
||||||
if (API.instance().getComparer().isEqual(requested, output, compare)) {
|
if (API.instance().getComparer().isEqual(requested, output, compare)) {
|
||||||
quantity += output.stackSize;
|
quantity += output.getCount();
|
||||||
|
|
||||||
if (!ItemPattern.isProcessing(stack)) {
|
if (!ItemPattern.isProcessing(stack)) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ public class CraftingTaskFactory implements ICraftingTaskFactory {
|
|||||||
Deque<ItemStack> toInsert = new ArrayDeque<>();
|
Deque<ItemStack> toInsert = new ArrayDeque<>();
|
||||||
|
|
||||||
for (int i = 0; i < toInsertList.tagCount(); ++i) {
|
for (int i = 0; i < toInsertList.tagCount(); ++i) {
|
||||||
ItemStack insertStack = ItemStack.loadItemStackFromNBT(toInsertList.getCompoundTagAt(i));
|
ItemStack insertStack = new ItemStack(toInsertList.getCompoundTagAt(i));
|
||||||
|
|
||||||
if (insertStack != null) {
|
if (!insertStack.isEmpty()) {
|
||||||
toInsert.add(insertStack);
|
toInsert.add(insertStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean readFromNBT(NBTTagCompound tag) {
|
public boolean readFromNBT(NBTTagCompound tag) {
|
||||||
ItemStack patternStack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_PATTERN));
|
ItemStack patternStack = new ItemStack(tag.getCompoundTag(NBT_PATTERN));
|
||||||
|
|
||||||
if (patternStack != null) {
|
if (!patternStack.isEmpty()) {
|
||||||
TileEntity container = network.getNetworkWorld().getTileEntity(BlockPos.fromLong(tag.getLong(NBT_PATTERN_CONTAINER)));
|
TileEntity container = network.getNetworkWorld().getTileEntity(BlockPos.fromLong(tag.getLong(NBT_PATTERN_CONTAINER)));
|
||||||
|
|
||||||
if (container instanceof ICraftingPatternContainer) {
|
if (container instanceof ICraftingPatternContainer) {
|
||||||
@@ -99,7 +99,7 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
public boolean hasReceivedOutputs() {
|
public boolean hasReceivedOutputs() {
|
||||||
for (ItemStack stack : pattern.getOutputs()) {
|
for (ItemStack stack : pattern.getOutputs()) {
|
||||||
Integer received = satisfied.get(API.instance().getItemStackHashCode(stack));
|
Integer received = satisfied.get(API.instance().getItemStackHashCode(stack));
|
||||||
if (received == null || stack.stackSize > received) {
|
if (received == null || stack.getCount() > received) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasReceivedOutput(ItemStack stack) {
|
public boolean hasReceivedOutput(ItemStack stack) {
|
||||||
Integer received = satisfied.get(API.instance().getItemStackHashCode(stack));
|
Integer received = satisfied.get(API.instance().getItemStackHashCode(stack));
|
||||||
return received != null && received >= stack.stackSize;
|
return received != null && received >= stack.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -128,14 +128,14 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
received = 0;
|
received = 0;
|
||||||
}
|
}
|
||||||
if (API.instance().getComparer().isEqual(stack, output, CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0))) {
|
if (API.instance().getComparer().isEqual(stack, output, CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0))) {
|
||||||
if (received < output.stackSize) {
|
if (received < output.getCount()) {
|
||||||
int toReceive = Math.min(output.stackSize - received, stack.stackSize);
|
int toReceive = Math.min(output.getCount() - received, stack.getCount());
|
||||||
satisfied.put(hashcode, received + toReceive);
|
satisfied.put(hashcode, received + toReceive);
|
||||||
stack.stackSize -= toReceive;
|
stack.shrink(toReceive);
|
||||||
|
|
||||||
network.markCraftingMonitorForUpdate();
|
network.markCraftingMonitorForUpdate();
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected AvailableType isItemAvailable(IItemStackList items, IFluidStackList fluids, ItemStack stack, ItemStack actualStack, int compare) {
|
protected AvailableType isItemAvailable(IItemStackList items, IFluidStackList fluids, ItemStack stack, ItemStack actualStack, int compare) {
|
||||||
if (actualStack == null || actualStack.stackSize == 0 || !items.trackedRemove(actualStack, stack.stackSize, true)) {
|
if (actualStack == null || actualStack.getCount() == 0 || !items.trackedRemove(actualStack, stack.getCount(), true)) {
|
||||||
FluidStack fluidInItem = RSUtils.getFluidFromStack(stack, true);
|
FluidStack fluidInItem = RSUtils.getFluidFromStack(stack, true);
|
||||||
|
|
||||||
if (fluidInItem != null && RSUtils.hasFluidBucket(fluidInItem)) {
|
if (fluidInItem != null && RSUtils.hasFluidBucket(fluidInItem)) {
|
||||||
@@ -187,7 +187,7 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
compare |= IComparer.COMPARE_DAMAGE;
|
compare |= IComparer.COMPARE_DAMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack input = network.extractItem(insertStack, insertStack.stackSize, compare, false);
|
ItemStack input = network.extractItem(insertStack, insertStack.getCount(), compare, false);
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
actualInputs.add(input);
|
actualInputs.add(input);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -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.network.INetworkMaster;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
@@ -13,7 +12,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -107,7 +105,7 @@ public class CraftingStepCraft extends CraftingStep {
|
|||||||
NBTTagList toInsertList = tag.getTagList(NBT_TO_INSERT, Constants.NBT.TAG_COMPOUND);
|
NBTTagList toInsertList = tag.getTagList(NBT_TO_INSERT, Constants.NBT.TAG_COMPOUND);
|
||||||
toInsert = new ArrayList<>(toInsertList.tagCount());
|
toInsert = new ArrayList<>(toInsertList.tagCount());
|
||||||
for (int i = 0; i < toInsertList.tagCount(); ++i) {
|
for (int i = 0; i < toInsertList.tagCount(); ++i) {
|
||||||
toInsert.add(ItemStack.loadItemStackFromNBT(toInsertList.getCompoundTagAt(i)));
|
toInsert.add(new ItemStack(toInsertList.getCompoundTagAt(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.network.INetworkMaster;
|
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
@@ -49,9 +48,9 @@ public class CraftingStepProcess extends CraftingStep {
|
|||||||
AvailableType type = isItemAvailable(items, fluids, stack, actualStack, compare);
|
AvailableType type = isItemAvailable(items, fluids, stack, actualStack, compare);
|
||||||
|
|
||||||
if (type == AvailableType.ITEM) {
|
if (type == AvailableType.ITEM) {
|
||||||
toInsert.add(ItemHandlerHelper.copyStackWithSize(actualStack, stack.stackSize));
|
toInsert.add(ItemHandlerHelper.copyStackWithSize(actualStack, stack.getCount()));
|
||||||
} else if (type == AvailableType.FLUID) {
|
} else if (type == AvailableType.FLUID) {
|
||||||
toInsert.add(ItemHandlerHelper.copyStackWithSize(stack, stack.stackSize));
|
toInsert.add(ItemHandlerHelper.copyStackWithSize(stack, stack.getCount()));
|
||||||
} else {
|
} else {
|
||||||
items.undo();
|
items.undo();
|
||||||
fluids.undo();
|
fluids.undo();
|
||||||
@@ -105,14 +104,14 @@ public class CraftingStepProcess extends CraftingStep {
|
|||||||
ItemStack remainder = null;
|
ItemStack remainder = null;
|
||||||
for (Integer slot : availableSlots) {
|
for (Integer slot : availableSlots) {
|
||||||
remainder = dest.insertItem(slot, current, true);
|
remainder = dest.insertItem(slot, current, true);
|
||||||
if (remainder == null || current.stackSize != remainder.stackSize) {
|
if (remainder == null || current.getCount() != remainder.getCount()) {
|
||||||
availableSlots.remove(slot);
|
availableSlots.remove(slot);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (remainder == null || remainder.stackSize <= 0) {
|
if (remainder == null || remainder.getCount() <= 0) {
|
||||||
current = stacks.poll();
|
current = stacks.poll();
|
||||||
} else if (current.stackSize == remainder.stackSize) {
|
} else if (current.getCount() == remainder.getCount()) {
|
||||||
break; // Can't be inserted
|
break; // Can't be inserted
|
||||||
} else {
|
} else {
|
||||||
current = remainder;
|
current = remainder;
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.IFluidStackList;
|
import com.raoulvdberge.refinedstorage.api.util.IFluidStackList;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IItemStackList;
|
import com.raoulvdberge.refinedstorage.api.util.IItemStackList;
|
||||||
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.CraftingMonitorElementError;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementInfo;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementItemRender;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementText;
|
||||||
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.ItemStackList;
|
import com.raoulvdberge.refinedstorage.apiimpl.util.ItemStackList;
|
||||||
@@ -134,44 +137,44 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
// This handles recipes that use the output as input for the sub recipe
|
// This handles recipes that use the output as input for the sub recipe
|
||||||
final int lambdaCompare = compare;
|
final int lambdaCompare = compare;
|
||||||
ICraftingPattern inputPattern = null;
|
ICraftingPattern inputPattern = null;
|
||||||
int available = (extraStack == null ? 0 : extraStack.stackSize) + (networkStack == null ? 0 : networkStack.stackSize);
|
int available = (extraStack == null ? 0 : extraStack.getCount()) + (networkStack == null ? 0 : networkStack.getCount());
|
||||||
if (available < input.stackSize) {
|
if (available < input.getCount()) {
|
||||||
inputPattern = network.getPattern(input, compare);
|
inputPattern = network.getPattern(input, compare);
|
||||||
if (inputPattern != null) {
|
if (inputPattern != null) {
|
||||||
if (inputPattern.getInputs().stream().anyMatch(s -> API.instance().getComparer().isEqual(s, input, lambdaCompare))) {
|
if (inputPattern.getInputs().stream().anyMatch(s -> API.instance().getComparer().isEqual(s, input, lambdaCompare))) {
|
||||||
int craftQuantity = inputPattern.getQuantityPerRequest(input, compare);
|
int craftQuantity = inputPattern.getQuantityPerRequest(input, compare);
|
||||||
// The needed amount is the actual needed amount of extraStacks + the needed input (twice so you can keep repeating it)
|
// The needed amount is the actual needed amount of extraStacks + the needed input (twice so you can keep repeating it)
|
||||||
long needed = (networkStack == null ? 0 : -networkStack.stackSize) + input.stackSize + inputPattern.getInputs().stream().filter(s -> API.instance().getComparer().isEqual(s, input, lambdaCompare)).count() * 2;
|
long needed = (networkStack == null ? 0 : -networkStack.getCount()) + input.getCount() + inputPattern.getInputs().stream().filter(s -> API.instance().getComparer().isEqual(s, input, lambdaCompare)).count() * 2;
|
||||||
do {
|
do {
|
||||||
calculate(networkList, networkFluidList, inputPattern, toInsert);
|
calculate(networkList, networkFluidList, inputPattern, toInsert);
|
||||||
toCraft.add(ItemHandlerHelper.copyStackWithSize(input, craftQuantity));
|
toCraft.add(ItemHandlerHelper.copyStackWithSize(input, craftQuantity));
|
||||||
extraStack = toInsert.get(input, compare);
|
extraStack = toInsert.get(input, compare);
|
||||||
} while (extraStack != null && extraStack.stackSize < needed);
|
} while (extraStack != null && extraStack.getCount() < needed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (input.stackSize > 0) {
|
while (input.getCount() > 0) {
|
||||||
if (extraStack != null && extraStack.stackSize > 0) {
|
if (extraStack != null && extraStack.getCount() > 0) {
|
||||||
int takeQuantity = Math.min(extraStack.stackSize, input.stackSize);
|
int takeQuantity = Math.min(extraStack.getCount(), input.getCount());
|
||||||
ItemStack inputStack = ItemHandlerHelper.copyStackWithSize(extraStack, takeQuantity);
|
ItemStack inputStack = ItemHandlerHelper.copyStackWithSize(extraStack, takeQuantity);
|
||||||
actualInputs.add(inputStack.copy());
|
actualInputs.add(inputStack.copy());
|
||||||
input.stackSize -= takeQuantity;
|
input.shrink(takeQuantity);
|
||||||
if (!inputStack.isItemStackDamageable() || !inputStack.isItemDamaged()) {
|
if (!inputStack.isItemStackDamageable() || !inputStack.isItemDamaged()) {
|
||||||
toCraft.add(inputStack);
|
toCraft.add(inputStack);
|
||||||
}
|
}
|
||||||
toInsert.remove(inputStack, true);
|
toInsert.remove(inputStack, true);
|
||||||
if (input.stackSize > 0) {
|
if (input.getCount() > 0) {
|
||||||
extraStack = toInsert.get(input, compare);
|
extraStack = toInsert.get(input, compare);
|
||||||
}
|
}
|
||||||
} else if (networkStack != null && networkStack.stackSize > 0) {
|
} else if (networkStack != null && networkStack.getCount() > 0) {
|
||||||
int takeQuantity = Math.min(networkStack.stackSize, input.stackSize);
|
int takeQuantity = Math.min(networkStack.getCount(), input.getCount());
|
||||||
ItemStack inputStack = ItemHandlerHelper.copyStackWithSize(networkStack, takeQuantity);
|
ItemStack inputStack = ItemHandlerHelper.copyStackWithSize(networkStack, takeQuantity);
|
||||||
toTake.add(inputStack.copy());
|
toTake.add(inputStack.copy());
|
||||||
actualInputs.add(inputStack.copy());
|
actualInputs.add(inputStack.copy());
|
||||||
input.stackSize -= takeQuantity;
|
input.shrink(takeQuantity);
|
||||||
networkList.remove(inputStack, true);
|
networkList.remove(inputStack, true);
|
||||||
if (input.stackSize > 0) {
|
if (input.getCount() > 0) {
|
||||||
networkStack = networkList.get(inputStack, compare);
|
networkStack = networkList.get(inputStack, compare);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -181,12 +184,12 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
|
|
||||||
if (inputPattern != null) {
|
if (inputPattern != null) {
|
||||||
ItemStack actualCraft = inputPattern.getActualOutput(input, compare);
|
ItemStack actualCraft = inputPattern.getActualOutput(input, compare);
|
||||||
int craftQuantity = Math.min(inputPattern.getQuantityPerRequest(input, compare), input.stackSize);
|
int craftQuantity = Math.min(inputPattern.getQuantityPerRequest(input, compare), input.getCount());
|
||||||
ItemStack inputCrafted = ItemHandlerHelper.copyStackWithSize(actualCraft, craftQuantity);
|
ItemStack inputCrafted = ItemHandlerHelper.copyStackWithSize(actualCraft, craftQuantity);
|
||||||
toCraft.add(inputCrafted.copy());
|
toCraft.add(inputCrafted.copy());
|
||||||
actualInputs.add(inputCrafted.copy());
|
actualInputs.add(inputCrafted.copy());
|
||||||
calculate(networkList, networkFluidList, inputPattern, toInsert);
|
calculate(networkList, networkFluidList, inputPattern, toInsert);
|
||||||
input.stackSize -= craftQuantity;
|
input.shrink(craftQuantity);
|
||||||
if (!recurseFound) {
|
if (!recurseFound) {
|
||||||
// Calculate added all the crafted outputs toInsert
|
// Calculate added all the crafted outputs toInsert
|
||||||
// So we remove the ones we use from toInsert
|
// So we remove the ones we use from toInsert
|
||||||
@@ -196,15 +199,15 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
} else {
|
} else {
|
||||||
// Fluid checks are with a stack size of one
|
// Fluid checks are with a stack size of one
|
||||||
ItemStack fluidCheck = ItemHandlerHelper.copyStackWithSize(input, 1);
|
ItemStack fluidCheck = ItemHandlerHelper.copyStackWithSize(input, 1);
|
||||||
while (input.stackSize > 0 && doFluidCalculation(networkList, networkFluidList, fluidCheck, toInsert)) {
|
while (input.getCount() > 0 && doFluidCalculation(networkList, networkFluidList, fluidCheck, toInsert)) {
|
||||||
actualInputs.add(fluidCheck);
|
actualInputs.add(fluidCheck);
|
||||||
input.stackSize -= 1;
|
input.shrink(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When it isn't a fluid or just doesn't have the needed fluids
|
// When it isn't a fluid or just doesn't have the needed fluids
|
||||||
if (input.stackSize > 0) {
|
if (input.getCount() > 0) {
|
||||||
missing.add(input.copy());
|
missing.add(input.copy());
|
||||||
input.stackSize = 0;
|
input.setCount(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,12 +249,12 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
} else {
|
} else {
|
||||||
ItemStack bucket = toInsert.get(RSUtils.EMPTY_BUCKET);
|
ItemStack bucket = toInsert.get(RSUtils.EMPTY_BUCKET);
|
||||||
boolean hasBucket = false;
|
boolean hasBucket = false;
|
||||||
if (bucket != null && bucket.stackSize > 0) {
|
if (bucket != null && bucket.getCount() > 0) {
|
||||||
hasBucket = toInsert.remove(RSUtils.EMPTY_BUCKET, 1, false);
|
hasBucket = toInsert.remove(RSUtils.EMPTY_BUCKET, 1, false);
|
||||||
}
|
}
|
||||||
if (!hasBucket) {
|
if (!hasBucket) {
|
||||||
bucket = networkList.get(RSUtils.EMPTY_BUCKET);
|
bucket = networkList.get(RSUtils.EMPTY_BUCKET);
|
||||||
if (bucket != null && bucket.stackSize > 0) {
|
if (bucket != null && bucket.getCount() > 0) {
|
||||||
hasBucket = networkList.remove(RSUtils.EMPTY_BUCKET, 1, false);
|
hasBucket = networkList.remove(RSUtils.EMPTY_BUCKET, 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,7 +286,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
@Override
|
@Override
|
||||||
public void onCancelled() {
|
public void onCancelled() {
|
||||||
for (ItemStack stack : toInsertItems) {
|
for (ItemStack stack : toInsertItems) {
|
||||||
network.insertItem(stack, stack.stackSize, false);
|
network.insertItem(stack, stack.getCount(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
network.markCraftingMonitorForUpdate();
|
network.markCraftingMonitorForUpdate();
|
||||||
@@ -341,7 +344,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
for (int i = 0; i < times; i++) {
|
for (int i = 0; i < times; i++) {
|
||||||
ItemStack insert = toInsertItems.poll();
|
ItemStack insert = toInsertItems.poll();
|
||||||
if (insert != null) {
|
if (insert != null) {
|
||||||
ItemStack remainder = network.insertItem(insert, insert.stackSize, false);
|
ItemStack remainder = network.insertItem(insert, insert.getCount(), false);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
toInsertItems.add(remainder);
|
toInsertItems.add(remainder);
|
||||||
@@ -441,7 +444,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
.map(stack -> new CraftingMonitorElementError(new CraftingMonitorElementItemRender(
|
.map(stack -> new CraftingMonitorElementError(new CraftingMonitorElementItemRender(
|
||||||
-1,
|
-1,
|
||||||
stack,
|
stack,
|
||||||
stack.stackSize,
|
stack.getCount(),
|
||||||
32
|
32
|
||||||
), ""))
|
), ""))
|
||||||
.forEach(elements::add);
|
.forEach(elements::add);
|
||||||
@@ -456,7 +459,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
.map(stack -> new CraftingMonitorElementItemRender(
|
.map(stack -> new CraftingMonitorElementItemRender(
|
||||||
-1,
|
-1,
|
||||||
stack,
|
stack,
|
||||||
stack.stackSize,
|
stack.getCount(),
|
||||||
32
|
32
|
||||||
))
|
))
|
||||||
.forEach(elements::add);
|
.forEach(elements::add);
|
||||||
@@ -476,7 +479,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
ICraftingMonitorElement element = new CraftingMonitorElementItemRender(
|
ICraftingMonitorElement element = new CraftingMonitorElementItemRender(
|
||||||
-1,
|
-1,
|
||||||
step.getPattern().getOutputs().get(i),
|
step.getPattern().getOutputs().get(i),
|
||||||
step.getPattern().getOutputs().get(i).stackSize,
|
step.getPattern().getOutputs().get(i).getCount(),
|
||||||
32
|
32
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -499,7 +502,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
ICraftingMonitorElement element = new CraftingMonitorElementItemRender(
|
ICraftingMonitorElement element = new CraftingMonitorElementItemRender(
|
||||||
-1,
|
-1,
|
||||||
step.getPattern().getOutputs().get(i),
|
step.getPattern().getOutputs().get(i),
|
||||||
step.getPattern().getOutputs().get(i).stackSize,
|
step.getPattern().getOutputs().get(i).getCount(),
|
||||||
32
|
32
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -553,7 +556,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
if (previewStack == null) {
|
if (previewStack == null) {
|
||||||
previewStack = new CraftingPreviewElementItemStack(stack);
|
previewStack = new CraftingPreviewElementItemStack(stack);
|
||||||
}
|
}
|
||||||
previewStack.addToCraft(stack.stackSize);
|
previewStack.addToCraft(stack.getCount());
|
||||||
map.put(hash, previewStack);
|
map.put(hash, previewStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,7 +567,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
previewStack = new CraftingPreviewElementItemStack(stack);
|
previewStack = new CraftingPreviewElementItemStack(stack);
|
||||||
}
|
}
|
||||||
previewStack.setMissing(true);
|
previewStack.setMissing(true);
|
||||||
previewStack.addToCraft(stack.stackSize);
|
previewStack.addToCraft(stack.getCount());
|
||||||
map.put(hash, previewStack);
|
map.put(hash, previewStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,7 +577,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
if (previewStack == null) {
|
if (previewStack == null) {
|
||||||
previewStack = new CraftingPreviewElementItemStack(stack);
|
previewStack = new CraftingPreviewElementItemStack(stack);
|
||||||
}
|
}
|
||||||
previewStack.addAvailable(stack.stackSize);
|
previewStack.addAvailable(stack.getCount());
|
||||||
map.put(hash, previewStack);
|
map.put(hash, previewStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int itemSize = item.stackSize;
|
int itemSize = item.getCount();
|
||||||
int maxItemSize = item.getItem().getItemStackLimit(item);
|
int maxItemSize = item.getItem().getItemStackLimit(item);
|
||||||
|
|
||||||
boolean single = (flags & EXTRACT_SINGLE) == EXTRACT_SINGLE;
|
boolean single = (flags & EXTRACT_SINGLE) == EXTRACT_SINGLE;
|
||||||
@@ -40,7 +40,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
ItemStack held = player.inventory.getItemStack();
|
ItemStack held = player.inventory.getItemStack();
|
||||||
|
|
||||||
if (single) {
|
if (single) {
|
||||||
if (held != null && (!API.instance().getComparer().isEqualNoQuantity(item, held) || held.stackSize + 1 > held.getMaxStackSize())) {
|
if (held != null && (!API.instance().getComparer().isEqualNoQuantity(item, held) || held.getCount() + 1 > held.getMaxStackSize())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (player.inventory.getItemStack() != null) {
|
} else if (player.inventory.getItemStack() != null) {
|
||||||
@@ -78,7 +78,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
took = network.extractItem(item, size, false);
|
took = network.extractItem(item, size, false);
|
||||||
|
|
||||||
if (single && held != null) {
|
if (single && held != null) {
|
||||||
held.stackSize++;
|
held.grow(1);
|
||||||
} else {
|
} else {
|
||||||
player.inventory.setItemStack(took);
|
player.inventory.setItemStack(took);
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onInsert(EntityPlayerMP player, ItemStack stack) {
|
public ItemStack onInsert(EntityPlayerMP player, ItemStack stack) {
|
||||||
ItemStack remainder = network.insertItem(stack, stack.stackSize, false);
|
ItemStack remainder = network.insertItem(stack, stack.getCount(), false);
|
||||||
|
|
||||||
INetworkItem networkItem = network.getNetworkItemHandler().getItem(player);
|
INetworkItem networkItem = network.getNetworkItemHandler().getItem(player);
|
||||||
|
|
||||||
@@ -114,15 +114,15 @@ public class ItemGridHandler implements IItemGridHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = player.inventory.getItemStack();
|
ItemStack stack = player.inventory.getItemStack();
|
||||||
int size = single ? 1 : stack.stackSize;
|
int size = single ? 1 : stack.getCount();
|
||||||
|
|
||||||
if (single) {
|
if (single) {
|
||||||
if (network.insertItem(stack, size, true) == null) {
|
if (network.insertItem(stack, size, true) == null) {
|
||||||
network.insertItem(stack, size, false);
|
network.insertItem(stack, size, false);
|
||||||
|
|
||||||
stack.stackSize -= size;
|
stack.shrink(size);
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
player.inventory.setItemStack(null);
|
player.inventory.setItemStack(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class SoldererRegistry implements ISoldererRegistry {
|
|||||||
ItemStack row = recipe.getRow(i);
|
ItemStack row = recipe.getRow(i);
|
||||||
|
|
||||||
if (rows.getStackInSlot(i) != null && row != null) {
|
if (rows.getStackInSlot(i) != null && row != null) {
|
||||||
if (rows.getStackInSlot(i).stackSize < row.stackSize) {
|
if (rows.getStackInSlot(i).getCount() < row.getCount()) {
|
||||||
found = false;
|
found = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ItemStorageCache implements IItemStorageCache {
|
|||||||
|
|
||||||
for (ItemStack stack : storage.getStacks()) {
|
for (ItemStack stack : storage.getStacks()) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
add(stack, stack.stackSize, true);
|
add(stack, stack.getCount(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,8 +48,8 @@ public class ItemStorageCache implements IItemStorageCache {
|
|||||||
for (ICraftingPattern pattern : network.getPatterns()) {
|
for (ICraftingPattern pattern : network.getPatterns()) {
|
||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
ItemStack patternStack = output.copy();
|
ItemStack patternStack = output.copy();
|
||||||
patternStack.stackSize = 0;
|
patternStack.setCount(0);
|
||||||
add(patternStack, patternStack.stackSize, true);
|
add(patternStack, patternStack.getCount(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
|||||||
// ItemHandlerHelper#copyStackWithSize is not null-safe!
|
// ItemHandlerHelper#copyStackWithSize is not null-safe!
|
||||||
private ItemStack safeCopy(ItemStack stack, int size) {
|
private ItemStack safeCopy(ItemStack stack, int size) {
|
||||||
ItemStack newStack = stack.copy();
|
ItemStack newStack = stack.copy();
|
||||||
newStack.stackSize = size;
|
newStack.setCount(size);
|
||||||
return newStack;
|
return newStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
|||||||
NBTTagCompound itemTag = new NBTTagCompound();
|
NBTTagCompound itemTag = new NBTTagCompound();
|
||||||
|
|
||||||
itemTag.setInteger(NBT_ITEM_TYPE, Item.getIdFromItem(stack.getItem()));
|
itemTag.setInteger(NBT_ITEM_TYPE, Item.getIdFromItem(stack.getItem()));
|
||||||
itemTag.setInteger(NBT_ITEM_QUANTITY, stack.stackSize);
|
itemTag.setInteger(NBT_ITEM_QUANTITY, stack.getCount());
|
||||||
itemTag.setInteger(NBT_ITEM_DAMAGE, stack.getItemDamage());
|
itemTag.setInteger(NBT_ITEM_DAMAGE, stack.getItemDamage());
|
||||||
|
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
@@ -135,7 +135,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
|||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
tag.setInteger(NBT_STORED, getStored() + remainingSpace);
|
tag.setInteger(NBT_STORED, getStored() + remainingSpace);
|
||||||
|
|
||||||
otherStack.stackSize += remainingSpace;
|
otherStack.grow(remainingSpace);
|
||||||
|
|
||||||
onStorageChanged();
|
onStorageChanged();
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
|||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
tag.setInteger(NBT_STORED, getStored() + size);
|
tag.setInteger(NBT_STORED, getStored() + size);
|
||||||
|
|
||||||
otherStack.stackSize += size;
|
otherStack.grow(size);
|
||||||
|
|
||||||
onStorageChanged();
|
onStorageChanged();
|
||||||
}
|
}
|
||||||
@@ -188,15 +188,15 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
|||||||
public synchronized ItemStack extractItem(ItemStack stack, int size, int flags, boolean simulate) {
|
public synchronized ItemStack extractItem(ItemStack stack, int size, int flags, boolean simulate) {
|
||||||
for (ItemStack otherStack : stacks) {
|
for (ItemStack otherStack : stacks) {
|
||||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||||
if (size > otherStack.stackSize) {
|
if (size > otherStack.getCount()) {
|
||||||
size = otherStack.stackSize;
|
size = otherStack.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
if (otherStack.stackSize - size == 0) {
|
if (otherStack.getCount() - size == 0) {
|
||||||
stacks.remove(otherStack);
|
stacks.remove(otherStack);
|
||||||
} else {
|
} else {
|
||||||
otherStack.stackSize -= size;
|
otherStack.grow(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setInteger(NBT_STORED, getStored() - size);
|
tag.setInteger(NBT_STORED, getStored() - size);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class Comparer implements IComparer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & COMPARE_QUANTITY) == COMPARE_QUANTITY) {
|
if ((flags & COMPARE_QUANTITY) == COMPARE_QUANTITY) {
|
||||||
if (left.stackSize != right.stackSize) {
|
if (left.getCount() != right.getCount()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ public class ItemStackList implements IItemStackList {
|
|||||||
public void add(@Nonnull ItemStack stack, int size) {
|
public void add(@Nonnull ItemStack stack, int size) {
|
||||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||||
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||||
if ((long) otherStack.stackSize + (long) size > Integer.MAX_VALUE) {
|
if ((long) otherStack.getCount() + (long) size > Integer.MAX_VALUE) {
|
||||||
otherStack.stackSize = Integer.MAX_VALUE;
|
otherStack.setCount(Integer.MAX_VALUE);
|
||||||
} else {
|
} else {
|
||||||
otherStack.stackSize += size;
|
otherStack.grow(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -39,11 +39,12 @@ public class ItemStackList implements IItemStackList {
|
|||||||
@Override
|
@Override
|
||||||
public boolean remove(@Nonnull ItemStack stack, int size, boolean removeIfReachedZero) {
|
public boolean remove(@Nonnull ItemStack stack, int size, boolean removeIfReachedZero) {
|
||||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||||
if (otherStack.stackSize > 0 && API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
if (otherStack.getCount() > 0 && API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||||
otherStack.stackSize -= size;
|
otherStack.shrink(size);
|
||||||
boolean success = otherStack.stackSize >= 0;
|
|
||||||
|
|
||||||
if (otherStack.stackSize <= 0 && removeIfReachedZero) {
|
boolean success = otherStack.getCount() >= 0;
|
||||||
|
|
||||||
|
if (otherStack.getCount() <= 0 && removeIfReachedZero) {
|
||||||
stacks.remove(otherStack.getItem(), otherStack);
|
stacks.remove(otherStack.getItem(), otherStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,13 +58,15 @@ public class ItemStackList implements IItemStackList {
|
|||||||
@Override
|
@Override
|
||||||
public boolean trackedRemove(@Nonnull ItemStack stack, int size, boolean removeIfReachedZero) {
|
public boolean trackedRemove(@Nonnull ItemStack stack, int size, boolean removeIfReachedZero) {
|
||||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||||
if (otherStack.stackSize > 0 && API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
if (otherStack.getCount() > 0 && API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||||
ItemStack removed = ItemHandlerHelper.copyStackWithSize(otherStack, Math.min(size, otherStack.stackSize));
|
ItemStack removed = ItemHandlerHelper.copyStackWithSize(otherStack, Math.min(size, otherStack.getCount()));
|
||||||
this.removeTracker.add(removed);
|
this.removeTracker.add(removed);
|
||||||
otherStack.stackSize -= size;
|
|
||||||
boolean success = otherStack.stackSize >= 0;
|
|
||||||
|
|
||||||
if (otherStack.stackSize <= 0 && removeIfReachedZero) {
|
otherStack.shrink(size);
|
||||||
|
|
||||||
|
boolean success = otherStack.getCount() >= 0;
|
||||||
|
|
||||||
|
if (otherStack.getCount() <= 0 && removeIfReachedZero) {
|
||||||
stacks.remove(otherStack.getItem(), otherStack);
|
stacks.remove(otherStack.getItem(), otherStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +93,7 @@ public class ItemStackList implements IItemStackList {
|
|||||||
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
||||||
// When the oredict flag is set all stacks need to be checked not just the ones matching the item
|
// When the oredict flag is set all stacks need to be checked not just the ones matching the item
|
||||||
for (ItemStack otherStack : (flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT ? stacks.values() : stacks.get(stack.getItem())) {
|
for (ItemStack otherStack : (flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT ? stacks.values() : stacks.get(stack.getItem())) {
|
||||||
if (otherStack.stackSize > 0 && API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
if (otherStack.getCount() > 0 && API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||||
return otherStack;
|
return otherStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +121,7 @@ public class ItemStackList implements IItemStackList {
|
|||||||
@Override
|
@Override
|
||||||
public void clean() {
|
public void clean() {
|
||||||
List<ItemStack> toRemove = stacks.values().stream()
|
List<ItemStack> toRemove = stacks.values().stream()
|
||||||
.filter(stack -> stack.stackSize <= 0)
|
.filter(stack -> stack.getCount() <= 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
toRemove.forEach(stack -> stacks.remove(stack.getItem(), stack));
|
toRemove.forEach(stack -> stacks.remove(stack.getItem(), stack));
|
||||||
@@ -170,7 +173,7 @@ public class ItemStackList implements IItemStackList {
|
|||||||
compare |= IComparer.COMPARE_DAMAGE;
|
compare |= IComparer.COMPARE_DAMAGE;
|
||||||
}
|
}
|
||||||
ItemStack actualInput = list.get(input, compare);
|
ItemStack actualInput = list.get(input, compare);
|
||||||
ItemStack taken = ItemHandlerHelper.copyStackWithSize(actualInput, input.stackSize);
|
ItemStack taken = ItemHandlerHelper.copyStackWithSize(actualInput, input.getCount());
|
||||||
took[i] = taken;
|
took[i] = taken;
|
||||||
list.remove(taken, true);
|
list.remove(taken, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ItemStackListOredicted implements IItemStackList {
|
|||||||
public void add(@Nonnull ItemStack stack, int size) {
|
public void add(@Nonnull ItemStack stack, int size) {
|
||||||
underlyingList.add(stack, size);
|
underlyingList.add(stack, size);
|
||||||
ItemStack internalStack = underlyingList.get(stack);
|
ItemStack internalStack = underlyingList.get(stack);
|
||||||
if (internalStack != null && internalStack.stackSize == stack.stackSize) {
|
if (internalStack != null && internalStack.getCount() == stack.getCount()) {
|
||||||
for (int id : OreDictionary.getOreIDs(internalStack)) {
|
for (int id : OreDictionary.getOreIDs(internalStack)) {
|
||||||
stacks.put(id, internalStack);
|
stacks.put(id, internalStack);
|
||||||
}
|
}
|
||||||
@@ -86,10 +86,10 @@ public class ItemStackListOredicted implements IItemStackList {
|
|||||||
if (stacks != null && !stacks.isEmpty()) {
|
if (stacks != null && !stacks.isEmpty()) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
ItemStack returnStack = stacks.get(i++);
|
ItemStack returnStack = stacks.get(i++);
|
||||||
while (returnStack.stackSize == 0 && i < stacks.size()) {
|
while (returnStack.getCount() == 0 && i < stacks.size()) {
|
||||||
returnStack = stacks.get(i++);
|
returnStack = stacks.get(i++);
|
||||||
}
|
}
|
||||||
if (returnStack.stackSize != 0) {
|
if (returnStack.getCount() != 0) {
|
||||||
return returnStack;
|
return returnStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ public class ItemStackListOredicted implements IItemStackList {
|
|||||||
|
|
||||||
private void localClean() {
|
private void localClean() {
|
||||||
List<Map.Entry<Integer, ItemStack>> toRemove = stacks.entries().stream()
|
List<Map.Entry<Integer, ItemStack>> toRemove = stacks.entries().stream()
|
||||||
.filter(entry -> entry.getValue().stackSize <= 0)
|
.filter(entry -> entry.getValue().getCount() <= 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
toRemove.forEach(entry -> stacks.remove(entry.getKey(), entry.getValue()));
|
toRemove.forEach(entry -> stacks.remove(entry.getKey(), entry.getValue()));
|
||||||
|
|||||||
@@ -1,24 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
|
||||||
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileCable;
|
import com.raoulvdberge.refinedstorage.tile.TileCable;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileMultipartNode;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
|
||||||
import mcmultipart.block.BlockCoverable;
|
|
||||||
import mcmultipart.block.BlockMultipartContainer;
|
|
||||||
import mcmultipart.raytrace.RayTraceUtils;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.properties.PropertyDirection;
|
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.inventory.InventoryHelper;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -28,15 +16,12 @@ import net.minecraft.util.math.RayTraceResult;
|
|||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCable extends BlockCoverable {
|
public class BlockCable extends BlockNode {
|
||||||
protected static final PropertyDirection DIRECTION = PropertyDirection.create("direction");
|
|
||||||
|
|
||||||
protected static AxisAlignedBB createAABB(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
|
protected static AxisAlignedBB createAABB(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);
|
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
|
||||||
}
|
}
|
||||||
@@ -55,43 +40,15 @@ public class BlockCable extends BlockCoverable {
|
|||||||
protected static final PropertyBool WEST = PropertyBool.create("west");
|
protected static final PropertyBool WEST = PropertyBool.create("west");
|
||||||
protected static final PropertyBool UP = PropertyBool.create("up");
|
protected static final PropertyBool UP = PropertyBool.create("up");
|
||||||
protected static final PropertyBool DOWN = PropertyBool.create("down");
|
protected static final PropertyBool DOWN = PropertyBool.create("down");
|
||||||
protected static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public BlockCable(String name) {
|
public BlockCable(String name) {
|
||||||
super(Material.ROCK);
|
super(name);
|
||||||
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
setHardness(0.6F);
|
|
||||||
setRegistryName(RS.ID, name);
|
|
||||||
setCreativeTab(RS.INSTANCE.tab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCable() {
|
public BlockCable() {
|
||||||
this("cable");
|
this("cable");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUnlocalizedName() {
|
|
||||||
return "block." + RS.ID + ":" + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvidePower(IBlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTileEntity(IBlockState state) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
return new TileCable();
|
return new TileCable();
|
||||||
@@ -103,67 +60,38 @@ public class BlockCable extends BlockCoverable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
BlockStateContainer.Builder builder = new BlockStateContainer.Builder(this);
|
BlockStateContainer.Builder builder = super.createBlockStateBuilder();
|
||||||
|
|
||||||
builder.add(NORTH)
|
builder.add(NORTH)
|
||||||
.add(EAST)
|
.add(EAST)
|
||||||
.add(SOUTH)
|
.add(SOUTH)
|
||||||
.add(WEST)
|
.add(WEST)
|
||||||
.add(UP)
|
.add(UP)
|
||||||
.add(DOWN)
|
.add(DOWN);
|
||||||
.add(BlockMultipartContainer.PROPERTY_MULTIPART_CONTAINER);
|
|
||||||
|
|
||||||
if (getPlacementType() != null) {
|
if (getPlacementType() != null) {
|
||||||
builder.add(DIRECTION);
|
builder.add(DIRECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasConnectivityState()) {
|
|
||||||
builder.add(CONNECTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
state = super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(NORTH, hasConnectionWith(world, pos, EnumFacing.NORTH))
|
.withProperty(NORTH, hasConnectionWith(world, pos, EnumFacing.NORTH))
|
||||||
.withProperty(EAST, hasConnectionWith(world, pos, EnumFacing.EAST))
|
.withProperty(EAST, hasConnectionWith(world, pos, EnumFacing.EAST))
|
||||||
.withProperty(SOUTH, hasConnectionWith(world, pos, EnumFacing.SOUTH))
|
.withProperty(SOUTH, hasConnectionWith(world, pos, EnumFacing.SOUTH))
|
||||||
.withProperty(WEST, hasConnectionWith(world, pos, EnumFacing.WEST))
|
.withProperty(WEST, hasConnectionWith(world, pos, EnumFacing.WEST))
|
||||||
.withProperty(UP, hasConnectionWith(world, pos, EnumFacing.UP))
|
.withProperty(UP, hasConnectionWith(world, pos, EnumFacing.UP))
|
||||||
.withProperty(DOWN, hasConnectionWith(world, pos, EnumFacing.DOWN));
|
.withProperty(DOWN, hasConnectionWith(world, pos, EnumFacing.DOWN));
|
||||||
|
|
||||||
TileNode tile = (TileNode) world.getTileEntity(pos);
|
|
||||||
if (tile != null) {
|
|
||||||
if (getPlacementType() != null) {
|
|
||||||
state = state.withProperty(DIRECTION, tile.getDirection());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasConnectivityState()) {
|
|
||||||
state = state.withProperty(CONNECTED, tile.isConnected());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasConnectionWith(IBlockAccess world, BlockPos pos, EnumFacing direction) {
|
private boolean hasConnectionWith(IBlockAccess world, BlockPos pos, EnumFacing direction) {
|
||||||
TileEntity facing = world.getTileEntity(pos.offset(direction));
|
TileEntity facing = world.getTileEntity(pos.offset(direction));
|
||||||
|
|
||||||
boolean isConnectable = API.instance().getConnectableConditions().stream().anyMatch(p -> p.test(facing));
|
return API.instance().getConnectableConditions().stream().anyMatch(p -> p.test(facing));
|
||||||
if (isConnectable) {
|
|
||||||
// Do not render a cable extension where our cable "head" is (e.g. importer, exporter, external storage heads).
|
|
||||||
TileMultipartNode multipartNode = ((TileMultipartNode) world.getTileEntity(pos));
|
|
||||||
if (getPlacementType() != null && multipartNode != null && multipartNode.getFacingTile() == facing) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !TileMultipartNode.hasBlockingMicroblock(world, pos, direction) && !TileMultipartNode.hasBlockingMicroblock(world, pos.offset(direction), direction.getOpposite());
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInAABB(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
|
private boolean isInAABB(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
|
||||||
@@ -228,17 +156,20 @@ public class BlockCable extends BlockCoverable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxToListDefault(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
|
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
|
||||||
for (AxisAlignedBB aabb : getCollisionBoxes(this.getActualState(state, world, pos))) {
|
for (AxisAlignedBB aabb : getCollisionBoxes(this.getActualState(state, world, pos))) {
|
||||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, aabb);
|
addCollisionBoxToList(pos, entityBox, collidingBoxes, aabb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult collisionRayTraceDefault(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) {
|
public RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) {
|
||||||
RayTraceUtils.AdvancedRayTraceResult result = RayTraceUtils.collisionRayTrace(world, pos, start, end, getCollisionBoxes(this.getActualState(state, world, pos)));
|
// @TODO
|
||||||
|
/*RayTraceUtils.AdvancedRayTraceResult result = RayTraceUtils.collisionRayTrace(world, pos, start, end, getCollisionBoxes(this.getActualState(state, world, pos)));
|
||||||
|
|
||||||
return result != null ? result.hit : null;
|
return result != null ? result.hit : null;
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -251,10 +182,6 @@ public class BlockCable extends BlockCoverable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumPlacementType getPlacementType() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase entity) {
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase entity) {
|
||||||
@@ -267,96 +194,6 @@ public class BlockCable extends BlockCoverable {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
|
||||||
|
|
||||||
if (getPlacementType() != null) {
|
|
||||||
((TileBase) world.getTileEntity(pos)).setDirection(state.getValue(DIRECTION));
|
|
||||||
}
|
|
||||||
|
|
||||||
attemptConnect(world, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void attemptConnect(World world, BlockPos pos) {
|
|
||||||
if (!world.isRemote) {
|
|
||||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos.offset(facing));
|
|
||||||
|
|
||||||
if (tile instanceof TileNode && ((TileNode) tile).isConnected()) {
|
|
||||||
((TileNode) tile).getNetwork().getNodeGraph().rebuild();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
|
||||||
INetworkMaster network = null;
|
|
||||||
|
|
||||||
if (!world.isRemote) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
|
|
||||||
if (tile instanceof TileNode) {
|
|
||||||
network = ((TileNode) tile).getNetwork();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
|
||||||
IItemHandler handler = ((TileBase) tile).getDrops();
|
|
||||||
|
|
||||||
for (int i = 0; i < handler.getSlots(); ++i) {
|
|
||||||
if (handler.getStackInSlot(i) != null) {
|
|
||||||
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), handler.getStackInSlot(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
|
|
||||||
if (network != null) {
|
|
||||||
network.getNodeGraph().rebuild();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ItemStack> getDropsDefault(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
|
||||||
List<ItemStack> drops = new ArrayList<>();
|
|
||||||
|
|
||||||
drops.add(new ItemStack(this, 1, getMetaFromState(state)));
|
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
|
||||||
|
|
||||||
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
|
||||||
IItemHandler handler = ((TileBase) tile).getDrops();
|
|
||||||
|
|
||||||
for (int i = 0; i < handler.getSlots(); ++i) {
|
|
||||||
if (handler.getStackInSlot(i) != null) {
|
|
||||||
drops.add(handler.getStackInSlot(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return drops;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
|
||||||
if (!world.isRemote && getPlacementType() != null) {
|
|
||||||
TileBase tile = (TileBase) world.getTileEntity(pos);
|
|
||||||
|
|
||||||
tile.setDirection(getPlacementType().cycle(tile.getDirection()));
|
|
||||||
|
|
||||||
tile.updateBlock();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getBlockLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
import com.raoulvdberge.refinedstorage.tile.TileConstructor;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -75,7 +74,7 @@ public class BlockConstructor extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -36,7 +37,7 @@ public class BlockController extends BlockBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subItems) {
|
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
for (int i = 0; i <= 1; i++) {
|
for (int i = 0; i <= 1; i++) {
|
||||||
subItems.add(ItemBlockController.createStackWithNBT(new ItemStack(item, 1, i)));
|
subItems.add(ItemBlockController.createStackWithNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
@@ -79,7 +80,7 @@ public class BlockController extends BlockBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
@@ -113,8 +114,8 @@ public class BlockController extends BlockBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
|
||||||
super.neighborChanged(state, world, pos, block);
|
super.neighborChanged(state, world, pos, block, fromPos);
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
((TileController) world.getTileEntity(pos)).getNodeGraph().rebuild();
|
((TileController) world.getTileEntity(pos)).getNodeGraph().rebuild();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileCrafter;
|
import com.raoulvdberge.refinedstorage.tile.TileCrafter;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -23,7 +22,7 @@ public class BlockCrafter extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.CRAFTER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.CRAFTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -23,7 +22,7 @@ public class BlockCraftingMonitor extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.CRAFTING_MONITOR, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.CRAFTING_MONITOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -32,7 +31,7 @@ public class BlockDestructor extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ 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;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -69,7 +68,7 @@ public class BlockDetector extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.raoulvdberge.refinedstorage.tile.TileDiskDrive;
|
|||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -29,7 +28,7 @@ public class BlockDiskDrive extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.DISK_DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.DISK_DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.raoulvdberge.refinedstorage.tile.TileDiskManipulator;
|
|||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -16,8 +15,6 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BlockDiskManipulator extends BlockNode {
|
public class BlockDiskManipulator extends BlockNode {
|
||||||
public static final PropertyObject<Integer[]> DISK_STATE = new PropertyObject<>("disk_state", Integer[].class);
|
public static final PropertyObject<Integer[]> DISK_STATE = new PropertyObject<>("disk_state", Integer[].class);
|
||||||
|
|
||||||
@@ -31,7 +28,7 @@ public class BlockDiskManipulator extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.DISK_MANIPULATOR, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.DISK_MANIPULATOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
import com.raoulvdberge.refinedstorage.tile.TileExporter;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -86,7 +85,7 @@ public class BlockExporter extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.raoulvdberge.refinedstorage.tile.externalstorage.TileExternalStorage;
|
|||||||
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;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -69,7 +68,7 @@ public class BlockExternalStorage extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -82,8 +81,8 @@ public class BlockExternalStorage extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChangeDefault(World world, BlockPos pos, IBlockState state, Block neighborBlock) {
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
|
||||||
super.onNeighborBlockChangeDefault(world, pos, state, neighborBlock);
|
super.neighborChanged(state, world, pos, block, fromPos);
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
TileExternalStorage externalStorage = (TileExternalStorage) world.getTileEntity(pos);
|
TileExternalStorage externalStorage = (TileExternalStorage) world.getTileEntity(pos);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -23,7 +22,7 @@ public class BlockFluidInterface extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.FLUID_INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.FLUID_INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -34,7 +35,7 @@ public class BlockFluidStorage extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subItems) {
|
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
for (int i = 0; i <= 4; ++i) {
|
for (int i = 0; i <= 4; ++i) {
|
||||||
subItems.add(ItemBlockFluidStorage.initNBT(new ItemStack(item, 1, i)));
|
subItems.add(ItemBlockFluidStorage.initNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
@@ -63,7 +64,7 @@ public class BlockFluidStorage extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.FLUID_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.FLUID_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockGrid extends BlockNode {
|
public class BlockGrid extends BlockNode {
|
||||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ public class BlockGrid extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subItems) {
|
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
for (int i = 0; i <= 3; i++) {
|
for (int i = 0; i <= 3; i++) {
|
||||||
subItems.add(new ItemStack(item, 1, i));
|
subItems.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
@@ -56,7 +55,7 @@ public class BlockGrid extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
import com.raoulvdberge.refinedstorage.tile.TileImporter;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -86,7 +85,7 @@ public class BlockImporter extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -23,7 +22,7 @@ public class BlockInterface extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileNetworkTransmitter;
|
import com.raoulvdberge.refinedstorage.tile.TileNetworkTransmitter;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -18,7 +17,7 @@ public class BlockNetworkTransmitter extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.NETWORK_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.NETWORK_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class BlockProcessingPatternEncoder extends BlockBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.PROCESSING_PATTERN_ENCODER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.PROCESSING_PATTERN_ENCODER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import com.raoulvdberge.refinedstorage.RS;
|
|||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileReader;
|
import com.raoulvdberge.refinedstorage.tile.TileReader;
|
||||||
import mcmultipart.microblock.MicroblockContainer;
|
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -29,7 +27,7 @@ public class BlockReader extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -44,7 +42,7 @@ public class BlockReader extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnectRedstoneDefault(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side, MicroblockContainer partContainer) {
|
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
return side == ((TileReader) world.getTileEntity(pos)).getDirection().getOpposite();
|
return side == ((TileReader) world.getTileEntity(pos)).getDirection().getOpposite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.RSGui;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.TileRelay;
|
import com.raoulvdberge.refinedstorage.tile.TileRelay;
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -23,7 +22,7 @@ public class BlockRelay extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.RELAY, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.RELAY, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class BlockSolderer extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -34,7 +35,7 @@ public class BlockStorage extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subItems) {
|
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
for (int i = 0; i <= 4; ++i) {
|
for (int i = 0; i <= 4; ++i) {
|
||||||
subItems.add(ItemBlockStorage.initNBT(new ItemStack(item, 1, i)));
|
subItems.add(ItemBlockStorage.initNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
@@ -63,7 +64,7 @@ public class BlockStorage extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.block;
|
|||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter;
|
import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter;
|
||||||
import mcmultipart.block.BlockCoverable;
|
|
||||||
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.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
@@ -35,7 +34,7 @@ public class BlockWirelessTransmitter extends BlockNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
player.openGui(RS.INSTANCE, RSGui.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RS.INSTANCE, RSGui.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
@@ -45,7 +44,7 @@ public class BlockWirelessTransmitter extends BlockNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||||
if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) {
|
if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) {
|
||||||
dropBlockAsItem(world, pos, state, 0);
|
dropBlockAsItem(world, pos, state, 0);
|
||||||
|
|
||||||
@@ -73,7 +72,7 @@ public class BlockWirelessTransmitter extends BlockNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||||
return world.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock() instanceof BlockCoverable;
|
return world.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock() instanceof BlockCable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import com.raoulvdberge.refinedstorage.RS;
|
|||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSGui;
|
import com.raoulvdberge.refinedstorage.RSGui;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileWriter;
|
import com.raoulvdberge.refinedstorage.tile.TileWriter;
|
||||||
import mcmultipart.microblock.MicroblockContainer;
|
|
||||||
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.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -29,7 +27,7 @@ public class BlockWriter extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivatedDefault(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
if (hitCablePart(state, world, pos, hitX, hitY, hitZ)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -50,7 +48,7 @@ public class BlockWriter extends BlockCable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public int getWeakPowerDefault(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side, MicroblockContainer partContainer) {
|
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
TileWriter writer = (TileWriter) world.getTileEntity(pos);
|
TileWriter writer = (TileWriter) world.getTileEntity(pos);
|
||||||
|
|
||||||
return side == writer.getDirection().getOpposite() ? writer.getRedstoneStrength() : 0;
|
return side == writer.getDirection().getOpposite() ? writer.getRedstoneStrength() : 0;
|
||||||
@@ -58,8 +56,8 @@ public class BlockWriter extends BlockCable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public int getStrongPowerDefault(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side, MicroblockContainer partContainer) {
|
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
return getWeakPowerDefault(state, world, pos, side, partContainer);
|
return getWeakPower(state, world, pos, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -68,7 +66,7 @@ public class BlockWriter extends BlockCable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnectRedstoneDefault(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side, MicroblockContainer partContainer) {
|
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
return side == ((TileWriter) world.getTileEntity(pos)).getDirection().getOpposite();
|
return side == ((TileWriter) world.getTileEntity(pos)).getDirection().getOpposite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import net.minecraft.block.BlockPistonBase;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -30,7 +29,7 @@ public enum EnumPlacementType {
|
|||||||
case ANY:
|
case ANY:
|
||||||
return facing.getOpposite();
|
return facing.getOpposite();
|
||||||
case ANY_FACE_PLAYER:
|
case ANY_FACE_PLAYER:
|
||||||
return BlockPistonBase.getFacingFromEntity(pos, entity);
|
return EnumFacing.getDirectionFromEntityLiving(pos, entity);
|
||||||
case HORIZONTAL:
|
case HORIZONTAL:
|
||||||
return entity.getHorizontalFacing().getOpposite();
|
return entity.getHorizontalFacing().getOpposite();
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ public abstract class ContainerBase extends Container {
|
|||||||
if (clickType == ClickType.QUICK_MOVE) {
|
if (clickType == ClickType.QUICK_MOVE) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else if (player.inventory.getItemStack() != null) {
|
} else if (player.inventory.getItemStack() != null) {
|
||||||
int amount = player.inventory.getItemStack().stackSize;
|
int amount = player.inventory.getItemStack().getCount();
|
||||||
|
|
||||||
slot.putStack(ItemHandlerHelper.copyStackWithSize(player.inventory.getItemStack(), amount));
|
slot.putStack(ItemHandlerHelper.copyStackWithSize(player.inventory.getItemStack(), amount));
|
||||||
} else if (slot.getHasStack()) {
|
} else if (slot.getHasStack()) {
|
||||||
int amount = slot.getStack().stackSize;
|
int amount = slot.getStack().getCount();
|
||||||
|
|
||||||
if (dragType == 0) {
|
if (dragType == 0) {
|
||||||
amount = Math.max(1, amount - 1);
|
amount = Math.max(1, amount - 1);
|
||||||
@@ -74,7 +74,7 @@ public abstract class ContainerBase extends Container {
|
|||||||
amount = Math.min(64, amount + 1);
|
amount = Math.min(64, amount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
slot.getStack().stackSize = amount;
|
slot.getStack().setCount(amount);
|
||||||
}
|
}
|
||||||
} else if (player.inventory.getItemStack() == null) {
|
} else if (player.inventory.getItemStack() == null) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ContainerConstructor extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 4, 4 + 1);
|
return mergeItemStackToSpecimen(stack, 4, 4 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ContainerCrafter extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ public class ContainerCraftingSettings extends ContainerBase {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlot(int index) {
|
public ItemStack getStackInSlot(int index) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ContainerDestructor extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ContainerDiskDrive extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 8, 8 + 9);
|
return mergeItemStackToSpecimen(stack, 8, 8 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class ContainerDiskManipulator extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 4 + 6, 4 + 6 + 9);
|
return mergeItemStackToSpecimen(stack, 4 + 6, 4 + 6 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ContainerExporter extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ContainerFluidInterface extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 5, 6);
|
return mergeItemStackToSpecimen(stack, 5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ContainerImporter extends ContainerBase {
|
|||||||
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
return mergeItemStackToSpecimen(stack, 4, 4 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class ContainerInterface extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ContainerNetworkTransmitter extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class ContainerSolderer extends ContainerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ContainerWirelessTransmitter extends ContainerBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0) {
|
if (stack.getCount() == 0) {
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class SlotGridCraftingResult extends SlotCrafting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
|
public ItemStack onTake(EntityPlayer player, ItemStack stack) {
|
||||||
FMLCommonHandler.instance().firePlayerCraftingEvent(player, stack, grid.getMatrix());
|
FMLCommonHandler.instance().firePlayerCraftingEvent(player, stack, grid.getMatrix());
|
||||||
|
|
||||||
onCrafting(stack);
|
onCrafting(stack);
|
||||||
@@ -29,5 +29,7 @@ public class SlotGridCraftingResult extends SlotCrafting {
|
|||||||
|
|
||||||
container.sendCraftingSlots();
|
container.sendCraftingSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class SlotSpecimen extends SlotItemHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void putStack(ItemStack stack) {
|
public void putStack(ItemStack stack) {
|
||||||
if (stack != null && !isWithSize()) {
|
if (stack != null && !isWithSize()) {
|
||||||
stack.stackSize = 1;
|
stack.setCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.putStack(stack);
|
super.putStack(stack);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SlotSpecimenLegacy extends Slot {
|
|||||||
@Override
|
@Override
|
||||||
public void putStack(ItemStack stack) {
|
public void putStack(ItemStack stack) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
stack.stackSize = 1;
|
stack.setCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.putStack(stack);
|
super.putStack(stack);
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ public class ClientStackItem implements IClientStack {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getQuantity() {
|
public int getQuantity() {
|
||||||
return stack.stackSize;
|
return stack.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getQuantityForDisplay(boolean advanced) {
|
private String getQuantityForDisplay(boolean advanced) {
|
||||||
int qty = stack.stackSize;
|
int qty = stack.getCount();
|
||||||
|
|
||||||
if (advanced && qty > 1) {
|
if (advanced && qty > 1) {
|
||||||
return String.valueOf(qty);
|
return String.valueOf(qty);
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.integration.ic2;
|
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileController;
|
|
||||||
import ic2.api.energy.prefab.BasicSink;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
|
|
||||||
public class ControllerEnergyIC2 implements IControllerEnergyIC2 {
|
|
||||||
private BasicSink sink;
|
|
||||||
|
|
||||||
public ControllerEnergyIC2(final TileController controller) {
|
|
||||||
this.sink = new BasicSink(controller, (int) IntegrationIC2.toEU(controller.getEnergy().getMaxEnergyStored()), 3) {
|
|
||||||
@Override
|
|
||||||
public double getDemandedEnergy() {
|
|
||||||
return Math.max(0.0D, IntegrationIC2.toEU(controller.getEnergy().getMaxEnergyStored()) - IntegrationIC2.toEU(controller.getEnergy().getEnergyStored()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) {
|
|
||||||
controller.getEnergy().setEnergyStored(controller.getEnergy().getEnergyStored() + IntegrationIC2.toRS(amount));
|
|
||||||
|
|
||||||
return 0.0D;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
sink.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
sink.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkUnload() {
|
|
||||||
sink.onChunkUnload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.integration.ic2;
|
|
||||||
|
|
||||||
public class ControllerEnergyIC2None implements IControllerEnergyIC2 {
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkUnload() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.integration.ic2;
|
|
||||||
|
|
||||||
public interface IControllerEnergyIC2 {
|
|
||||||
void invalidate();
|
|
||||||
|
|
||||||
void update();
|
|
||||||
|
|
||||||
void onChunkUnload();
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.integration.ic2;
|
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
|
|
||||||
|
|
||||||
public final class IntegrationIC2 {
|
|
||||||
public static boolean isLoaded() {
|
|
||||||
return Loader.isModLoaded("IC2");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int toRS(double amount) {
|
|
||||||
return amount >= Double.POSITIVE_INFINITY ? Integer.MAX_VALUE : ((int) Math.floor(amount) * RS.INSTANCE.config.euConversion);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double toEU(int amount) {
|
|
||||||
return Math.floor(amount / RS.INSTANCE.config.euConversion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,29 +36,6 @@ public class RecipeCategorySolderer extends BlankRecipeCategory<RecipeWrapperSol
|
|||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RecipeWrapperSolderer recipeWrapper) {
|
|
||||||
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
|
||||||
|
|
||||||
int x = 0;
|
|
||||||
int y = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
|
||||||
group.init(i, true, x, y);
|
|
||||||
|
|
||||||
y += 18;
|
|
||||||
}
|
|
||||||
|
|
||||||
group.init(3, false, 83, 18);
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
|
||||||
group.set(i, recipeWrapper.getInputs().get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
group.set(3, recipeWrapper.getOutputs().get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RecipeWrapperSolderer recipeWrapper, @Nonnull IIngredients ingredients) {
|
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RecipeWrapperSolderer recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||||
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
IGuiItemStackGroup group = recipeLayout.getItemStacks();
|
||||||
|
|||||||
@@ -12,13 +12,6 @@ public class RecipeHandlerSolderer implements IRecipeHandler<RecipeWrapperSolder
|
|||||||
return RecipeWrapperSolderer.class;
|
return RecipeWrapperSolderer.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public String getRecipeCategoryUid() {
|
|
||||||
return RecipeCategorySolderer.ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public String getRecipeCategoryUid(@Nonnull RecipeWrapperSolderer recipe) {
|
public String getRecipeCategoryUid(@Nonnull RecipeWrapperSolderer recipe) {
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
|
|||||||
return ContainerGrid.class;
|
return ContainerGrid.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid() {
|
|
||||||
return "minecraft.crafting";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||||
if (doTransfer) {
|
if (doTransfer) {
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ public class RecipeTransferHandlerPattern implements IRecipeTransferHandler<Cont
|
|||||||
return ContainerProcessingPatternEncoder.class;
|
return ContainerProcessingPatternEncoder.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRecipeCategoryUid() {
|
|
||||||
return "patternEncoding";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IRecipeTransferError transferRecipe(ContainerProcessingPatternEncoder container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
public IRecipeTransferError transferRecipe(ContainerProcessingPatternEncoder container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||||
@@ -41,13 +36,13 @@ public class RecipeTransferHandlerPattern implements IRecipeTransferHandler<Cont
|
|||||||
|
|
||||||
if (guiIngredient.isInput()) {
|
if (guiIngredient.isInput()) {
|
||||||
if (inputs.containsKey(hash)) {
|
if (inputs.containsKey(hash)) {
|
||||||
inputs.get(hash).stackSize++;
|
inputs.get(hash).grow(1);
|
||||||
} else {
|
} else {
|
||||||
inputs.put(hash, ingredient);
|
inputs.put(hash, ingredient);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (outputs.containsKey(hash)) {
|
if (outputs.containsKey(hash)) {
|
||||||
outputs.get(hash).stackSize++;
|
outputs.get(hash).grow(1);
|
||||||
} else {
|
} else {
|
||||||
outputs.put(hash, ingredient);
|
outputs.put(hash, ingredient);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import mezz.jei.api.ingredients.IIngredients;
|
|||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RecipeWrapperSolderer extends BlankRecipeWrapper {
|
public class RecipeWrapperSolderer extends BlankRecipeWrapper {
|
||||||
@@ -22,18 +21,6 @@ public class RecipeWrapperSolderer extends BlankRecipeWrapper {
|
|||||||
ingredients.setOutput(ItemStack.class, output);
|
ingredients.setOutput(ItemStack.class, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public List<ItemStack> getInputs() {
|
|
||||||
return inputs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public List<ItemStack> getOutputs() {
|
|
||||||
return Collections.singletonList(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof RecipeWrapperSolderer)) {
|
if (!(obj instanceof RecipeWrapperSolderer)) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.raoulvdberge.refinedstorage.inventory;
|
|||||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||||
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.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
public class ItemHandlerGridFilter extends ItemStackHandler {
|
public class ItemHandlerGridFilter extends ItemStackHandler {
|
||||||
@@ -29,7 +30,7 @@ public class ItemHandlerGridFilter extends ItemStackHandler {
|
|||||||
RSUtils.writeItems(this, 0, stack.getTagCompound());
|
RSUtils.writeItems(this, 0, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getFilteredItems() {
|
public NonNullList<ItemStack> getFilteredItems() {
|
||||||
return stacks;
|
return stacks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInteractStackSize() {
|
public int getItemInteractCount() {
|
||||||
return hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
|
return hasUpgrade(ItemUpgrade.TYPE_STACK) ? 64 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ public class ItemBlockFluidStorage extends ItemBlockBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
EnumFluidStorageType type = EnumFluidStorageType.getById(stack.getMetadata());
|
EnumFluidStorageType type = EnumFluidStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
if (type != null && stack.stackSize == 1 && isValid(stack) && FluidStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileFluidStorage.NBT_STORAGE)) <= 0 && stack.getMetadata() != ItemFluidStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
|
if (type != null && stack.getCount() == 1 && isValid(stack) && FluidStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileFluidStorage.NBT_STORAGE)) <= 0 && stack.getMetadata() != ItemFluidStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
|
||||||
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, stack.getMetadata());
|
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, stack.getMetadata());
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ public class ItemBlockStorage extends ItemBlockBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
EnumItemStorageType type = EnumItemStorageType.getById(stack.getMetadata());
|
EnumItemStorageType type = EnumItemStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
if (type != null && stack.stackSize == 1 && isValid(stack) && ItemStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE)) <= 0 && stack.getMetadata() != ItemStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
|
if (type != null && stack.getCount() == 1 && isValid(stack) && ItemStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE)) <= 0 && stack.getMetadata() != ItemStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
|
||||||
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, stack.getMetadata());
|
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, stack.getMetadata());
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.raoulvdberge.refinedstorage.item;
|
|||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemCore extends ItemBase {
|
public class ItemCore extends ItemBase {
|
||||||
public static final int TYPE_CONSTRUCTION = 0;
|
public static final int TYPE_CONSTRUCTION = 0;
|
||||||
@@ -18,7 +17,7 @@ public class ItemCore extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
@@ -40,7 +41,7 @@ public class ItemFluidStorageDisk extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
list.add(FluidStorageNBT.createStackWithNBT(new ItemStack(item, 1, i)));
|
list.add(FluidStorageNBT.createStackWithNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
@@ -81,7 +82,9 @@ public class ItemFluidStorageDisk extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack disk, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack disk = player.getHeldItem(hand);
|
||||||
|
|
||||||
if (!world.isRemote && player.isSneaking() && FluidStorageNBT.isValid(disk) && FluidStorageNBT.getStoredFromNBT(disk.getTagCompound()) <= 0 && disk.getMetadata() != TYPE_CREATIVE) {
|
if (!world.isRemote && player.isSneaking() && FluidStorageNBT.isValid(disk) && FluidStorageNBT.getStoredFromNBT(disk.getTagCompound()) <= 0 && disk.getMetadata() != TYPE_CREATIVE) {
|
||||||
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, disk.getMetadata());
|
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, disk.getMetadata());
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.raoulvdberge.refinedstorage.item;
|
|||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemFluidStoragePart extends ItemBase {
|
public class ItemFluidStoragePart extends ItemBase {
|
||||||
public static final int TYPE_64K = 0;
|
public static final int TYPE_64K = 0;
|
||||||
@@ -20,7 +19,7 @@ public class ItemFluidStoragePart extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i <= 3; ++i) {
|
for (int i = 0; i <= 3; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ public class ItemGridFilter extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.GRID_FILTER));
|
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.GRID_FILTER));
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ public class ItemNetworkCard extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
|
||||||
if (block == RSBlocks.NETWORK_RECEIVER) {
|
if (block == RSBlocks.NETWORK_RECEIVER) {
|
||||||
setReceiver(stack, pos, world.provider.getDimension());
|
setReceiver(player.getHeldItem(hand), pos, world.provider.getDimension());
|
||||||
|
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,17 +5,13 @@ import com.raoulvdberge.refinedstorage.RS;
|
|||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemProvider;
|
import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemProvider;
|
||||||
import com.raoulvdberge.refinedstorage.integration.forgeenergy.NetworkItemEnergyForge;
|
import com.raoulvdberge.refinedstorage.integration.forgeenergy.NetworkItemEnergyForge;
|
||||||
import com.raoulvdberge.refinedstorage.integration.ic2.IntegrationIC2;
|
|
||||||
import com.raoulvdberge.refinedstorage.integration.tesla.IntegrationTesla;
|
import com.raoulvdberge.refinedstorage.integration.tesla.IntegrationTesla;
|
||||||
import com.raoulvdberge.refinedstorage.integration.tesla.NetworkItemEnergyTesla;
|
import com.raoulvdberge.refinedstorage.integration.tesla.NetworkItemEnergyTesla;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileController;
|
import com.raoulvdberge.refinedstorage.tile.TileController;
|
||||||
import ic2.api.item.IElectricItemManager;
|
|
||||||
import ic2.api.item.ISpecialElectricItem;
|
|
||||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -29,16 +25,11 @@ import net.minecraftforge.common.DimensionManager;
|
|||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.fml.common.Optional;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Optional.InterfaceList({
|
public abstract class ItemNetworkItem extends ItemEnergyContainer implements INetworkItemProvider {
|
||||||
@Optional.Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2"),
|
|
||||||
@Optional.Interface(iface = "ic2.api.item.IElectricItemManager", modid = "IC2")
|
|
||||||
})
|
|
||||||
public abstract class ItemNetworkItem extends ItemEnergyContainer implements INetworkItemProvider, ISpecialElectricItem, IElectricItemManager {
|
|
||||||
public static final int TYPE_NORMAL = 0;
|
public static final int TYPE_NORMAL = 0;
|
||||||
public static final int TYPE_CREATIVE = 1;
|
public static final int TYPE_CREATIVE = 1;
|
||||||
|
|
||||||
@@ -59,7 +50,9 @@ public abstract class ItemNetworkItem extends ItemEnergyContainer implements INe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
if (!world.isRemote && isValid(stack)) {
|
if (!world.isRemote && isValid(stack)) {
|
||||||
World controllerWorld = DimensionManager.getWorld(getDimensionId(stack));
|
World controllerWorld = DimensionManager.getWorld(getDimensionId(stack));
|
||||||
|
|
||||||
@@ -76,7 +69,7 @@ public abstract class ItemNetworkItem extends ItemEnergyContainer implements INe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -110,7 +103,7 @@ public abstract class ItemNetworkItem extends ItemEnergyContainer implements INe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
list.add(new ItemStack(item, 1, TYPE_NORMAL));
|
list.add(new ItemStack(item, 1, TYPE_NORMAL));
|
||||||
|
|
||||||
ItemStack fullyCharged = new ItemStack(item, 1, TYPE_NORMAL);
|
ItemStack fullyCharged = new ItemStack(item, 1, TYPE_NORMAL);
|
||||||
@@ -134,7 +127,9 @@ public abstract class ItemNetworkItem extends ItemEnergyContainer implements INe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
Block block = world.getBlockState(pos).getBlock();
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
|
||||||
if (block == RSBlocks.CONTROLLER) {
|
if (block == RSBlocks.CONTROLLER) {
|
||||||
@@ -202,66 +197,6 @@ public abstract class ItemNetworkItem extends ItemEnergyContainer implements INe
|
|||||||
return getUnlocalizedName() + "." + stack.getItemDamage();
|
return getUnlocalizedName() + "." + stack.getItemDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public IElectricItemManager getManager(ItemStack stack) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public double charge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate) {
|
|
||||||
return IntegrationIC2.toEU(receiveEnergy(stack, IntegrationIC2.toRS(amount), simulate));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate) {
|
|
||||||
return IntegrationIC2.toEU(extractEnergy(stack, IntegrationIC2.toRS(amount), simulate));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public double getCharge(ItemStack stack) {
|
|
||||||
return IntegrationIC2.toEU(getEnergyStored(stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public double getMaxCharge(ItemStack stack) {
|
|
||||||
return IntegrationIC2.toEU(getMaxEnergyStored(stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public boolean canUse(ItemStack stack, double amount) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
|
|
||||||
// NO OP
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public String getToolTip(ItemStack stack) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Optional.Method(modid = "IC2")
|
|
||||||
@Override
|
|
||||||
public int getTier(ItemStack stack) {
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid(ItemStack stack) {
|
public boolean isValid(ItemStack stack) {
|
||||||
return stack.hasTagCompound()
|
return stack.hasTagCompound()
|
||||||
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_X)
|
&& stack.getTagCompound().hasKey(NBT_CONTROLLER_X)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.item;
|
package com.raoulvdberge.refinedstorage.item;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
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;
|
||||||
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagList;
|
|||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
@@ -59,12 +60,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, Iterables.toArray(pattern.getInputs(), ItemStack.class));
|
combineItems(tooltip, true, RSUtils.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, Iterables.toArray(pattern.getOutputs(), ItemStack.class));
|
combineItems(tooltip, true, RSUtils.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);
|
||||||
@@ -80,10 +81,10 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
|
|
||||||
NBTTagList outputsTag = stack.getTagCompound().getTagList("Outputs", Constants.NBT.TAG_COMPOUND);
|
NBTTagList outputsTag = stack.getTagCompound().getTagList("Outputs", Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
ItemStack[] outputs = new ItemStack[outputsTag.tagCount()];
|
NonNullList<ItemStack> outputs = NonNullList.create();
|
||||||
|
|
||||||
for (int i = 0; i < outputsTag.tagCount(); ++i) {
|
for (int i = 0; i < outputsTag.tagCount(); ++i) {
|
||||||
outputs[i] = ItemStack.loadItemStackFromNBT(outputsTag.getCompoundTagAt(i));
|
outputs.add(new ItemStack(outputsTag.getCompoundTagAt(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
combineItems(tooltip, true, outputs);
|
combineItems(tooltip, true, outputs);
|
||||||
@@ -110,7 +111,7 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.loadItemStackFromNBT(pattern.getTagCompound().getCompoundTag(id));
|
return new ItemStack(pattern.getTagCompound().getCompoundTag(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addOutput(ItemStack pattern, ItemStack output) {
|
public static void addOutput(ItemStack pattern, ItemStack output) {
|
||||||
@@ -140,7 +141,7 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
NBTTagList outputsTag = pattern.getTagCompound().getTagList(NBT_OUTPUTS, Constants.NBT.TAG_COMPOUND);
|
NBTTagList outputsTag = pattern.getTagCompound().getTagList(NBT_OUTPUTS, Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
for (int i = 0; i < outputsTag.tagCount(); ++i) {
|
for (int i = 0; i < outputsTag.tagCount(); ++i) {
|
||||||
ItemStack stack = ItemStack.loadItemStackFromNBT(outputsTag.getCompoundTagAt(i));
|
ItemStack stack = new ItemStack(outputsTag.getCompoundTagAt(i));
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
outputs.add(stack);
|
outputs.add(stack);
|
||||||
@@ -166,18 +167,20 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
pattern.getTagCompound().setBoolean(NBT_OREDICT, oredict);
|
pattern.getTagCompound().setBoolean(NBT_OREDICT, oredict);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void combineItems(List<String> tooltip, boolean displayAmount, ItemStack... stacks) {
|
public static void combineItems(List<String> tooltip, boolean displayAmount, NonNullList<ItemStack> stacks) {
|
||||||
Set<Integer> combinedIndices = new HashSet<>();
|
Set<Integer> combinedIndices = new HashSet<>();
|
||||||
|
|
||||||
for (int i = 0; i < stacks.length; ++i) {
|
for (int i = 0; i < stacks.size(); ++i) {
|
||||||
if (stacks[i] != null && !combinedIndices.contains(i)) {
|
if (!stacks.get(i).isEmpty() && !combinedIndices.contains(i)) {
|
||||||
String data = stacks[i].getDisplayName();
|
ItemStack stack = stacks.get(i);
|
||||||
|
|
||||||
int amount = stacks[i].stackSize;
|
String data = stack.getDisplayName();
|
||||||
|
|
||||||
for (int j = i + 1; j < stacks.length; ++j) {
|
int amount = stack.getCount();
|
||||||
if (API.instance().getComparer().isEqual(stacks[i], stacks[j])) {
|
|
||||||
amount += stacks[j].stackSize;
|
for (int j = i + 1; j < stacks.size(); ++j) {
|
||||||
|
if (API.instance().getComparer().isEqual(stack, stacks.get(j))) {
|
||||||
|
amount += stacks.get(j).getCount();
|
||||||
|
|
||||||
combinedIndices.add(j);
|
combinedIndices.add(j);
|
||||||
}
|
}
|
||||||
@@ -191,12 +194,12 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
if (!world.isRemote && player.isSneaking()) {
|
if (!world.isRemote && player.isSneaking()) {
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.PATTERN, stack.stackSize));
|
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.PATTERN, player.getHeldItem(hand).getCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ActionResult<>(EnumActionResult.PASS, stack);
|
return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.raoulvdberge.refinedstorage.item;
|
|||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemProcessor extends ItemBase {
|
public class ItemProcessor extends ItemBase {
|
||||||
public static final int TYPE_PRINTED_BASIC = 0;
|
public static final int TYPE_PRINTED_BASIC = 0;
|
||||||
@@ -23,7 +22,7 @@ public class ItemProcessor extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i <= 6; ++i) {
|
for (int i = 0; i <= 6; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class ItemStorageDisk extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
list.add(ItemStorageNBT.createStackWithNBT(new ItemStack(item, 1, i)));
|
list.add(ItemStorageNBT.createStackWithNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ public class ItemStorageDisk extends ItemBase {
|
|||||||
Item item = it.next();
|
Item item = it.next();
|
||||||
|
|
||||||
if (item != RSItems.STORAGE_DISK) {
|
if (item != RSItems.STORAGE_DISK) {
|
||||||
List<ItemStack> stacks = new ArrayList<>();
|
NonNullList<ItemStack> stacks = NonNullList.create();
|
||||||
|
|
||||||
item.getSubItems(item, CreativeTabs.INVENTORY, stacks);
|
item.getSubItems(item, CreativeTabs.INVENTORY, stacks);
|
||||||
|
|
||||||
@@ -105,7 +105,9 @@ public class ItemStorageDisk extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack disk, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack disk = player.getHeldItem(hand);
|
||||||
|
|
||||||
if (!world.isRemote && player.isSneaking() && ItemStorageNBT.isValid(disk) && ItemStorageNBT.getStoredFromNBT(disk.getTagCompound()) <= 0 && disk.getMetadata() != TYPE_CREATIVE) {
|
if (!world.isRemote && player.isSneaking() && ItemStorageNBT.isValid(disk) && ItemStorageNBT.getStoredFromNBT(disk.getTagCompound()) <= 0 && disk.getMetadata() != TYPE_CREATIVE) {
|
||||||
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, disk.getMetadata());
|
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, disk.getMetadata());
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package com.raoulvdberge.refinedstorage.item;
|
|||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemStoragePart extends ItemBase {
|
public class ItemStoragePart extends ItemBase {
|
||||||
public static final int TYPE_1K = 0;
|
public static final int TYPE_1K = 0;
|
||||||
@@ -20,7 +19,7 @@ public class ItemStoragePart extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i <= 3; ++i) {
|
for (int i = 0; i <= 3; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.minecraft.init.Items;
|
|||||||
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;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public class ItemUpgrade extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
for (int i = 0; i <= 6; ++i) {
|
for (int i = 0; i <= 6; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,11 +66,13 @@ public class ItemWrench extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
if (world.isRemote || !player.isSneaking()) {
|
if (world.isRemote || !player.isSneaking()) {
|
||||||
return EnumActionResult.PASS;
|
return EnumActionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
|
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
|
||||||
|
|
||||||
if (mode == WrenchMode.ROTATION) {
|
if (mode == WrenchMode.ROTATION) {
|
||||||
@@ -119,8 +121,10 @@ public class ItemWrench extends ItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
if (!world.isRemote && !player.isSneaking()) {
|
if (!world.isRemote && !player.isSneaking()) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
|
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
|
||||||
|
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
@@ -135,7 +139,7 @@ public class ItemWrench extends ItemBase {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class MessageGridCraftingClear extends MessageHandlerPlayerToServer<Messa
|
|||||||
ItemStack slot = grid.getMatrix().getStackInSlot(i);
|
ItemStack slot = grid.getMatrix().getStackInSlot(i);
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
grid.getMatrix().setInventorySlotContents(i, grid.getNetwork().insertItem(slot, slot.stackSize, false));
|
grid.getMatrix().setInventorySlotContents(i, grid.getNetwork().insertItem(slot, slot.getCount(), false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (grid.getType() == EnumGridType.PATTERN) {
|
} else if (grid.getType() == EnumGridType.PATTERN) {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class MessageGridCraftingTransfer extends MessageHandlerPlayerToServer<Me
|
|||||||
actualRecipe[x] = new ItemStack[list.tagCount()];
|
actualRecipe[x] = new ItemStack[list.tagCount()];
|
||||||
|
|
||||||
for (int y = 0; y < list.tagCount(); y++) {
|
for (int y = 0; y < list.tagCount(); y++) {
|
||||||
actualRecipe[x][y] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(y));
|
actualRecipe[x][y] = new ItemStack(list.getCompoundTagAt(y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ public class MessageGridItemDelta implements IMessage, IMessageHandler<MessageGr
|
|||||||
public void fromBytes(ByteBuf buf) {
|
public void fromBytes(ByteBuf buf) {
|
||||||
clientStack = new ClientStackItem(buf);
|
clientStack = new ClientStackItem(buf);
|
||||||
delta = buf.readInt();
|
delta = buf.readInt();
|
||||||
clientStack.getStack().stackSize = delta;
|
|
||||||
|
clientStack.getStack().setCount(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,10 +47,10 @@ public class MessageGridItemDelta implements IMessage, IMessageHandler<MessageGr
|
|||||||
|
|
||||||
for (ClientStackItem stack : GuiGrid.ITEMS.get(item)) {
|
for (ClientStackItem stack : GuiGrid.ITEMS.get(item)) {
|
||||||
if (stack.equals(message.clientStack)) {
|
if (stack.equals(message.clientStack)) {
|
||||||
if (stack.getStack().stackSize + message.delta == 0 && !message.clientStack.isCraftable()) {
|
if (stack.getStack().getCount() + message.delta == 0 && !message.clientStack.isCraftable()) {
|
||||||
GuiGrid.ITEMS.remove(item, stack);
|
GuiGrid.ITEMS.remove(item, stack);
|
||||||
} else {
|
} else {
|
||||||
stack.getStack().stackSize += message.delta;
|
stack.getStack().grow(message.delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiGrid.markForSorting();
|
GuiGrid.markForSorting();
|
||||||
|
|||||||
@@ -12,13 +12,9 @@ import com.raoulvdberge.refinedstorage.render.BakedModelPattern;
|
|||||||
import com.raoulvdberge.refinedstorage.render.ModelDiskDrive;
|
import com.raoulvdberge.refinedstorage.render.ModelDiskDrive;
|
||||||
import com.raoulvdberge.refinedstorage.render.ModelDiskManipulator;
|
import com.raoulvdberge.refinedstorage.render.ModelDiskManipulator;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileController;
|
import com.raoulvdberge.refinedstorage.tile.TileController;
|
||||||
import mcmultipart.client.multipart.ModelMultipartContainer;
|
|
||||||
import mcmultipart.raytrace.PartMOP;
|
|
||||||
import mcmultipart.raytrace.RayTraceUtils;
|
|
||||||
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.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.VertexBuffer;
|
import net.minecraft.client.renderer.VertexBuffer;
|
||||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||||
@@ -45,9 +41,6 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ProxyClient extends ProxyCommon {
|
public class ProxyClient extends ProxyCommon {
|
||||||
@Override
|
@Override
|
||||||
@@ -273,12 +266,6 @@ public class ProxyClient extends ProxyCommon {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onModelBake(ModelBakeEvent e) {
|
public void onModelBake(ModelBakeEvent e) {
|
||||||
for (ModelResourceLocation model : e.getModelRegistry().getKeys()) {
|
for (ModelResourceLocation model : e.getModelRegistry().getKeys()) {
|
||||||
for (BlockCable cable : cableTypes) {
|
|
||||||
if (model.getResourceDomain().equals(RS.ID) && model.getResourcePath().equals(cable.getName()) && !model.getVariant().equals("inventory")) {
|
|
||||||
e.getModelRegistry().putObject(model, ModelMultipartContainer.fromBlock(e.getModelRegistry().getObject(model), cable));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.getResourceDomain().equals(RS.ID) && model.getResourcePath().equals("pattern")) {
|
if (model.getResourceDomain().equals(RS.ID) && model.getResourcePath().equals("pattern")) {
|
||||||
e.getModelRegistry().putObject(model, new BakedModelPattern(e.getModelRegistry().getObject(model)));
|
e.getModelRegistry().putObject(model, new BakedModelPattern(e.getModelRegistry().getObject(model)));
|
||||||
}
|
}
|
||||||
@@ -303,11 +290,13 @@ public class ProxyClient extends ProxyCommon {
|
|||||||
|
|
||||||
state = ((BlockCable) state.getBlock()).getActualState(state, player.getEntityWorld(), pos);
|
state = ((BlockCable) state.getBlock()).getActualState(state, player.getEntityWorld(), pos);
|
||||||
|
|
||||||
if (((BlockCable) state.getBlock()).collisionRayTrace(state, player.getEntityWorld(), pos, RayTraceUtils.getStart(player), RayTraceUtils.getEnd(player)) instanceof PartMOP) {
|
// @TODO
|
||||||
|
/*if (((BlockCable) state.getBlock()).collisionRayTrace(state, player.getEntityWorld(), pos, RayTraceUtils.getStart(player), RayTraceUtils.getEnd(player)) instanceof PartMOP) {
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
|
return;
|
||||||
|
|
||||||
List<AxisAlignedBB> unionized = ((BlockCable) state.getBlock()).getUnionizedCollisionBoxes(state);
|
/*List<AxisAlignedBB> unionized = ((BlockCable) state.getBlock()).getUnionizedCollisionBoxes(state);
|
||||||
List<AxisAlignedBB> nonUnionized = ((BlockCable) state.getBlock()).getNonUnionizedCollisionBoxes(state);
|
List<AxisAlignedBB> nonUnionized = ((BlockCable) state.getBlock()).getNonUnionizedCollisionBoxes(state);
|
||||||
|
|
||||||
e.setCanceled(true);
|
e.setCanceled(true);
|
||||||
@@ -337,7 +326,7 @@ public class ProxyClient extends ProxyCommon {
|
|||||||
|
|
||||||
GlStateManager.depthMask(true);
|
GlStateManager.depthMask(true);
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBoundingBox(AxisAlignedBB aabb) {
|
private void drawSelectionBoundingBox(AxisAlignedBB aabb) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.raoulvdberge.refinedstorage.tile;
|
|||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
|
|
||||||
public class TileCable extends TileMultipartNode {
|
public class TileCable extends TileNode {
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
return RS.INSTANCE.config.cableUsage;
|
return RS.INSTANCE.config.cableUsage;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import com.raoulvdberge.refinedstorage.tile.config.IType;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataConsumer;
|
import com.raoulvdberge.refinedstorage.tile.data.ITileDataConsumer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import mcmultipart.microblock.IMicroblock;
|
|
||||||
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;
|
||||||
@@ -44,7 +43,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
public class TileConstructor extends TileMultipartNode implements IComparable, IType {
|
public class TileConstructor extends TileNode implements IComparable, IType {
|
||||||
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
||||||
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
|
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
|
||||||
public static final TileDataParameter<Boolean> DROP = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileConstructor>() {
|
public static final TileDataParameter<Boolean> DROP = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileConstructor>() {
|
||||||
@@ -94,11 +93,6 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
|
|||||||
dataManager.addWatchedParameter(DROP);
|
dataManager.addWatchedParameter(DROP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAddMicroblock(IMicroblock microblock) {
|
|
||||||
return !isBlockingMicroblock(microblock, getDirection());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
return RS.INSTANCE.config.constructorUsage + upgrades.getEnergyUsage();
|
return RS.INSTANCE.config.constructorUsage + upgrades.getEnergyUsage();
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ import com.raoulvdberge.refinedstorage.container.ContainerCraftingMonitor;
|
|||||||
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
||||||
import com.raoulvdberge.refinedstorage.container.ContainerReaderWriter;
|
import com.raoulvdberge.refinedstorage.container.ContainerReaderWriter;
|
||||||
import com.raoulvdberge.refinedstorage.integration.forgeenergy.ControllerEnergyForge;
|
import com.raoulvdberge.refinedstorage.integration.forgeenergy.ControllerEnergyForge;
|
||||||
import com.raoulvdberge.refinedstorage.integration.ic2.ControllerEnergyIC2;
|
|
||||||
import com.raoulvdberge.refinedstorage.integration.ic2.ControllerEnergyIC2None;
|
|
||||||
import com.raoulvdberge.refinedstorage.integration.ic2.IControllerEnergyIC2;
|
|
||||||
import com.raoulvdberge.refinedstorage.integration.ic2.IntegrationIC2;
|
|
||||||
import com.raoulvdberge.refinedstorage.integration.tesla.ControllerEnergyTesla;
|
import com.raoulvdberge.refinedstorage.integration.tesla.ControllerEnergyTesla;
|
||||||
import com.raoulvdberge.refinedstorage.integration.tesla.IntegrationTesla;
|
import com.raoulvdberge.refinedstorage.integration.tesla.IntegrationTesla;
|
||||||
import com.raoulvdberge.refinedstorage.network.*;
|
import com.raoulvdberge.refinedstorage.network.*;
|
||||||
@@ -182,7 +178,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
|
|
||||||
private EnergyStorage energy = new EnergyStorage(RS.INSTANCE.config.controllerCapacity);
|
private EnergyStorage energy = new EnergyStorage(RS.INSTANCE.config.controllerCapacity);
|
||||||
private ControllerEnergyForge energyForge = new ControllerEnergyForge(this);
|
private ControllerEnergyForge energyForge = new ControllerEnergyForge(this);
|
||||||
private IControllerEnergyIC2 energyEU;
|
|
||||||
private ControllerEnergyTesla energyTesla;
|
private ControllerEnergyTesla energyTesla;
|
||||||
|
|
||||||
private int lastEnergyDisplay;
|
private int lastEnergyDisplay;
|
||||||
@@ -202,12 +197,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
dataManager.addParameter(ENERGY_CAPACITY);
|
dataManager.addParameter(ENERGY_CAPACITY);
|
||||||
dataManager.addParameter(NODES);
|
dataManager.addParameter(NODES);
|
||||||
|
|
||||||
if (IntegrationIC2.isLoaded()) {
|
|
||||||
this.energyEU = new ControllerEnergyIC2(this);
|
|
||||||
} else {
|
|
||||||
this.energyEU = new ControllerEnergyIC2None();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IntegrationTesla.isLoaded()) {
|
if (IntegrationTesla.isLoaded()) {
|
||||||
this.energyTesla = new ControllerEnergyTesla(energy);
|
this.energyTesla = new ControllerEnergyTesla(energy);
|
||||||
}
|
}
|
||||||
@@ -236,8 +225,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!getWorld().isRemote) {
|
if (!getWorld().isRemote) {
|
||||||
energyEU.update();
|
|
||||||
|
|
||||||
if (!craftingTasksToRead.isEmpty()) {
|
if (!craftingTasksToRead.isEmpty()) {
|
||||||
for (NBTTagCompound tag : craftingTasksToRead) {
|
for (NBTTagCompound tag : craftingTasksToRead) {
|
||||||
ICraftingTask task = readCraftingTask(getWorld(), this, tag);
|
ICraftingTask task = readCraftingTask(getWorld(), this, tag);
|
||||||
@@ -332,13 +319,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
super.update();
|
super.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
super.invalidate();
|
|
||||||
|
|
||||||
energyEU.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemGridHandler getItemGridHandler() {
|
public IItemGridHandler getItemGridHandler() {
|
||||||
return itemGridHandler;
|
return itemGridHandler;
|
||||||
@@ -354,13 +334,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
return networkItemHandler;
|
return networkItemHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkUnload() {
|
|
||||||
super.onChunkUnload();
|
|
||||||
|
|
||||||
energyEU.onChunkUnload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDestroyed() {
|
public void onDestroyed() {
|
||||||
nodeGraph.disconnectAll();
|
nodeGraph.disconnectAll();
|
||||||
}
|
}
|
||||||
@@ -435,7 +408,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
if (input != null) {
|
if (input != null) {
|
||||||
ItemStack stored = itemList.get(input, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT | (patterns.get(i).isOredict() ? IComparer.COMPARE_OREDICT : 0));
|
ItemStack stored = itemList.get(input, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT | (patterns.get(i).isOredict() ? IComparer.COMPARE_OREDICT : 0));
|
||||||
|
|
||||||
score += stored != null ? stored.stackSize : 0;
|
score += stored != null ? stored.getCount() : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +426,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
for (ICraftingTask task : getCraftingTasks()) {
|
for (ICraftingTask task : getCraftingTasks()) {
|
||||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||||
if (API.instance().getComparer().isEqual(output, stack, compare)) {
|
if (API.instance().getComparer().isEqual(output, stack, compare)) {
|
||||||
toSchedule -= output.stackSize * task.getQuantity();
|
toSchedule -= output.getCount() * task.getQuantity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -622,11 +595,11 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
|
|
||||||
// if this storage is in insert-only mode, we can disregard this item from the cache
|
// if this storage is in insert-only mode, we can disregard this item from the cache
|
||||||
if (storage.getAccessType() == AccessType.INSERT && !simulate) {
|
if (storage.getAccessType() == AccessType.INSERT && !simulate) {
|
||||||
insertOnlyInserted += size - (remainder != null ? remainder.stackSize : 0);
|
insertOnlyInserted += size - (remainder != null ? remainder.getCount() : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remainder == null || remainder.stackSize <= 0) {
|
if (remainder == null || remainder.getCount() <= 0) {
|
||||||
if (storage instanceof ItemStorageExternal && !simulate) {
|
if (storage instanceof ItemStorageExternal && !simulate) {
|
||||||
((ItemStorageExternal) storage).detectChanges(this);
|
((ItemStorageExternal) storage).detectChanges(this);
|
||||||
// the external storage will send the change, we don't need to anymore
|
// the external storage will send the change, we don't need to anymore
|
||||||
@@ -635,26 +608,26 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (size != remainder.stackSize && storage instanceof ItemStorageExternal && !simulate) {
|
if (size != remainder.getCount() && storage instanceof ItemStorageExternal && !simulate) {
|
||||||
((ItemStorageExternal) storage).detectChanges(this);
|
((ItemStorageExternal) storage).detectChanges(this);
|
||||||
// the external storage will send the change, we don't need to anymore
|
// the external storage will send the change, we don't need to anymore
|
||||||
externalStorageInserted += size - remainder.stackSize;
|
externalStorageInserted += size - remainder.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
size = remainder.stackSize;
|
size = remainder.getCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the stack size of the remainder is negative, it means of the original size abs(remainder.stackSize) items have been voided
|
// If the stack size of the remainder is negative, it means of the original size abs(remainder.getCount()) items have been voided
|
||||||
int inserted;
|
int inserted;
|
||||||
|
|
||||||
if (remainder == null) {
|
if (remainder == null) {
|
||||||
inserted = orginalSize;
|
inserted = orginalSize;
|
||||||
} else if (remainder.stackSize < 0) {
|
} else if (remainder.getCount() < 0) {
|
||||||
inserted = orginalSize + remainder.stackSize;
|
inserted = orginalSize + remainder.getCount();
|
||||||
remainder = null;
|
remainder = null;
|
||||||
} else {
|
} else {
|
||||||
inserted = orginalSize - remainder.stackSize;
|
inserted = orginalSize - remainder.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
@@ -696,16 +669,16 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
if (storage instanceof ItemStorageExternal && !simulate) {
|
if (storage instanceof ItemStorageExternal && !simulate) {
|
||||||
((ItemStorageExternal) storage).detectChanges(this);
|
((ItemStorageExternal) storage).detectChanges(this);
|
||||||
// the external storage will send the change, we don't need to anymore
|
// the external storage will send the change, we don't need to anymore
|
||||||
externalStorageExtracted += took.stackSize;
|
externalStorageExtracted += took.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newStack == null) {
|
if (newStack == null) {
|
||||||
newStack = took;
|
newStack = took;
|
||||||
} else {
|
} else {
|
||||||
newStack.stackSize += took.stackSize;
|
newStack.grow(took.getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
received += took.stackSize;
|
received += took.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requested == received) {
|
if (requested == received) {
|
||||||
@@ -713,8 +686,8 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newStack != null && newStack.stackSize - externalStorageExtracted > 0 && !simulate) {
|
if (newStack != null && newStack.getCount() - externalStorageExtracted > 0 && !simulate) {
|
||||||
itemStorage.remove(newStack, newStack.stackSize - externalStorageExtracted);
|
itemStorage.remove(newStack, newStack.getCount() - externalStorageExtracted);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newStack;
|
return newStack;
|
||||||
@@ -814,9 +787,9 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static ICraftingTask readCraftingTask(World world, INetworkMaster network, NBTTagCompound tag) {
|
private static ICraftingTask readCraftingTask(World world, INetworkMaster network, NBTTagCompound tag) {
|
||||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(ICraftingTask.NBT_PATTERN_STACK));
|
ItemStack stack = new ItemStack(tag.getCompoundTag(ICraftingTask.NBT_PATTERN_STACK));
|
||||||
|
|
||||||
if (stack != null && stack.getItem() instanceof ICraftingPatternProvider) {
|
if (!stack.isEmpty() && stack.getItem() instanceof ICraftingPatternProvider) {
|
||||||
TileEntity container = world.getTileEntity(BlockPos.fromLong(tag.getLong(ICraftingTask.NBT_PATTERN_CONTAINER)));
|
TileEntity container = world.getTileEntity(BlockPos.fromLong(tag.getLong(ICraftingTask.NBT_PATTERN_CONTAINER)));
|
||||||
|
|
||||||
if (container instanceof ICraftingPatternContainer) {
|
if (container instanceof ICraftingPatternContainer) {
|
||||||
@@ -825,7 +798,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
ICraftingTaskFactory factory = API.instance().getCraftingTaskRegistry().getFactory(tag.getString(ICraftingTask.NBT_PATTERN_ID));
|
ICraftingTaskFactory factory = API.instance().getCraftingTaskRegistry().getFactory(tag.getString(ICraftingTask.NBT_PATTERN_ID));
|
||||||
|
|
||||||
if (factory != null) {
|
if (factory != null) {
|
||||||
return factory.create(world, network, tag.hasKey(ICraftingTask.NBT_REQUESTED) ? ItemStack.loadItemStackFromNBT(tag.getCompoundTag(ICraftingTask.NBT_REQUESTED)) : null, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), tag);
|
return factory.create(world, network, tag.hasKey(ICraftingTask.NBT_REQUESTED) ? new ItemStack(tag.getCompoundTag(ICraftingTask.NBT_REQUESTED)) : null, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.raoulvdberge.refinedstorage.tile.config.IType;
|
|||||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataConsumer;
|
import com.raoulvdberge.refinedstorage.tile.data.ITileDataConsumer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import mcmultipart.microblock.IMicroblock;
|
|
||||||
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;
|
||||||
@@ -45,7 +44,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TileDestructor extends TileMultipartNode implements IComparable, IFilterable, IType {
|
public class TileDestructor extends TileNode implements IComparable, IFilterable, IType {
|
||||||
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
||||||
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
|
public static final TileDataParameter<Integer> MODE = IFilterable.createParameter();
|
||||||
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
|
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
|
||||||
@@ -87,11 +86,6 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
dataManager.addWatchedParameter(PICKUP);
|
dataManager.addWatchedParameter(PICKUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAddMicroblock(IMicroblock microblock) {
|
|
||||||
return !isBlockingMicroblock(microblock, getDirection());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
return RS.INSTANCE.config.destructorUsage + upgrades.getEnergyUsage();
|
return RS.INSTANCE.config.destructorUsage + upgrades.getEnergyUsage();
|
||||||
@@ -113,8 +107,8 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
if (entity instanceof EntityItem) {
|
if (entity instanceof EntityItem) {
|
||||||
ItemStack droppedItem = ((EntityItem) entity).getEntityItem();
|
ItemStack droppedItem = ((EntityItem) entity).getEntityItem();
|
||||||
|
|
||||||
if (IFilterable.canTake(itemFilters, mode, compare, droppedItem) && network.insertItem(droppedItem, droppedItem.stackSize, true) == null) {
|
if (IFilterable.canTake(itemFilters, mode, compare, droppedItem) && network.insertItem(droppedItem, droppedItem.getCount(), true) == null) {
|
||||||
network.insertItem(droppedItem.copy(), droppedItem.stackSize, false);
|
network.insertItem(droppedItem.copy(), droppedItem.getCount(), false);
|
||||||
|
|
||||||
getWorld().removeEntity(entity);
|
getWorld().removeEntity(entity);
|
||||||
|
|
||||||
@@ -139,7 +133,7 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack drop : drops) {
|
for (ItemStack drop : drops) {
|
||||||
if (network.insertItem(drop, drop.stackSize, true) != null) {
|
if (network.insertItem(drop, drop.getCount(), true) != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,7 +150,7 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
|
|||||||
if (network == null) {
|
if (network == null) {
|
||||||
InventoryHelper.spawnItemStack(getWorld(), front.getX(), front.getY(), front.getZ(), drop);
|
InventoryHelper.spawnItemStack(getWorld(), front.getX(), front.getY(), front.getZ(), drop);
|
||||||
} else {
|
} else {
|
||||||
network.insertItem(drop, drop.stackSize, false);
|
network.insertItem(drop, drop.getCount(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ public class TileDetector extends TileNode implements IComparable, IType {
|
|||||||
} else {
|
} else {
|
||||||
ItemStack stack = network.getItemStorageCache().getList().get(slot, compare);
|
ItemStack stack = network.getItemStorageCache().getList().get(slot, compare);
|
||||||
|
|
||||||
powered = isPowered(stack == null ? null : stack.stackSize);
|
powered = isPowered(stack == null ? null : stack.getCount());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
powered = mode == MODE_AUTOCRAFTING ? !network.getCraftingTasks().isEmpty() : isPowered(network.getItemStorageCache().getList().getStacks().stream().map(s -> s.stackSize).mapToInt(Number::intValue).sum());
|
powered = mode == MODE_AUTOCRAFTING ? !network.getCraftingTasks().isEmpty() : isPowered(network.getItemStorageCache().getList().getStacks().stream().map(s -> s.getCount()).mapToInt(Number::intValue).sum());
|
||||||
}
|
}
|
||||||
} else if (type == IType.FLUIDS) {
|
} else if (type == IType.FLUIDS) {
|
||||||
FluidStack slot = fluidFilters.getFluidStackInSlot(0);
|
FluidStack slot = fluidFilters.getFluidStackInSlot(0);
|
||||||
@@ -156,7 +156,7 @@ public class TileDetector extends TileNode implements IComparable, IType {
|
|||||||
if (powered != wasPowered) {
|
if (powered != wasPowered) {
|
||||||
wasPowered = powered;
|
wasPowered = powered;
|
||||||
|
|
||||||
getWorld().notifyNeighborsOfStateChange(pos, RSBlocks.DETECTOR);
|
getWorld().notifyNeighborsOfStateChange(pos, RSBlocks.DETECTOR, true);
|
||||||
|
|
||||||
updateBlock();
|
updateBlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
|
|||||||
|
|
||||||
if (voidExcess && result != null) {
|
if (voidExcess && result != null) {
|
||||||
// Simulate should not matter as the items are voided anyway
|
// Simulate should not matter as the items are voided anyway
|
||||||
result.stackSize = -result.stackSize;
|
result.setCount(-result.getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -277,18 +277,18 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack extracted = storage.extractItem(stack, upgrades.getInteractStackSize(), compare, false);
|
ItemStack extracted = storage.extractItem(stack, upgrades.getItemInteractCount(), compare, false);
|
||||||
if (extracted == null) {
|
if (extracted == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack remainder = network.insertItem(extracted, extracted.stackSize, false);
|
ItemStack remainder = network.insertItem(extracted, extracted.getCount(), false);
|
||||||
if (remainder == null) {
|
if (remainder == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to check if the stack was inserted
|
// We need to check if the stack was inserted
|
||||||
storage.insertItem(((extracted == remainder) ? remainder.copy() : remainder), remainder.stackSize, false);
|
storage.insertItem(((extracted == remainder) ? remainder.copy() : remainder), remainder.getCount(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storage.getStacks().size() == 0) {
|
if (storage.getStacks().size() == 0) {
|
||||||
@@ -311,12 +311,12 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
while ((toExtract == null || toExtract.stackSize == 0) && j < networkItems.size()) {
|
while ((toExtract == null || toExtract.getCount() == 0) && j < networkItems.size()) {
|
||||||
toExtract = networkItems.get(j++);
|
toExtract = networkItems.get(j++);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toExtract != null) {
|
if (toExtract != null) {
|
||||||
extracted = network.extractItem(toExtract, upgrades.getInteractStackSize(), compare, false);
|
extracted = network.extractItem(toExtract, upgrades.getItemInteractCount(), compare, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (itemFilters.getSlots() > i && extracted == null) {
|
while (itemFilters.getSlots() > i && extracted == null) {
|
||||||
@@ -327,7 +327,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = network.extractItem(stack, upgrades.getInteractStackSize(), compare, false);
|
extracted = network.extractItem(stack, upgrades.getItemInteractCount(), compare, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,10 +337,10 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack remainder = storage.insertItem(extracted, extracted.stackSize, false);
|
ItemStack remainder = storage.insertItem(extracted, extracted.getCount(), false);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
network.insertItem(remainder, remainder.stackSize, false);
|
network.insertItem(remainder, remainder.getCount(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = storage.extractFluid(stack, upgrades.getInteractStackSize(), compare, false);
|
extracted = storage.extractFluid(stack, upgrades.getItemInteractCount(), compare, false);
|
||||||
}
|
}
|
||||||
} while (extracted == null && storage.getStacks().size() > i);
|
} while (extracted == null && storage.getStacks().size() > i);
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toExtract != null) {
|
if (toExtract != null) {
|
||||||
extracted = network.extractFluid(toExtract, upgrades.getInteractStackSize(), compare, false);
|
extracted = network.extractFluid(toExtract, upgrades.getItemInteractCount(), compare, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (fluidFilters.getSlots() > i && extracted == null) {
|
while (fluidFilters.getSlots() > i && extracted == null) {
|
||||||
@@ -408,7 +408,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
extracted = network.extractFluid(stack, upgrades.getInteractStackSize(), compare, false);
|
extracted = network.extractFluid(stack, upgrades.getItemInteractCount(), compare, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
|||||||
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.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import mcmultipart.microblock.IMicroblock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -22,7 +21,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
|
|||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
public class TileExporter extends TileMultipartNode implements IComparable, IType {
|
public class TileExporter extends TileNode implements IComparable, IType {
|
||||||
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
public static final TileDataParameter<Integer> COMPARE = IComparable.createParameter();
|
||||||
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
|
public static final TileDataParameter<Integer> TYPE = IType.createParameter();
|
||||||
|
|
||||||
@@ -42,11 +41,6 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
|
|||||||
dataManager.addWatchedParameter(TYPE);
|
dataManager.addWatchedParameter(TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAddMicroblock(IMicroblock microblock) {
|
|
||||||
return !isBlockingMicroblock(microblock, getDirection());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
return RS.INSTANCE.config.exporterUsage + upgrades.getEnergyUsage();
|
return RS.INSTANCE.config.exporterUsage + upgrades.getEnergyUsage();
|
||||||
@@ -63,14 +57,14 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
|
|||||||
ItemStack slot = itemFilters.getStackInSlot(i);
|
ItemStack slot = itemFilters.getStackInSlot(i);
|
||||||
|
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
ItemStack took = network.extractItem(slot, upgrades.getInteractStackSize(), compare, true);
|
ItemStack took = network.extractItem(slot, upgrades.getItemInteractCount(), compare, true);
|
||||||
|
|
||||||
if (took == null) {
|
if (took == null) {
|
||||||
if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
||||||
network.scheduleCraftingTask(slot, 1, compare);
|
network.scheduleCraftingTask(slot, 1, compare);
|
||||||
}
|
}
|
||||||
} else if (ItemHandlerHelper.insertItem(handler, took, true) == null) {
|
} else if (ItemHandlerHelper.insertItem(handler, took, true) == null) {
|
||||||
took = network.extractItem(slot, upgrades.getInteractStackSize(), compare, false);
|
took = network.extractItem(slot, upgrades.getItemInteractCount(), compare, false);
|
||||||
|
|
||||||
ItemHandlerHelper.insertItem(handler, took, false);
|
ItemHandlerHelper.insertItem(handler, took, false);
|
||||||
}
|
}
|
||||||
@@ -86,7 +80,7 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
|
|||||||
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
|
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
|
||||||
|
|
||||||
if (stackInStorage != null) {
|
if (stackInStorage != null) {
|
||||||
int toExtract = Math.min(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), stackInStorage.amount);
|
int toExtract = Math.min(Fluid.BUCKET_VOLUME * upgrades.getItemInteractCount(), stackInStorage.amount);
|
||||||
|
|
||||||
FluidStack took = network.extractFluid(stack, toExtract, compare, true);
|
FluidStack took = network.extractFluid(stack, toExtract, compare, true);
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ticks % upgrades.getSpeed() == 0) {
|
if (ticks % upgrades.getSpeed() == 0) {
|
||||||
FluidStack drained = tankIn.drainInternal(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), true);
|
FluidStack drained = tankIn.drainInternal(Fluid.BUCKET_VOLUME * upgrades.getItemInteractCount(), true);
|
||||||
|
|
||||||
// Drain in tank
|
// Drain in tank
|
||||||
if (drained != null) {
|
if (drained != null) {
|
||||||
@@ -118,7 +118,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
|
|
||||||
// If our out fluid doesn't match the new fluid, empty it first
|
// If our out fluid doesn't match the new fluid, empty it first
|
||||||
if (tankOut.getFluid() != null && (stack == null || (tankOut.getFluid().getFluid() != stack.getFluid()))) {
|
if (tankOut.getFluid() != null && (stack == null || (tankOut.getFluid().getFluid() != stack.getFluid()))) {
|
||||||
FluidStack remainder = tankOut.drainInternal(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), true);
|
FluidStack remainder = tankOut.drainInternal(Fluid.BUCKET_VOLUME * upgrades.getItemInteractCount(), true);
|
||||||
|
|
||||||
if (remainder != null) {
|
if (remainder != null) {
|
||||||
network.insertFluid(remainder, remainder.amount, false);
|
network.insertFluid(remainder, remainder.amount, false);
|
||||||
@@ -128,7 +128,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
|
|||||||
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
|
FluidStack stackInStorage = network.getFluidStorageCache().getList().get(stack, compare);
|
||||||
|
|
||||||
if (stackInStorage != null) {
|
if (stackInStorage != null) {
|
||||||
int toExtract = Math.min(Fluid.BUCKET_VOLUME * upgrades.getInteractStackSize(), stackInStorage.amount);
|
int toExtract = Math.min(Fluid.BUCKET_VOLUME * upgrades.getItemInteractCount(), stackInStorage.amount);
|
||||||
|
|
||||||
FluidStack took = network.extractFluid(stack, toExtract, compare, true);
|
FluidStack took = network.extractFluid(stack, toExtract, compare, true);
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user