mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 19:49:54 +00:00
Fix #1106 Add IItemHandler Capability to TileForestry
This commit is contained in:
1 parent
fa30244c5e
commit
8fea137a8b
3 files changed
+29
-11
No files matched your search
@@ -8,7 +8,6 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
|
||||
package forestry.core.inventory.wrappers;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) CovertJaguar, 2014 http://railcraft.info
|
||||
*
|
||||
* This code is the property of CovertJaguar
|
||||
* and may only be used with explicit written
|
||||
* permission unless otherwise specified on the
|
||||
* license page at http://railcraft.info/wiki/info:license.
|
||||
*/
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.inventory.wrappers;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
@@ -28,9 +28,10 @@ import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.core.access.AccessHandler;
|
||||
@@ -388,4 +389,20 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && inventory != null){
|
||||
return (T) new SidedInvWrapper(inventory, facing);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && inventory != null){
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user