mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Sorted of fixed FastBench compat
This commit is contained in:
parent
9dbbb7b913
commit
f44c4de74a
3 changed files with 109 additions and 103 deletions
|
@ -70,6 +70,9 @@ repositories {
|
||||||
name = "ModMaven / JEI Mirror"
|
name = "ModMaven / JEI Mirror"
|
||||||
url = "https://modmaven.k-4u.nl"
|
url = "https://modmaven.k-4u.nl"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url = "https://www.cursemaven.com"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -79,6 +82,8 @@ dependencies {
|
||||||
compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
|
compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
|
||||||
// at runtime, use the full JEI jar
|
// at runtime, use the full JEI jar
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
|
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
|
||||||
|
|
||||||
|
compile "curse.maven:fastworkbench:3003114"
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|
|
@ -1,92 +1,93 @@
|
||||||
package de.ellpeck.actuallyadditions.common.util.compat;
|
// @todo: check to see if any mod takes over for this one
|
||||||
|
//package de.ellpeck.actuallyadditions.common.util.compat;
|
||||||
import org.cyclops.commoncapabilities.api.capability.itemhandler.DefaultSlotlessItemHandlerWrapper;
|
//
|
||||||
import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler;
|
//import org.cyclops.commoncapabilities.api.capability.itemhandler.DefaultSlotlessItemHandlerWrapper;
|
||||||
|
//import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler;
|
||||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityItemViewer;
|
//
|
||||||
import de.ellpeck.actuallyadditions.common.tile.TileEntityItemViewer.SlotlessItemHandlerInfo;
|
//import de.ellpeck.actuallyadditions.common.tile.TileEntityItemViewer;
|
||||||
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
//import de.ellpeck.actuallyadditions.common.tile.TileEntityItemViewer.SlotlessItemHandlerInfo;
|
||||||
import net.minecraft.item.ItemStack;
|
//import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
//import net.minecraft.item.ItemStack;
|
||||||
|
//import net.minecraftforge.items.IItemHandler;
|
||||||
public final class CommonCapsUtil {
|
//
|
||||||
|
//public final class CommonCapsUtil {
|
||||||
public static ISlotlessItemHandler createSlotlessItemViewerHandler(final TileEntityItemViewer tile, IItemHandler normalHandler) {
|
//
|
||||||
return new DefaultSlotlessItemHandlerWrapper(normalHandler) {
|
// public static ISlotlessItemHandler createSlotlessItemViewerHandler(final TileEntityItemViewer tile, IItemHandler normalHandler) {
|
||||||
@Override
|
// return new DefaultSlotlessItemHandlerWrapper(normalHandler) {
|
||||||
public ItemStack insertItem(ItemStack stack, boolean simulate) {
|
// @Override
|
||||||
ItemStack remain = stack.copy();
|
// public ItemStack insertItem(ItemStack stack, boolean simulate) {
|
||||||
for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
// ItemStack remain = stack.copy();
|
||||||
if (handler.isLoaded() && tile.isWhitelisted(handler, stack, false)) {
|
// for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||||
if (handler.handler instanceof ISlotlessItemHandler) {
|
// if (handler.isLoaded() && tile.isWhitelisted(handler, stack, false)) {
|
||||||
remain = ((ISlotlessItemHandler) handler.handler).insertItem(stack, simulate);
|
// if (handler.handler instanceof ISlotlessItemHandler) {
|
||||||
|
// remain = ((ISlotlessItemHandler) handler.handler).insertItem(stack, simulate);
|
||||||
if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) {
|
//
|
||||||
tile.markDirty();
|
// if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) {
|
||||||
tile.doItemParticle(stack, handler.relayInQuestion.getPos(), tile.connectedRelay.getPos());
|
// tile.markDirty();
|
||||||
}
|
// tile.doItemParticle(stack, handler.relayInQuestion.getPos(), tile.connectedRelay.getPos());
|
||||||
|
// }
|
||||||
if (!StackUtil.isValid(remain)) { return StackUtil.getEmpty(); }
|
//
|
||||||
}
|
// if (!StackUtil.isValid(remain)) { return StackUtil.getEmpty(); }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return super.insertItem(remain, simulate);
|
// }
|
||||||
}
|
// return super.insertItem(remain, simulate);
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public ItemStack extractItem(int amount, boolean simulate) {
|
// @Override
|
||||||
for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
// public ItemStack extractItem(int amount, boolean simulate) {
|
||||||
if (handler.isLoaded()) {
|
// for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||||
if (handler.handler instanceof ISlotlessItemHandler) {
|
// if (handler.isLoaded()) {
|
||||||
ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
// if (handler.handler instanceof ISlotlessItemHandler) {
|
||||||
|
// ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
||||||
ItemStack would = slotless.extractItem(amount, true);
|
//
|
||||||
if (StackUtil.isValid(would)) {
|
// ItemStack would = slotless.extractItem(amount, true);
|
||||||
if (tile.isWhitelisted(handler, would, true)) {
|
// if (StackUtil.isValid(would)) {
|
||||||
ItemStack has;
|
// if (tile.isWhitelisted(handler, would, true)) {
|
||||||
if (simulate) {
|
// ItemStack has;
|
||||||
has = would;
|
// if (simulate) {
|
||||||
} else {
|
// has = would;
|
||||||
has = slotless.extractItem(amount, false);
|
// } else {
|
||||||
}
|
// has = slotless.extractItem(amount, false);
|
||||||
|
// }
|
||||||
if (StackUtil.isValid(has) && !simulate) {
|
//
|
||||||
tile.markDirty();
|
// if (StackUtil.isValid(has) && !simulate) {
|
||||||
tile.doItemParticle(has, tile.connectedRelay.getPos(), handler.relayInQuestion.getPos());
|
// tile.markDirty();
|
||||||
}
|
// tile.doItemParticle(has, tile.connectedRelay.getPos(), handler.relayInQuestion.getPos());
|
||||||
|
// }
|
||||||
return has;
|
//
|
||||||
}
|
// return has;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return super.extractItem(amount, simulate);
|
// }
|
||||||
}
|
// return super.extractItem(amount, simulate);
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public ItemStack extractItem(ItemStack matchStack, int matchFlags, boolean simulate) {
|
// @Override
|
||||||
for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
// public ItemStack extractItem(ItemStack matchStack, int matchFlags, boolean simulate) {
|
||||||
if (handler.isLoaded()) {
|
// for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||||
if (handler.handler instanceof ISlotlessItemHandler) {
|
// if (handler.isLoaded()) {
|
||||||
ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
// if (handler.handler instanceof ISlotlessItemHandler) {
|
||||||
|
// ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
||||||
ItemStack would = slotless.extractItem(matchStack, matchFlags, true);
|
//
|
||||||
if (StackUtil.isValid(would)) {
|
// ItemStack would = slotless.extractItem(matchStack, matchFlags, true);
|
||||||
if (tile.isWhitelisted(handler, would, true)) {
|
// if (StackUtil.isValid(would)) {
|
||||||
if (simulate) {
|
// if (tile.isWhitelisted(handler, would, true)) {
|
||||||
return would;
|
// if (simulate) {
|
||||||
} else {
|
// return would;
|
||||||
return slotless.extractItem(matchStack, matchFlags, false);
|
// } else {
|
||||||
}
|
// return slotless.extractItem(matchStack, matchFlags, false);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return super.extractItem(matchStack, matchFlags, simulate);
|
// }
|
||||||
}
|
// return super.extractItem(matchStack, matchFlags, simulate);
|
||||||
};
|
// }
|
||||||
}
|
// };
|
||||||
|
// }
|
||||||
}
|
//
|
||||||
|
//}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
package de.ellpeck.actuallyadditions.common.util.compat;
|
package de.ellpeck.actuallyadditions.common.util.compat;
|
||||||
|
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
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.fml.relauncher.Side;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import shadows.fastbench.gui.ContainerFastBench;
|
import shadows.fastbench.gui.ContainerFastBench;
|
||||||
import shadows.fastbench.gui.GuiFastBench;
|
import shadows.fastbench.gui.GuiFastBench;
|
||||||
|
|
||||||
public class CompatFastBench {
|
public class CompatFastBench {
|
||||||
|
|
||||||
public static Container getFastBenchContainer(EntityPlayer p, World world) {
|
public static Container getFastBenchContainer(PlayerEntity p, World world) {
|
||||||
return new ContainerFastBench(p, world, BlockPos.ORIGIN) {
|
return new ContainerFastBench(0, p, world, BlockPos.ZERO) {
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static Gui getFastBenchGui(EntityPlayer p, World world) {
|
public static Screen getFastBenchGui(PlayerEntity p, World world) {
|
||||||
return new GuiFastBench(p.inventory, world, BlockPos.ORIGIN);
|
return new GuiFastBench(p.inventory, world, BlockPos.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue