Cleanup
This commit is contained in:
@@ -189,10 +189,10 @@ public class CraftingManager implements ICraftingManager {
|
||||
}
|
||||
|
||||
runningSteps = craftingTasks.stream()
|
||||
.map(ICraftingTask::getSteps)
|
||||
.flatMap(List::stream)
|
||||
.filter(ICraftingStep::hasStartedProcessing)
|
||||
.collect(Collectors.toList());
|
||||
.map(ICraftingTask::getSteps)
|
||||
.flatMap(List::stream)
|
||||
.filter(ICraftingStep::hasStartedProcessing)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (craftingTasksChanged) {
|
||||
network.getNetwork().markCraftingMonitorForUpdate();
|
||||
|
||||
@@ -111,16 +111,16 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
oreInputs.add(Collections.singletonList(Comparer.stripTags(input)));
|
||||
} else if (isOredict()) {
|
||||
List<ItemStack> oredict = Arrays.stream(ids)
|
||||
.mapToObj(OreDictionary::getOreName)
|
||||
.map(OreDictionary::getOres)
|
||||
.flatMap(List::stream)
|
||||
.map(ItemStack::copy)
|
||||
.map(Comparer::stripTags)
|
||||
.map(s -> {
|
||||
s.setCount(input.getCount());
|
||||
return s;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.mapToObj(OreDictionary::getOreName)
|
||||
.map(OreDictionary::getOres)
|
||||
.flatMap(List::stream)
|
||||
.map(ItemStack::copy)
|
||||
.map(Comparer::stripTags)
|
||||
.map(s -> {
|
||||
s.setCount(input.getCount());
|
||||
return s;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// Add original stack as first, should prevent some issues
|
||||
oredict.add(0, Comparer.stripTags(input.copy()));
|
||||
oreInputs.add(oredict);
|
||||
@@ -286,13 +286,13 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
}
|
||||
|
||||
if (other.getId().equals(this.getId())
|
||||
&& other.isOredict() == this.isOredict()
|
||||
&& other.isBlocking() == this.isBlocking()
|
||||
&& other.isProcessing() == this.isProcessing()
|
||||
&& other.getOreInputs().size() == this.getOreInputs().size()
|
||||
&& other.getOutputs().size() == this.getOutputs().size()) {
|
||||
&& other.isOredict() == this.isOredict()
|
||||
&& other.isBlocking() == this.isBlocking()
|
||||
&& other.isProcessing() == this.isProcessing()
|
||||
&& other.getOreInputs().size() == this.getOreInputs().size()
|
||||
&& other.getOutputs().size() == this.getOutputs().size()) {
|
||||
boolean same = true;
|
||||
for (int i = 0; i < other.getOreInputs().size(); i++) {
|
||||
for (int i = 0; i < other.getOreInputs().size(); i++) {
|
||||
same &= other.getOreInputs().get(i).size() == this.getOreInputs().get(i).size();
|
||||
}
|
||||
int j = 0;
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingStep;
|
||||
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
|
||||
@@ -166,6 +166,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNeighborhoodA
|
||||
return holder.world().getTileEntity(holder.pos().offset(holder.getDirection()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IItemHandler getDrops() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -162,15 +162,15 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
||||
|
||||
if (item.getItem() instanceof ItemBlock) {
|
||||
((ItemBlock) item.getItem()).placeBlockAt(
|
||||
took,
|
||||
FakePlayerFactory.getMinecraft((WorldServer) holder.world()),
|
||||
holder.world(),
|
||||
front,
|
||||
holder.getDirection(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
state
|
||||
took,
|
||||
FakePlayerFactory.getMinecraft((WorldServer) holder.world()),
|
||||
holder.world(),
|
||||
front,
|
||||
holder.getDirection(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
state
|
||||
);
|
||||
} else {
|
||||
holder.world().setBlockState(front, state, 1 | 2);
|
||||
|
||||
@@ -112,8 +112,8 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
||||
|
||||
if (!state) {
|
||||
network.getCraftingManager().getTasks().stream()
|
||||
.filter(task -> task.getPattern().getContainer().getPosition().equals(holder.pos()))
|
||||
.forEach(task -> network.getCraftingManager().cancel(task));
|
||||
.filter(task -> task.getPattern().getContainer().getPosition().equals(holder.pos()))
|
||||
.forEach(task -> network.getCraftingManager().cancel(task));
|
||||
}
|
||||
|
||||
network.getCraftingManager().rebuild();
|
||||
|
||||
@@ -52,7 +52,7 @@ public class NetworkNodeImporter extends NetworkNode implements IComparable, IFi
|
||||
if (network == null || !canUpdate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (type == IType.ITEMS) {
|
||||
IImportingBehavior behavior = ImportingBehaviorItemHandler.INSTANCE;
|
||||
if (IntegrationCyclopsCore.isLoaded() && SlotlessItemHandlerHelper.isSlotless(getFacingTile(), holder.getDirection().getOpposite())) {
|
||||
|
||||
@@ -86,8 +86,8 @@ public class NetworkNodeNetworkTransmitter extends NetworkNode {
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return Math.min(
|
||||
RS.INSTANCE.config.interdimensionalUpgradeUsage,
|
||||
RS.INSTANCE.config.networkTransmitterUsage + (isSameDimension() ? (int) Math.ceil(RS.INSTANCE.config.networkTransmitterPerBlockUsage * getDistance()) : 0) + upgrades.getEnergyUsage()
|
||||
RS.INSTANCE.config.interdimensionalUpgradeUsage,
|
||||
RS.INSTANCE.config.networkTransmitterUsage + (isSameDimension() ? (int) Math.ceil(RS.INSTANCE.config.networkTransmitterPerBlockUsage * getDistance()) : 0) + upgrades.getEnergyUsage()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class StorageItemCyclops extends StorageItemExternal {
|
||||
|
||||
@Override
|
||||
public int getStored() {
|
||||
return getStacks(cyclopsInv.get()).stream().mapToInt(s -> s.getCount()).sum();
|
||||
return getStacks(cyclopsInv.get()).stream().mapToInt(ItemStack::getCount).sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@ public class StackListFluid implements IStackList<FluidStack> {
|
||||
private List<FluidStack> removeTracker = new LinkedList<>();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public void add(@Nonnull FluidStack stack, int size) {
|
||||
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
||||
if (stack.isFluidEqual(otherStack)) {
|
||||
@@ -32,7 +31,6 @@ public class StackListFluid implements IStackList<FluidStack> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public boolean remove(@Nonnull FluidStack stack, int size) {
|
||||
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
||||
if (stack.isFluidEqual(otherStack)) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeDestructor;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterType;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeFluidInterface;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilterFluid;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileFluidInterface;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
}
|
||||
}
|
||||
|
||||
addSlotToContainer(craftingResultSlot = new SlotGridCraftingResult(this, getPlayer(), (NetworkNodeGrid) grid, 0, 130 + 4, headerAndSlots + 22));
|
||||
addSlotToContainer(craftingResultSlot = new SlotGridCraftingResult(this, getPlayer(), grid, 0, 130 + 4, headerAndSlots + 22));
|
||||
} else if (grid.getType() == GridType.PATTERN) {
|
||||
int x = 8;
|
||||
int y = headerAndSlots + 4;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeInterface;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotOutput;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileInterface;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeWirelessTransmitter;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.container.slot;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -37,8 +37,8 @@ public final class IntegrationCraftingTweaks {
|
||||
public static class GetGridStartFunction implements Function<ContainerGrid, Integer> {
|
||||
@Override
|
||||
public Integer apply(ContainerGrid containerGrid) {
|
||||
for(int i = 0; i < containerGrid.inventorySlots.size(); i++) {
|
||||
if(containerGrid.inventorySlots.get(i) instanceof SlotGridCrafting) {
|
||||
for (int i = 0; i < containerGrid.inventorySlots.size(); i++) {
|
||||
if (containerGrid.inventorySlots.get(i) instanceof SlotGridCrafting) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
// First argument: the fluid stack to extract
|
||||
// There is no args.checkFluidStack(), we have to deal with this ourselves
|
||||
Map<String, Object> fluidMap = args.checkTable(0);
|
||||
if(!fluidMap.containsKey("name") || !(fluidMap.get("name") instanceof String) || ((String) fluidMap.get("name")).length() == 0) {
|
||||
if (!fluidMap.containsKey("name") || !(fluidMap.get("name") instanceof String) || ((String) fluidMap.get("name")).length() == 0) {
|
||||
throw new IllegalArgumentException("no fluid name");
|
||||
}
|
||||
String fluid = (String) fluidMap.get("name");
|
||||
@@ -162,7 +162,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
|
||||
// With the amount ready, we can actually try to create a fluid stack for the given fluid
|
||||
FluidStack stack = FluidRegistry.getFluidStack(fluid, amount);
|
||||
if(stack == null) {
|
||||
if (stack == null) {
|
||||
throw new IllegalArgumentException("invalid fluid stack, does not exist");
|
||||
}
|
||||
|
||||
@@ -171,19 +171,19 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
|
||||
// Get the tile-entity on the specified side
|
||||
TileEntity targetEntity = node.getNetwork().getNetworkWorld().getTileEntity(node.getPos().offset(facing));
|
||||
if(targetEntity == null || !targetEntity.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite())) {
|
||||
if (targetEntity == null || !targetEntity.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite())) {
|
||||
throw new IllegalArgumentException("No fluid tank on the given side");
|
||||
}
|
||||
|
||||
FluidStack extractedSim = node.getNetwork().extractFluid(stack, amount, true);
|
||||
if(extractedSim == null || extractedSim.amount <= 0) {
|
||||
if (extractedSim == null || extractedSim.amount <= 0) {
|
||||
return new Object[]{null, "could not extract the specified fluid"};
|
||||
}
|
||||
|
||||
// Simulate inserting the fluid and see how much we were able to insert
|
||||
IFluidHandler handler = targetEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite());
|
||||
int filledAmountSim = handler.fill(extractedSim, false);
|
||||
if(filledAmountSim <= 0) {
|
||||
if (filledAmountSim <= 0) {
|
||||
return new Object[]{0};
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
FluidStack extracted = node.getNetwork().extractFluid(stack, amount, false);
|
||||
handler.fill(extracted, true);
|
||||
|
||||
return new Object[] { filledAmountSim };
|
||||
return new Object[]{filledAmountSim};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(stack:table):table -- Gets a fluid from the network.")
|
||||
@@ -202,18 +202,18 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
|
||||
// There is no args.checkFluidStack(), we have to deal with this ourselves
|
||||
Map<String, Object> fluidMap = args.checkTable(0);
|
||||
if(!fluidMap.containsKey("name") || !(fluidMap.get("name") instanceof String) || ((String) fluidMap.get("name")).length() == 0) {
|
||||
if (!fluidMap.containsKey("name") || !(fluidMap.get("name") instanceof String) || ((String) fluidMap.get("name")).length() == 0) {
|
||||
throw new IllegalArgumentException("no fluid name");
|
||||
}
|
||||
|
||||
String fluid = (String) fluidMap.get("name");
|
||||
|
||||
FluidStack needle = FluidRegistry.getFluidStack(fluid, 1000);
|
||||
if(needle == null) {
|
||||
if (needle == null) {
|
||||
throw new IllegalArgumentException("invalid fluid stack, does not exist");
|
||||
}
|
||||
|
||||
return new Object[]{ node.getNetwork().getFluidStorageCache().getList().get(needle) };
|
||||
return new Object[]{node.getNetwork().getFluidStorageCache().getList().get(needle)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Gets a list of all fluids in this network.")
|
||||
@@ -245,7 +245,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
|
||||
// Get the tile-entity on the specified side
|
||||
TileEntity targetEntity = node.getNetwork().getNetworkWorld().getTileEntity(node.getPos().offset(facing));
|
||||
if(targetEntity == null || !targetEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite())) {
|
||||
if (targetEntity == null || !targetEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite())) {
|
||||
throw new IllegalArgumentException("No inventory on the given side");
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
|
||||
ItemStack extracted = node.getNetwork().extractItem(stack, count, false);
|
||||
ItemHandlerHelper.insertItemStacked(handler, extracted, false);
|
||||
|
||||
return new Object[] { transferableAmount };
|
||||
return new Object[]{transferableAmount};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(stack:table[, compareMeta:boolean[, compareNBT:boolean[, compareOreDict:boolean]]]):table -- Gets an item from the network.")
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CapabilityProviderEnergy implements ICapabilityProvider {
|
||||
@@ -20,13 +21,13 @@ public class CapabilityProviderEnergy implements ICapabilityProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityEnergy.ENERGY ||
|
||||
(IntegrationTesla.isLoaded() && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(new ItemEnergyForge(stack, ItemEnergyItem.CAPACITY));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.raoulvdberge.refinedstorage.network;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.proxy.ProxyClient;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.proxy;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
@@ -12,6 +10,8 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CapabilityNetworkNodeProxy {
|
||||
@CapabilityInject(INetworkNodeProxy.class)
|
||||
public static Capability<INetworkNodeProxy> NETWORK_NODE_PROXY_CAPABILITY = null;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.raoulvdberge.refinedstorage.render;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class PropertyObject<T> implements IUnlistedProperty<T> {
|
||||
private final String name;
|
||||
@@ -21,7 +20,7 @@ public class PropertyObject<T> implements IUnlistedProperty<T> {
|
||||
}
|
||||
|
||||
public PropertyObject(String name, Class<T> clazz) {
|
||||
this(name, clazz, Predicates.alwaysTrue(), input -> Objects.toString(input));
|
||||
this(name, clazz, v -> true, Objects::toString);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,7 +30,7 @@ public class PropertyObject<T> implements IUnlistedProperty<T> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(T value) {
|
||||
return validator.apply(value);
|
||||
return validator.test(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,6 +107,7 @@ public abstract class TileBase extends TileEntity {
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IItemHandler getDrops() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -741,7 +741,7 @@ public class TileController extends TileBase implements ITickable, INetworkMaste
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(energy);
|
||||
}
|
||||
@@ -763,7 +763,7 @@ public class TileController extends TileBase implements ITickable, INetworkMaste
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityEnergy.ENERGY
|
||||
|| (energyTesla != null && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER))
|
||||
|| capability == CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY
|
||||
|
||||
@@ -148,12 +148,12 @@ public class TileDiskDrive extends TileNode<NetworkNodeDiskDrive> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getNode().getDisks());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class TileDiskManipulator extends TileNode<NetworkNodeDiskManipulator> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(facing == EnumFacing.DOWN ? getNode().getOutputDisks() : getNode().getInputDisks());
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class TileDiskManipulator extends TileNode<NetworkNodeDiskManipulator> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@ public class TileFluidInterface extends TileNode<NetworkNodeFluidInterface> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(getNode().getTank());
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class TileInterface extends TileNode<NetworkNodeInterface> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getNode().getItems());
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class TileInterface extends TileNode<NetworkNodeInterface> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ public class TileNetworkTransmitter extends TileNode<NetworkNodeNetworkTransmitt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getNode().getNetworkCard());
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
|
||||
getNode().setActive(tag.getBoolean(NBT_ACTIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IItemHandler getDrops() {
|
||||
return getNode().getDrops();
|
||||
}
|
||||
@@ -148,7 +150,7 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
|
||||
public abstract N createNode();
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing side) {
|
||||
if (capability == CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
@@ -157,7 +159,7 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing side) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing side) {
|
||||
if (capability == CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY) {
|
||||
return CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY.cast(this);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TileProcessingPatternEncoder extends TileBase {
|
||||
@@ -150,12 +151,13 @@ public class TileProcessingPatternEncoder extends TileBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IItemHandler getDrops() {
|
||||
return patterns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(patterns);
|
||||
}
|
||||
@@ -164,7 +166,7 @@ public class TileProcessingPatternEncoder extends TileBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class TileReader extends TileNode<NetworkNodeReader> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
if (super.hasCapability(capability, facing)) {
|
||||
return true;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class TileReader extends TileNode<NetworkNodeReader> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
T foundCapability = super.getCapability(capability, facing);
|
||||
|
||||
if (foundCapability == null) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class TileSolderer extends TileNode<NetworkNodeSolderer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getNode().getItems());
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class TileSolderer extends TileNode<NetworkNodeSolderer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TileWriter extends TileNode<NetworkNodeWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
if (super.hasCapability(capability, facing)) {
|
||||
return true;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class TileWriter extends TileNode<NetworkNodeWriter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
T foundCapability = super.getCapability(capability, facing);
|
||||
|
||||
if (foundCapability == null) {
|
||||
|
||||
@@ -26,8 +26,8 @@ public interface IType {
|
||||
((IType) tile.getNode()).setType(value);
|
||||
|
||||
tile.getWorld().playerEntities.stream()
|
||||
.filter(p -> p.openContainer instanceof ContainerBase && ((ContainerBase) p.openContainer).getTile().getPos().equals(tile.getPos()))
|
||||
.forEach(p -> p.openContainer.detectAndSendChanges());
|
||||
.filter(p -> p.openContainer instanceof ContainerBase && ((ContainerBase) p.openContainer).getTile().getPos().equals(tile.getPos()))
|
||||
.forEach(p -> p.openContainer.detectAndSendChanges());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.raoulvdberge.refinedstorage.tile.grid;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
|
||||
@@ -519,13 +519,13 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(energyStorage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user