Moving to source sets

This commit is contained in:
Sebastian Hartte
2020-07-01 23:36:51 +02:00
parent f2e3d81fd7
commit 2642ced86b
2924 changed files with 794 additions and 796 deletions
@@ -1,159 +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.powered;
import java.util.List;
import java.util.Set;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.cells.ICellInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.MEPortableCellContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.items.contents.PortableCellViewer;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
public class PortableCellItem extends AEBasePoweredItem implements IStorageCell<IAEItemStack>, IGuiItem {
public PortableCellItem(Item.Settings props) {
super(AEConfig.instance().getPortableCellBattery(), props);
}
@Override
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));
}
@Override
@Environment(EnvType.CLIENT)
public void appendTooltip(final ItemStack stack, final World world, final List<Text> lines,
final TooltipContext advancedTooltips) {
super.appendTooltip(stack, world, lines, advancedTooltips);
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory(stack,
null, AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
AEApi.instance().client().addCellInformation(cdi, lines);
}
@Override
public int getBytes(final ItemStack cellItem) {
return 512;
}
@Override
public int getBytesPerType(final ItemStack cellItem) {
return 8;
}
@Override
public int getTotalTypes(final ItemStack cellItem) {
return 27;
}
@Override
public boolean isBlackListed(final ItemStack cellItem, final IAEItemStack requestedAddition) {
return false;
}
@Override
public boolean storableInStorageCell() {
return false;
}
@Override
public boolean isStorageCell(final ItemStack i) {
return true;
}
@Override
public double getIdleDrain() {
return 0.5;
}
@Override
public IStorageChannel<IAEItemStack> getChannel() {
return AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class);
}
@Override
public boolean isEditable(final ItemStack is) {
return true;
}
@Override
public FixedItemInv getUpgradesInventory(final ItemStack is) {
return new CellUpgrades(is, 2);
}
@Override
public FixedItemInv getConfigInventory(final ItemStack is) {
return new CellConfig(is);
}
@Override
public FuzzyMode getFuzzyMode(final ItemStack is) {
final String fz = is.getOrCreateTag().getString("FuzzyMode");
try {
return FuzzyMode.valueOf(fz);
} catch (final Throwable t) {
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode(final ItemStack is, final FuzzyMode fzMode) {
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
}
@Override
public IGuiItemObject getGuiObject(final ItemStack is, int playerInventorySlot, final World w, final BlockPos pos) {
return new PortableCellViewer(is, playerInventorySlot);
}
@Override
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
return slotChanged;
}
}