Bump to 1.6. Remove bunch of integrations.
This commit is contained in:
@@ -23,7 +23,7 @@ public final class RS {
|
||||
}
|
||||
|
||||
public static final String ID = "refinedstorage";
|
||||
public static final String VERSION = "1.5.35";
|
||||
public static final String VERSION = "1.6";
|
||||
public static final String DEPENDENCIES = "required-after:forge@[14.23.1.2555,);after:mcmultipart@[2.4.1,);after:storagedrawers@[1.12-5.2.2,);";
|
||||
public static final String GUI_FACTORY = "com.raoulvdberge.refinedstorage.gui.config.ModGuiFactory";
|
||||
public static final String UPDATE_JSON = "https://refinedstorage.raoulvdberge.com/update";
|
||||
|
||||
@@ -5,8 +5,6 @@ import com.raoulvdberge.refinedstorage.api.network.INetworkNodeVisitor;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
|
||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
@@ -215,7 +213,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
|
||||
|
||||
// @todo: Move this data to the network node.
|
||||
public void resetDirection() {
|
||||
EnumFacing direction = ((TileBase) (IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos))).getDirection();
|
||||
EnumFacing direction = ((TileBase) world.getTileEntity(pos)).getDirection();
|
||||
if (!direction.equals(this.direction)) {
|
||||
this.direction = direction;
|
||||
onDirectionChanged();
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||
import com.raoulvdberge.refinedstorage.block.BlockCable;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class NetworkNodeCable extends NetworkNode {
|
||||
public static final String ID = "cable";
|
||||
|
||||
@@ -27,13 +20,4 @@ public class NetworkNodeCable extends NetworkNode {
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConduct(@Nullable EnumFacing direction) {
|
||||
if (IntegrationMCMP.isLoaded() && direction != null) {
|
||||
return BlockCable.hasConnectionWith(world, pos, RSBlocks.CABLE, IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos), direction);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||
@@ -134,18 +132,8 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
||||
}
|
||||
}
|
||||
|
||||
private WorldServer getWorldServer() {
|
||||
World world = this.world;
|
||||
|
||||
if (IntegrationMCMP.isLoaded()) {
|
||||
world = RSMCMPAddon.unwrapWorld(world);
|
||||
}
|
||||
|
||||
return (WorldServer) world;
|
||||
}
|
||||
|
||||
private boolean canPlace(BlockPos pos, IBlockState state) {
|
||||
BlockEvent.PlaceEvent e = new BlockEvent.PlaceEvent(new BlockSnapshot(world, pos, state), world.getBlockState(pos), FakePlayerFactory.getMinecraft(getWorldServer()), EnumHand.MAIN_HAND);
|
||||
BlockEvent.PlaceEvent e = new BlockEvent.PlaceEvent(new BlockSnapshot(world, pos, state), world.getBlockState(pos), FakePlayerFactory.getMinecraft((WorldServer) world), EnumHand.MAIN_HAND);
|
||||
|
||||
return !MinecraftForge.EVENT_BUS.post(e);
|
||||
}
|
||||
@@ -161,7 +149,7 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
||||
IBlockState state = SlotFilter.getBlockState(world, front, took);
|
||||
|
||||
if (state != null && world.isAirBlock(front) && state.getBlock().canPlaceBlockAt(world, front)) {
|
||||
state = state.getBlock().getStateForPlacement(world, front, getDirection(), 0.5F, 0.5F, 0.5F, took.getMetadata(), FakePlayerFactory.getMinecraft(getWorldServer()), EnumHand.MAIN_HAND);
|
||||
state = state.getBlock().getStateForPlacement(world, front, getDirection(), 0.5F, 0.5F, 0.5F, took.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) world), EnumHand.MAIN_HAND);
|
||||
|
||||
if (!canPlace(front, state)) {
|
||||
return;
|
||||
@@ -173,7 +161,7 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
||||
if (item.getItem() instanceof ItemBlock) {
|
||||
((ItemBlock) item.getItem()).placeBlockAt(
|
||||
took,
|
||||
FakePlayerFactory.getMinecraft(getWorldServer()),
|
||||
FakePlayerFactory.getMinecraft((WorldServer) world),
|
||||
world,
|
||||
front,
|
||||
getDirection(),
|
||||
@@ -185,7 +173,7 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
|
||||
} else {
|
||||
world.setBlockState(front, state, 1 | 2);
|
||||
|
||||
state.getBlock().onBlockPlacedBy(world, front, state, FakePlayerFactory.getMinecraft(getWorldServer()), took);
|
||||
state.getBlock().onBlockPlacedBy(world, front, state, FakePlayerFactory.getMinecraft((WorldServer) world), took);
|
||||
}
|
||||
|
||||
// From ItemBlock#onItemUse
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||
@@ -74,16 +72,6 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
|
||||
return RS.INSTANCE.config.destructorUsage + upgrades.getEnergyUsage();
|
||||
}
|
||||
|
||||
private WorldServer getWorldServer() {
|
||||
World world = this.world;
|
||||
|
||||
if (IntegrationMCMP.isLoaded()) {
|
||||
world = RSMCMPAddon.unwrapWorld(world);
|
||||
}
|
||||
|
||||
return (WorldServer) world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
@@ -142,7 +130,7 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
|
||||
}
|
||||
}
|
||||
|
||||
BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(world, front, frontBlockState, FakePlayerFactory.getMinecraft(getWorldServer()));
|
||||
BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(world, front, frontBlockState, FakePlayerFactory.getMinecraft((WorldServer) world));
|
||||
|
||||
if (!MinecraftForge.EVENT_BUS.post(e)) {
|
||||
world.playEvent(null, 2001, front, Block.getStateId(frontBlockState));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||
@@ -12,9 +11,6 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheFluid;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheItem;
|
||||
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.integration.projecte.IntegrationProjectE;
|
||||
import com.raoulvdberge.refinedstorage.integration.projecte.StorageItemTransmutationTable;
|
||||
import com.raoulvdberge.refinedstorage.integration.storagedrawers.StorageItemItemRepository;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFluid;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||
@@ -29,8 +25,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -39,9 +33,6 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class NetworkNodeExternalStorage extends NetworkNode implements IStorageProvider, IGuiStorage, IComparable, IFilterable, IPrioritizable, IType, IAccessType {
|
||||
@CapabilityInject(IDrawerGroup.class)
|
||||
private static final Capability<IDrawerGroup> DRAWER_GROUP_CAPABILITY = null;
|
||||
|
||||
public static final String ID = "external_storage";
|
||||
|
||||
private static final String NBT_PRIORITY = "Priority";
|
||||
@@ -203,22 +194,12 @@ public class NetworkNodeExternalStorage extends NetworkNode implements IStorageP
|
||||
TileEntity facing = getFacingTile();
|
||||
|
||||
if (type == IType.ITEMS) {
|
||||
if (facing != null) {
|
||||
if (DRAWER_GROUP_CAPABILITY != null && facing.hasCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite())) {
|
||||
itemStorages.add(new StorageItemItemRepository(this, () -> {
|
||||
TileEntity f = getFacingTile();
|
||||
if (facing != null && !(facing.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()) && facing.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()).getNode() instanceof IStorageProvider)) {
|
||||
IItemHandler itemHandler = WorldUtils.getItemHandler(facing, getDirection().getOpposite());
|
||||
|
||||
return (f != null && f.hasCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite())) ? f.getCapability(DRAWER_GROUP_CAPABILITY, getDirection().getOpposite()) : null;
|
||||
}));
|
||||
} else if (!(facing.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()) && facing.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, getDirection().getOpposite()).getNode() instanceof IStorageProvider)) {
|
||||
IItemHandler itemHandler = WorldUtils.getItemHandler(facing, getDirection().getOpposite());
|
||||
|
||||
if (itemHandler != null) {
|
||||
itemStorages.add(new StorageItemItemHandler(this, () -> WorldUtils.getItemHandler(getFacingTile(), getDirection().getOpposite())));
|
||||
}
|
||||
if (itemHandler != null) {
|
||||
itemStorages.add(new StorageItemItemHandler(this, () -> WorldUtils.getItemHandler(getFacingTile(), getDirection().getOpposite())));
|
||||
}
|
||||
} else if (IntegrationProjectE.isLoaded() && world.getBlockState(pos.offset(getDirection())).getBlock().getUnlocalizedName().equals("tile.pe_transmutation_stone")) {
|
||||
itemStorages.add(new StorageItemTransmutationTable(this));
|
||||
}
|
||||
} else if (type == IType.FLUIDS) {
|
||||
IFluidHandler fluidHandler = WorldUtils.getFluidHandler(facing, getDirection().getOpposite());
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
|
||||
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.container.ContainerBase;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemBlockBase;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
@@ -89,7 +87,7 @@ public abstract class BlockBase extends Block {
|
||||
@SuppressWarnings("deprecation")
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if (getDirection() != null) {
|
||||
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileBase) {
|
||||
return state.withProperty(getDirection().getProperty(), ((TileBase) tile).getDirection());
|
||||
@@ -138,7 +136,7 @@ public abstract class BlockBase extends Block {
|
||||
}
|
||||
|
||||
protected void dropContents(World world, BlockPos pos) {
|
||||
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
||||
IItemHandler handler = ((TileBase) tile).getDrops();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileCable;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
@@ -75,7 +73,7 @@ public class BlockCable extends BlockNode {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
state = super.getActualState(state, world, pos)
|
||||
.withProperty(NORTH, hasConnectionWith(world, pos, this, tile, EnumFacing.NORTH))
|
||||
@@ -114,11 +112,6 @@ public class BlockCable extends BlockNode {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IntegrationMCMP.isLoaded()) {
|
||||
return !RSMCMPAddon.hasObstructingMultipart(tile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction)))
|
||||
&& !RSMCMPAddon.hasObstructingMultipart(otherTile, Collections.singletonList(BlockCable.getCableExtensionAABB(direction.getOpposite())));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -238,22 +231,4 @@ public class BlockCable extends BlockNode {
|
||||
public Direction getDirection() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AxisAlignedBB getCableExtensionAABB(EnumFacing facing) {
|
||||
if (facing == EnumFacing.NORTH) {
|
||||
return NORTH_AABB;
|
||||
} else if (facing == EnumFacing.EAST) {
|
||||
return EAST_AABB;
|
||||
} else if (facing == EnumFacing.SOUTH) {
|
||||
return SOUTH_AABB;
|
||||
} else if (facing == EnumFacing.WEST) {
|
||||
return WEST_AABB;
|
||||
} else if (facing == EnumFacing.UP) {
|
||||
return UP_AABB;
|
||||
} else if (facing == EnumFacing.DOWN) {
|
||||
return DOWN_AABB;
|
||||
}
|
||||
|
||||
return NORTH_AABB;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.raoulvdberge.refinedstorage.block;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
@@ -92,7 +90,7 @@ public abstract class BlockNode extends BlockBase {
|
||||
state = super.getActualState(state, world, pos);
|
||||
|
||||
if (hasConnectivityState()) {
|
||||
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileNode) {
|
||||
return state.withProperty(CONNECTED, ((TileNode) tile).getNode().isActive());
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.IGuiReaderWriter;
|
||||
import com.raoulvdberge.refinedstorage.container.*;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.tile.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.WirelessCraftingMonitor;
|
||||
@@ -89,12 +87,12 @@ public class GuiHandler implements IGuiHandler {
|
||||
return getCraftingMonitorContainer(player, x, y);
|
||||
}
|
||||
|
||||
return getContainer(ID, player, IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, new BlockPos(x, y, z)) : world.getTileEntity(new BlockPos(x, y, z)));
|
||||
return getContainer(ID, player, world.getTileEntity(new BlockPos(x, y, z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, new BlockPos(x, y, z)) : world.getTileEntity(new BlockPos(x, y, z));
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
switch (ID) {
|
||||
case RSGui.CONTROLLER:
|
||||
|
||||
@@ -33,8 +33,6 @@ public class SideButtonGridViewType extends SideButton {
|
||||
type = IGrid.VIEW_TYPE_CRAFTABLES;
|
||||
} else if (type == IGrid.VIEW_TYPE_CRAFTABLES) {
|
||||
type = IGrid.VIEW_TYPE_NORMAL;
|
||||
} else {
|
||||
type = IGrid.VIEW_TYPE_NORMAL; // @todo: Remove in 1.13 (1.5.24 -> 1.5.26 conversion, removed detailed grid view type)
|
||||
}
|
||||
|
||||
grid.onViewTypeChanged(type);
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -85,7 +84,7 @@ public class GridStackItem implements IGridStack {
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
return Item.REGISTRY.getNameForObject(stack.getItem()).getResourceDomain();
|
||||
return stack.getItem().getCreatorModId(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.mcmp;
|
||||
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
public final class IntegrationMCMP {
|
||||
public static boolean isLoaded() {
|
||||
return Loader.isModLoaded("mcmultipart");
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.mcmp;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.block.BlockCable;
|
||||
import mcmultipart.api.container.IPartInfo;
|
||||
import mcmultipart.api.multipart.IMultipart;
|
||||
import mcmultipart.api.slot.EnumCenterSlot;
|
||||
import mcmultipart.api.slot.IPartSlot;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PartCable implements IMultipart {
|
||||
private BlockCable block;
|
||||
|
||||
public PartCable(BlockCable block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartSlot getSlotForPlacement(World world, BlockPos pos, IBlockState state, EnumFacing facing, float hitX, float hitY, float hitZ, EntityLivingBase placer) {
|
||||
return EnumCenterSlot.CENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartSlot getSlotFromWorld(IBlockAccess world, BlockPos pos, IBlockState state) {
|
||||
return EnumCenterSlot.CENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AxisAlignedBB> getOcclusionBoxes(IPartInfo part) {
|
||||
List<AxisAlignedBB> boxes = new ArrayList<>();
|
||||
|
||||
boxes.add(BlockCable.CORE_AABB);
|
||||
boxes.addAll(block.getNonUnionizedCollisionBoxes(part.getState()));
|
||||
|
||||
return boxes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPartChanged(IPartInfo part, IPartInfo otherPart) {
|
||||
API.instance().discoverNode(part.getActualWorld(), part.getContainer().getPartPos());
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.mcmp;
|
||||
|
||||
import mcmultipart.api.container.IPartInfo;
|
||||
import mcmultipart.api.multipart.IMultipartTile;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PartCableTile implements IMultipartTile {
|
||||
private TileEntity tile;
|
||||
private IPartInfo info;
|
||||
|
||||
public PartCableTile(TileEntity tile) {
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartInfo(IPartInfo info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
public IPartInfo getInfo() {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.mcmp;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||
import com.raoulvdberge.refinedstorage.block.BlockCable;
|
||||
import com.raoulvdberge.refinedstorage.tile.*;
|
||||
import mcmultipart.api.addon.IMCMPAddon;
|
||||
import mcmultipart.api.addon.MCMPAddon;
|
||||
import mcmultipart.api.container.IPartInfo;
|
||||
import mcmultipart.api.multipart.IMultipart;
|
||||
import mcmultipart.api.multipart.IMultipartRegistry;
|
||||
import mcmultipart.api.multipart.IMultipartTile;
|
||||
import mcmultipart.api.multipart.MultipartOcclusionHelper;
|
||||
import mcmultipart.api.ref.MCMPCapabilities;
|
||||
import mcmultipart.api.slot.EnumCenterSlot;
|
||||
import mcmultipart.block.BlockMultipartContainer;
|
||||
import mcmultipart.block.TileMultipartContainer;
|
||||
import mcmultipart.util.MCMPWorldWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@MCMPAddon
|
||||
public class RSMCMPAddon implements IMCMPAddon {
|
||||
@Override
|
||||
public void registerParts(IMultipartRegistry registry) {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
register(registry, RSBlocks.CABLE);
|
||||
register(registry, RSBlocks.CONSTRUCTOR);
|
||||
register(registry, RSBlocks.DESTRUCTOR);
|
||||
register(registry, RSBlocks.IMPORTER);
|
||||
register(registry, RSBlocks.EXPORTER);
|
||||
register(registry, RSBlocks.EXTERNAL_STORAGE);
|
||||
register(registry, RSBlocks.READER);
|
||||
register(registry, RSBlocks.WRITER);
|
||||
}
|
||||
|
||||
private void register(IMultipartRegistry registry, BlockCable block) {
|
||||
registry.registerPartWrapper(block, new PartCable(block));
|
||||
registry.registerStackWrapper(Item.getItemFromBlock(block), s -> true, block);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAttachCapability(AttachCapabilitiesEvent<TileEntity> e) {
|
||||
TileEntity tile = e.getObject();
|
||||
|
||||
if (tile instanceof TileCable) {
|
||||
register(e, "cable");
|
||||
} else if (tile instanceof TileConstructor) {
|
||||
register(e, "constructor");
|
||||
} else if (tile instanceof TileDestructor) {
|
||||
register(e, "destructor");
|
||||
} else if (tile instanceof TileImporter) {
|
||||
register(e, "importer");
|
||||
} else if (tile instanceof TileExporter) {
|
||||
register(e, "exporter");
|
||||
} else if (tile instanceof TileExternalStorage) {
|
||||
register(e, "external_storage");
|
||||
} else if (tile instanceof TileReader) {
|
||||
register(e, "reader");
|
||||
} else if (tile instanceof TileWriter) {
|
||||
register(e, "writer");
|
||||
}
|
||||
}
|
||||
|
||||
private void register(AttachCapabilitiesEvent<TileEntity> e, String id) {
|
||||
e.addCapability(new ResourceLocation("refinedstorage:" + id), new ICapabilityProvider() {
|
||||
private PartCableTile tile;
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == MCMPCapabilities.MULTIPART_TILE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == MCMPCapabilities.MULTIPART_TILE) {
|
||||
if (tile == null) {
|
||||
tile = new PartCableTile(e.getObject());
|
||||
}
|
||||
|
||||
return MCMPCapabilities.MULTIPART_TILE.cast(tile);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean hasObstructingMultipart(TileEntity tile, List<AxisAlignedBB> testBoxes) {
|
||||
if (tile != null && tile.hasCapability(MCMPCapabilities.MULTIPART_TILE, null)) {
|
||||
IMultipartTile multipartTile = tile.getCapability(MCMPCapabilities.MULTIPART_TILE, null);
|
||||
|
||||
if (multipartTile instanceof PartCableTile && ((PartCableTile) multipartTile).getInfo() != null) {
|
||||
for (IPartInfo info : ((PartCableTile) multipartTile).getInfo().getContainer().getParts().values()) {
|
||||
IMultipart multipart = info.getPart();
|
||||
|
||||
if (!(multipart instanceof PartCable) && MultipartOcclusionHelper.testBoxIntersection(testBoxes, multipart.getOcclusionBoxes(info))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TileEntity unwrapTile(IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileMultipartContainer) {
|
||||
Optional<IMultipartTile> multipartTile = ((TileMultipartContainer) tile).getPartTile(EnumCenterSlot.CENTER);
|
||||
|
||||
if (multipartTile.isPresent()) {
|
||||
return multipartTile.get().getTileEntity();
|
||||
}
|
||||
}
|
||||
|
||||
return tile;
|
||||
}
|
||||
|
||||
public static World unwrapWorld(World world) {
|
||||
if (world instanceof MCMPWorldWrapper) {
|
||||
return ((MCMPWorldWrapper) world).getActualWorld();
|
||||
}
|
||||
|
||||
return world;
|
||||
}
|
||||
|
||||
public static Block unwrapBlock(IBlockAccess world, BlockPos pos) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() instanceof BlockMultipartContainer) {
|
||||
Optional<TileMultipartContainer> multipartContainer = BlockMultipartContainer.getTile(world, pos);
|
||||
|
||||
if (multipartContainer.isPresent()) {
|
||||
Optional<IPartInfo> info = multipartContainer.get().get(EnumCenterSlot.CENTER);
|
||||
|
||||
if (info.isPresent()) {
|
||||
return info.get().getPart().getBlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return state.getBlock();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.projecte;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import moze_intel.projecte.api.ProjectEAPI;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class IntegrationProjectE {
|
||||
private static final String ID = "projecte";
|
||||
|
||||
public static boolean isLoaded() {
|
||||
return Loader.isModLoaded(ID);
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) {
|
||||
if (!recipe.isProjectERecipe()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map<Object, Integer> ingredients = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
NonNullList<ItemStack> items = recipe.getRow(i);
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
ingredients.put(items.get(0), items.get(0).getCount());
|
||||
}
|
||||
}
|
||||
|
||||
ProjectEAPI.getConversionProxy().addConversion(recipe.getResult().getCount(), recipe.getResult(), ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.projecte;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.NetworkNodeExternalStorage;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.StorageItemExternal;
|
||||
import moze_intel.projecte.api.ProjectEAPI;
|
||||
import moze_intel.projecte.api.capabilities.IKnowledgeProvider;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class StorageItemTransmutationTable extends StorageItemExternal {
|
||||
private NetworkNodeExternalStorage externalStorage;
|
||||
|
||||
public StorageItemTransmutationTable(NetworkNodeExternalStorage externalStorage) {
|
||||
this.externalStorage = externalStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getStacks() {
|
||||
if (externalStorage.getOwner() != null) {
|
||||
IKnowledgeProvider provider = ProjectEAPI.getTransmutationProxy().getKnowledgeProviderFor(externalStorage.getOwner());
|
||||
|
||||
// @todo: https://github.com/sinkillerj/ProjectE/issues/1591
|
||||
if (!provider.getClass().getName().equals("moze_intel.projecte.impl.TransmutationOffline$1")) {
|
||||
List<ItemStack> stored = new LinkedList<>();
|
||||
|
||||
for (ItemStack knowledge : provider.getKnowledge()) {
|
||||
stored.add(ItemHandlerHelper.copyStackWithSize(knowledge, (int) Math.floor(provider.getEmc() / (double) ProjectEAPI.getEMCProxy().getValue(knowledge))));
|
||||
}
|
||||
|
||||
return stored;
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack insert(@Nonnull ItemStack stack, int size, boolean simulate) {
|
||||
ItemStack actualStack = ItemHandlerHelper.copyStackWithSize(stack, size);
|
||||
|
||||
if (externalStorage.getOwner() != null) {
|
||||
IKnowledgeProvider provider = ProjectEAPI.getTransmutationProxy().getKnowledgeProviderFor(externalStorage.getOwner());
|
||||
|
||||
// @todo: https://github.com/sinkillerj/ProjectE/issues/1591
|
||||
if (!provider.getClass().getName().equals("moze_intel.projecte.impl.TransmutationOffline$1")) {
|
||||
int emc = ProjectEAPI.getEMCProxy().getValue(actualStack) * size;
|
||||
|
||||
if (emc == 0) {
|
||||
return actualStack;
|
||||
}
|
||||
|
||||
if (!simulate) {
|
||||
provider.setEmc(provider.getEmc() + emc);
|
||||
|
||||
handleKnowledge(provider, stack.copy());
|
||||
|
||||
EntityPlayer player = externalStorage.getWorld().getPlayerEntityByUUID(externalStorage.getOwner());
|
||||
|
||||
if (player != null) {
|
||||
provider.sync((EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return actualStack;
|
||||
}
|
||||
|
||||
// @todo: https://github.com/sinkillerj/ProjectE/issues/1592
|
||||
private void handleKnowledge(IKnowledgeProvider provider, ItemStack stack) {
|
||||
if (stack.getCount() > 1) {
|
||||
stack.setCount(1);
|
||||
}
|
||||
|
||||
if (!stack.getHasSubtypes() && stack.getMaxDamage() != 0) {
|
||||
stack.setItemDamage(0);
|
||||
}
|
||||
|
||||
if (!provider.hasKnowledge(stack)) {
|
||||
stack.setTagCompound(null);
|
||||
|
||||
provider.addKnowledge(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack extract(@Nonnull ItemStack stack, int size, int flags, boolean simulate) {
|
||||
if (externalStorage.getOwner() != null) {
|
||||
IKnowledgeProvider provider = ProjectEAPI.getTransmutationProxy().getKnowledgeProviderFor(externalStorage.getOwner());
|
||||
|
||||
// @todo: https://github.com/sinkillerj/ProjectE/issues/1591
|
||||
if (!provider.getClass().getName().equals("moze_intel.projecte.impl.TransmutationOffline$1") && provider.hasKnowledge(stack)) {
|
||||
double singleEmc = ProjectEAPI.getEMCProxy().getValue(stack);
|
||||
|
||||
// If we have the Tome of Knowledge, IKnowledgeProvider#hasKnowledge will always return true, even if the item has no EMC assigned
|
||||
if (singleEmc == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int maxExtract = (int) Math.floor(provider.getEmc() / singleEmc);
|
||||
|
||||
if (size > maxExtract) {
|
||||
size = maxExtract;
|
||||
}
|
||||
|
||||
if (size <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack result = ItemHandlerHelper.copyStackWithSize(stack, size);
|
||||
|
||||
if (!simulate) {
|
||||
provider.setEmc(provider.getEmc() - (singleEmc * size));
|
||||
|
||||
EntityPlayer player = externalStorage.getWorld().getPlayerEntityByUUID(externalStorage.getOwner());
|
||||
|
||||
if (player != null) {
|
||||
provider.sync((EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStored() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return externalStorage.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return externalStorage.getAccessType();
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.storagedrawers;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.NetworkNodeExternalStorage;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.externalstorage.StorageItemExternal;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class StorageItemItemRepository extends StorageItemExternal {
|
||||
@CapabilityInject(IItemRepository.class)
|
||||
private static final Capability<IItemRepository> ITEM_REPOSITORY_CAPABILITY = null;
|
||||
|
||||
private NetworkNodeExternalStorage externalStorage;
|
||||
private Supplier<IDrawerGroup> groupSupplier;
|
||||
|
||||
public StorageItemItemRepository(NetworkNodeExternalStorage externalStorage, Supplier<IDrawerGroup> groupSupplier) {
|
||||
this.externalStorage = externalStorage;
|
||||
this.groupSupplier = groupSupplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getStacks() {
|
||||
IItemRepository repository = getRepositoryFromSupplier();
|
||||
|
||||
if (repository == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return repository.getAllItems().stream().map(r -> ItemHandlerHelper.copyStackWithSize(r.itemPrototype, r.count)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack insert(@Nonnull ItemStack stack, int size, boolean simulate) {
|
||||
IItemRepository repository = getRepositoryFromSupplier();
|
||||
|
||||
if (repository == null) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
return StackUtils.emptyToNull(repository.insertItem(ItemHandlerHelper.copyStackWithSize(stack, size), simulate));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack extract(@Nonnull ItemStack stack, int size, int flags, boolean simulate) {
|
||||
IItemRepository repository = getRepositoryFromSupplier();
|
||||
|
||||
if (repository == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return StackUtils.emptyToNull(repository.extractItem(stack, size, simulate, s -> API.instance().getComparer().isEqual(stack, s, flags)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStored() {
|
||||
IItemRepository repository = getRepositoryFromSupplier();
|
||||
|
||||
if (repository == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return repository.getAllItems().stream().mapToInt(r -> r.count).sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return externalStorage.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return externalStorage.getAccessType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
IDrawerGroup group = groupSupplier.get();
|
||||
|
||||
if (group == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
long capacity = 0;
|
||||
|
||||
for (int slot : group.getAccessibleDrawerSlots()) {
|
||||
IDrawer drawer = group.getDrawer(slot);
|
||||
|
||||
if (drawer.isEnabled()) {
|
||||
capacity += drawer.getMaxCapacity();
|
||||
}
|
||||
}
|
||||
|
||||
if (capacity >= Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
return (int) capacity;
|
||||
}
|
||||
|
||||
private IItemRepository getRepositoryFromSupplier() {
|
||||
IDrawerGroup group = groupSupplier.get();
|
||||
|
||||
if (group == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return group.getCapability(ITEM_REPOSITORY_CAPABILITY, null);
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,6 @@ import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||
import com.raoulvdberge.refinedstorage.block.*;
|
||||
import com.raoulvdberge.refinedstorage.gui.GuiCraftingPreview;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiCraftingStart;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
|
||||
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.item.*;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageGridCraftingPreviewResponse;
|
||||
import com.raoulvdberge.refinedstorage.render.*;
|
||||
@@ -331,7 +329,7 @@ public class ProxyClient extends ProxyCommon {
|
||||
|
||||
BlockPos pos = e.getTarget().getBlockPos();
|
||||
|
||||
Block block = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapBlock(player.getEntityWorld(), pos) : player.getEntityWorld().getBlockState(pos).getBlock();
|
||||
Block block = player.getEntityWorld().getBlockState(pos).getBlock();
|
||||
|
||||
if (!(block instanceof BlockCable)) {
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.raoulvdberge.refinedstorage.integration.funkylocomotion.MoveFactoryRe
|
||||
import com.raoulvdberge.refinedstorage.integration.inventorysorter.IntegrationInventorySorter;
|
||||
import com.raoulvdberge.refinedstorage.integration.oc.DriverNetwork;
|
||||
import com.raoulvdberge.refinedstorage.integration.oc.IntegrationOC;
|
||||
import com.raoulvdberge.refinedstorage.integration.projecte.IntegrationProjectE;
|
||||
import com.raoulvdberge.refinedstorage.network.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
||||
@@ -263,10 +262,6 @@ public class ProxyCommon {
|
||||
if (IntegrationCraftingTweaks.isLoaded()) {
|
||||
IntegrationCraftingTweaks.register();
|
||||
}
|
||||
|
||||
if (IntegrationProjectE.isLoaded()) {
|
||||
IntegrationProjectE.register();
|
||||
}
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
@@ -327,7 +322,7 @@ public class ProxyCommon {
|
||||
}
|
||||
|
||||
private void registerTile(Class<? extends TileBase> tile, String id) {
|
||||
GameRegistry.registerTileEntity(tile, RS.ID + ":" + id);
|
||||
GameRegistry.registerTileEntity(tile, new ResourceLocation(RS.ID, id));
|
||||
|
||||
try {
|
||||
TileBase tileInstance = tile.newInstance();
|
||||
|
||||
Reference in New Issue
Block a user