Fixed pattern slots in Crafters not being accessible, fixes #1592

This commit is contained in:
raoulvdberge
2017-12-31 11:48:11 +01:00
parent 6336dca54c
commit d0e9e267d8
2 changed files with 19 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
### 1.5.31 ### 1.5.31
- Improved the "cannot craft! loop in processing..." error message (raoulvdberge) - Improved the "cannot craft! loop in processing..." error message (raoulvdberge)
- Fixed error logs when toggling the Pattern Grid from and to processing mode (raoulvdberge) - Fixed error logs when toggling the Pattern Grid from and to processing mode (raoulvdberge)
- Fixed pattern slots in Crafters not being accessible (raoulvdberge)
- Storage disk and block stored and capacity counts are formatted now in the tooltip (raoulvdberge) - Storage disk and block stored and capacity counts are formatted now in the tooltip (raoulvdberge)
### 1.5.30 ### 1.5.30

View File

@@ -1,10 +1,14 @@
package com.raoulvdberge.refinedstorage.tile; package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafter; import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeCrafter;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TileCrafter extends TileNode<NetworkNodeCrafter> { public class TileCrafter extends TileNode<NetworkNodeCrafter> {
@Override @Override
@@ -17,4 +21,18 @@ public class TileCrafter extends TileNode<NetworkNodeCrafter> {
public String getNodeId() { public String getNodeId() {
return NetworkNodeCrafter.ID; return NetworkNodeCrafter.ID;
} }
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getNode().getPatternItems());
}
return super.getCapability(capability, facing);
}
} }