Added Quartz Tools and Quartz Knife Recipes
This commit is contained in:
@@ -57,7 +57,7 @@ public class EncodedPatternItem extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity player, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity player, final Hand hand) {
|
||||
this.clearPattern(player.getStackInHand(hand), player);
|
||||
|
||||
return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand));
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World world, final PlayerEntity player, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World world, final PlayerEntity player, final Hand hand) {
|
||||
this.disassembleDrive(player.getStackInHand(hand), world, player);
|
||||
return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand));
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity p, final Hand hand) {
|
||||
if (p.isInSneakingPose()) {
|
||||
this.encode(p.getStackInHand(hand), p);
|
||||
p.swingArm(hand);
|
||||
p.swingHand(hand);
|
||||
return TypedActionResult.resultSuccess(p.getStackInHand(hand));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
|
||||
is = player.getStackInHand(hand);
|
||||
}
|
||||
this.encode(is, (PlayerEntity) target);
|
||||
player.swingArm(hand);
|
||||
player.swingHand(hand);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -173,14 +173,14 @@ public class MemoryCardItem extends AEBaseItem implements IMemoryCard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(World w, PlayerEntity player, Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(World w, PlayerEntity player, Hand hand) {
|
||||
if (player.isInSneakingPose()) {
|
||||
if (!w.isClient) {
|
||||
this.clearCard(player, w, hand);
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick(w, player, hand);
|
||||
return super.use(w, player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,7 +72,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity p, final Hand hand) {
|
||||
if (Platform.isClient()) {
|
||||
final HitResult mop = AppEng.proxy.getRTR();
|
||||
|
||||
@@ -133,7 +133,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
|
||||
if (!(te instanceof IGridHost)) {
|
||||
if (bs.rotate(w, pos, Rotation.CLOCKWISE_90) != bs) {
|
||||
bs.neighborUpdate(w, pos, Blocks.AIR, pos, false);
|
||||
p.swingArm(hand);
|
||||
p.swingHand(hand);
|
||||
return !w.isClient;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class EntropyManipulatorItem extends AEBasePoweredItem implements IBlockT
|
||||
// Overridden to allow use of the item on WATER and LAVA which are otherwise not
|
||||
// considered for onItemUse
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity p, final Hand hand) {
|
||||
final HitResult target = rayTrace(w, p, RayTraceContext.FluidHandling.ANY);
|
||||
|
||||
if (target.getType() != HitResult.Type.BLOCK) {
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final @Nullable Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity p, final @Nullable Hand hand) {
|
||||
if (this.getAECurrentPower(p.getStackInHand(hand)) > ENERGY_PER_SHOT) {
|
||||
int shots = 1;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PortableCellItem extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity player, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity player, final Hand hand) {
|
||||
ContainerOpener.openContainer(MEPortableCellContainer.TYPE, player, ContainerLocator.forHand(player, hand));
|
||||
return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class WirelessTerminalItem extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity player, final Hand hand) {
|
||||
public TypedActionResult<ItemStack> use(final World w, final PlayerEntity player, final Hand hand) {
|
||||
AEApi.instance().registries().wireless().openWirelessTerminalGui(player.getStackInHand(hand), w, player, hand);
|
||||
return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand));
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzAxeItem extends AxeItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public QuartzAxeItem(Item.Settings props, final AEFeature type) {
|
||||
super(ItemTier.IRON, 6.0F, -3.1F, props);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.QuartzKnifeContainer;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzCuttingKnifeItem extends AEBaseItem implements IGuiItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public QuartzCuttingKnifeItem(Item.Settings props, final AEFeature type) {
|
||||
super(props);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onItemUse(ItemUsageContext context) {
|
||||
PlayerEntity player = context.getPlayer();
|
||||
if (Platform.isServer() && player != null) {
|
||||
ContainerOpener.openContainer(QuartzKnifeContainer.TYPE, context.getPlayer(),
|
||||
ContainerLocator.forItemUseContext(context));
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final Hand hand) {
|
||||
if (Platform.isServer()) {
|
||||
ContainerOpener.openContainer(QuartzKnifeContainer.TYPE, p, ContainerLocator.forHand(p, hand));
|
||||
}
|
||||
p.swingArm(hand);
|
||||
return new TypedActionResult<>(ActionResult.SUCCESS, p.getStackInHand(hand));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeRemainder(final ItemStack itemStack) {
|
||||
ItemStack copy = itemStack.copy();
|
||||
copy.setDamage(itemStack.getDamage() + 1);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRecipeRemainder(final ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject(final ItemStack is, int playerInventorySlot, final World world,
|
||||
final BlockPos pos) {
|
||||
return new QuartzKnifeObj(is);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzHoeItem extends HoeItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public QuartzHoeItem(Item.Settings props, final AEFeature type) {
|
||||
super(ItemTier.IRON, -1.0F, props);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzPickaxeItem extends PickaxeItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public QuartzPickaxeItem(Item.Settings props, final AEFeature type) {
|
||||
super(ItemTier.IRON, 1, -2.8F, props);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.ShovelItem;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzSpadeItem extends ShovelItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public QuartzSpadeItem(Item.Settings props, final AEFeature type) {
|
||||
super(ItemTier.IRON, 1.5F, -3.0F, props);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.SwordItem;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzSwordItem extends SwordItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public QuartzSwordItem(Item.Settings props, AEFeature type) {
|
||||
super(ItemTier.IRON, 3, -2.4F, props);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class QuartzWrenchItem extends AEBaseItem implements IAEWrench {
|
||||
|
||||
public QuartzWrenchItem(Item.Settings props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onItemUseFirst(ItemStack stack, ItemUsageContext context) {
|
||||
if (!context.getPlayer().isInSneakingPose() && Platform
|
||||
.hasPermissions(new DimensionalCoord(context.getWorld(), context.getBlockPos()), context.getPlayer())) {
|
||||
|
||||
Block block = context.getWorld().getBlockState(context.getBlockPos()).getBlock();
|
||||
if (block instanceof AEBaseBlock) {
|
||||
if (Platform.isClient()) {
|
||||
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server.
|
||||
// Fix that in all Block#onItemUseFirst overrides.
|
||||
return !context.getWorld().isClient ? ActionResult.SUCCESS : ActionResult.PASS;
|
||||
}
|
||||
|
||||
AEBaseBlock aeBlock = (AEBaseBlock) block;
|
||||
if (aeBlock.rotateAroundFaceAxis(context.getWorld(), context.getBlockPos(), context.getFace())) {
|
||||
context.getPlayer().swingArm(context.getHand());
|
||||
return !context.getWorld().isClient ? ActionResult.SUCCESS : ActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench(final ItemStack wrench, final PlayerEntity player, final BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user