API compiles
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
@@ -52,8 +52,8 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack,
|
||||
ItemStack newStack) {
|
||||
public void onChangeInventory(ItemTransferable inv, int slot, InvOperation mc, ItemStack removedStack,
|
||||
ItemStack newStack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,23 +68,23 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory {
|
||||
|
||||
private static class NetworkToolInventoryFilter implements IAEItemFilter {
|
||||
@Override
|
||||
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
|
||||
public boolean allowExtract(ItemTransferable inv, int slot, int amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
||||
public boolean allowInsert(ItemTransferable inv, int slot, ItemStack stack) {
|
||||
return stack.getItem() instanceof IUpgradeModule
|
||||
&& ((IUpgradeModule) stack.getItem()).getType(stack) != null;
|
||||
}
|
||||
}
|
||||
|
||||
public IItemHandler getInternalInventory() {
|
||||
public ItemTransferable getInternalInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInventory() {
|
||||
public ItemTransferable getInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,16 +32,16 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
@@ -71,9 +71,9 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
|
||||
this.materialType = materialType;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
super.addInformation(stack, world, lines, advancedTooltips);
|
||||
|
||||
@@ -86,9 +86,9 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
final Upgrades u = this.getType(stack);
|
||||
if (u != null) {
|
||||
final List<ITextComponent> textList = new ArrayList<>();
|
||||
final List<Text> textList = new ArrayList<>();
|
||||
for (final Entry<ItemStack, Integer> j : u.getSupported().entrySet()) {
|
||||
ITextComponent name = null;
|
||||
Text name = null;
|
||||
|
||||
final int limit = j.getValue();
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
|
||||
final IItemGroup ig = (IItemGroup) j.getKey().getItem();
|
||||
final String str = ig.getUnlocalizedGroupName(u.getSupported().keySet(), j.getKey());
|
||||
if (str != null) {
|
||||
name = new TranslationTextComponent(str).appendText(limit > 1 ? " (" + limit + ')' : "");
|
||||
name = new TranslatableText(str).appendText(limit > 1 ? " (" + limit + ')' : "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
|
||||
PlayerEntity player = context.getPlayer();
|
||||
Hand hand = context.getHand();
|
||||
if (player.isCrouching()) {
|
||||
final TileEntity te = context.getWorld().getTileEntity(context.getPos());
|
||||
IItemHandler upgrades = null;
|
||||
final BlockEntity te = context.getWorld().getTileEntity(context.getPos());
|
||||
ItemTransferable upgrades = null;
|
||||
|
||||
if (te instanceof IPartHost) {
|
||||
final SelectedPart sp = ((IPartHost) te).selectPart(context.getHitVec());
|
||||
@@ -229,7 +229,7 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class SlightlyBetterSort implements Comparator<ITextComponent> {
|
||||
private static class SlightlyBetterSort implements Comparator<Text> {
|
||||
private final Pattern pattern;
|
||||
|
||||
public SlightlyBetterSort(final Pattern pattern) {
|
||||
@@ -237,7 +237,7 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(final ITextComponent o1, final ITextComponent o2) {
|
||||
public int compare(final Text o1, final Text o2) {
|
||||
try {
|
||||
final Matcher a = this.pattern.matcher(o1.getString());
|
||||
final Matcher b = this.pattern.matcher(o2.getString());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Set;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AppEng;
|
||||
@@ -120,7 +120,7 @@ public enum MaterialType {
|
||||
FLUID_64K_CELL_COMPONENT("64k_fluid_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS));
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final ResourceLocation registryName;
|
||||
private final Identifier registryName;
|
||||
private Item itemInstance;
|
||||
// stack!
|
||||
private MaterialStackSrc stackSrc;
|
||||
@@ -130,7 +130,7 @@ public enum MaterialType {
|
||||
|
||||
MaterialType(String id, final Set<AEFeature> features) {
|
||||
this.features = features;
|
||||
this.registryName = new ResourceLocation(AppEng.MOD_ID, id);
|
||||
this.registryName = new Identifier(AppEng.MOD_ID, id);
|
||||
}
|
||||
|
||||
MaterialType(String id, final Set<AEFeature> features, final Class<? extends Entity> c) {
|
||||
@@ -198,7 +198,7 @@ public enum MaterialType {
|
||||
return registryName.getPath();
|
||||
}
|
||||
|
||||
public ResourceLocation getRegistryName() {
|
||||
public Identifier getRegistryName() {
|
||||
return this.registryName;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
@@ -32,14 +34,12 @@ import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.implementations.items.IGrowableCrystal;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
@@ -71,7 +71,7 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
|
||||
super(properties);
|
||||
this.grownItem = Preconditions.checkNotNull(grownItem);
|
||||
// Expose the growth of the seed to the model system
|
||||
addPropertyOverride(new ResourceLocation("appliedenergistics2:growth"),
|
||||
addPropertyOverride(new Identifier("appliedenergistics2:growth"),
|
||||
(is, w, p) -> getGrowthTicks(is) / (float) GROWTH_TICKS_REQUIRED);
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
lines.add(ButtonToolTips.DoesntDespawn.getTranslationKey());
|
||||
lines.add(getGrowthTooltipItem(stack));
|
||||
@@ -112,7 +112,7 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
|
||||
super.addInformation(stack, world, lines, advancedTooltips);
|
||||
}
|
||||
|
||||
public ITextComponent getGrowthTooltipItem(ItemStack stack) {
|
||||
public Text getGrowthTooltipItem(ItemStack stack) {
|
||||
final int progress = getGrowthTicks(stack);
|
||||
return new StringTextComponent(Math.round(100 * progress / (float) GROWTH_TICKS_REQUIRED) + "%");
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
@@ -92,8 +92,8 @@ public class EncodedPatternItem extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
final ICraftingPatternDetails details = this.getPatternForItem(stack, world);
|
||||
|
||||
@@ -106,11 +106,11 @@ public class EncodedPatternItem extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
InvalidPatternHelper invalid = new InvalidPatternHelper(stack);
|
||||
|
||||
final ITextComponent label = (invalid.isCraftable() ? GuiText.Crafts.textComponent()
|
||||
final Text label = (invalid.isCraftable() ? GuiText.Crafts.textComponent()
|
||||
: GuiText.Creates.textComponent()).appendText(": ");
|
||||
final ITextComponent and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent())
|
||||
final Text and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent())
|
||||
.appendText(" ");
|
||||
final ITextComponent with = GuiText.With.textComponent().appendText(": ");
|
||||
final Text with = GuiText.With.textComponent().appendText(": ");
|
||||
|
||||
boolean first = true;
|
||||
for (final InvalidPatternHelper.PatternIngredient output : invalid.getOutputs()) {
|
||||
@@ -125,8 +125,8 @@ public class EncodedPatternItem extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
if (invalid.isCraftable()) {
|
||||
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
|
||||
final ITextComponent canSubstitute = invalid.canSubstitute() ? GuiText.Yes.textComponent()
|
||||
final Text substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
|
||||
final Text canSubstitute = invalid.canSubstitute() ? GuiText.Yes.textComponent()
|
||||
: GuiText.No.textComponent();
|
||||
|
||||
lines.add(substitutionLabel.appendSibling(canSubstitute));
|
||||
@@ -145,11 +145,11 @@ public class EncodedPatternItem extends AEBaseItem implements ICraftingPatternIt
|
||||
final IAEItemStack[] in = details.getCondensedInputs();
|
||||
final IAEItemStack[] out = details.getCondensedOutputs();
|
||||
|
||||
final ITextComponent label = (isCrafting ? GuiText.Crafts.textComponent() : GuiText.Creates.textComponent())
|
||||
final Text label = (isCrafting ? GuiText.Crafts.textComponent() : GuiText.Creates.textComponent())
|
||||
.appendText(": ");
|
||||
final ITextComponent and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent())
|
||||
final Text and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent())
|
||||
.appendText(" ");
|
||||
final ITextComponent with = GuiText.With.textComponent().appendText(": ");
|
||||
final Text with = GuiText.With.textComponent().appendText(": ");
|
||||
|
||||
boolean first = true;
|
||||
for (final IAEItemStack anOut : out) {
|
||||
@@ -174,8 +174,8 @@ public class EncodedPatternItem extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
if (isCrafting) {
|
||||
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
|
||||
final ITextComponent canSubstitute = substitute ? GuiText.Yes.textComponent() : GuiText.No.textComponent();
|
||||
final Text substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
|
||||
final Text canSubstitute = substitute ? GuiText.Yes.textComponent() : GuiText.No.textComponent();
|
||||
|
||||
lines.add(substitutionLabel.appendSibling(canSubstitute));
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.EmptyBlockReader;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
/**
|
||||
* Block tag used to explicitly whitelist blocks for use in facades.
|
||||
*/
|
||||
private static final ResourceLocation TAG_WHITELISTED = new ResourceLocation(AppEng.MOD_ID, "whitelisted/facades");
|
||||
private static final Identifier TAG_WHITELISTED = new Identifier(AppEng.MOD_ID, "whitelisted/facades");
|
||||
|
||||
private static final String NBT_ITEM_ID = "item";
|
||||
|
||||
@@ -68,7 +68,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(ItemStack is) {
|
||||
public Text getDisplayName(ItemStack is) {
|
||||
try {
|
||||
final ItemStack in = this.getTextureItem(is);
|
||||
if (!in.isEmpty()) {
|
||||
@@ -142,7 +142,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ResourceLocation itemId = new ResourceLocation(nbt.getString(NBT_ITEM_ID));
|
||||
Identifier itemId = new Identifier(nbt.getString(NBT_ITEM_ID));
|
||||
Item baseItem = ForgeRegistries.ITEMS.getValue(itemId);
|
||||
|
||||
if (baseItem == null) {
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
@@ -39,7 +39,7 @@ public class PartItemRendering extends ItemRenderingCustomizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void customize(IItemRendering rendering) {
|
||||
rendering.color(new StaticItemColor(color));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.core.AELog;
|
||||
@@ -20,8 +20,8 @@ import appeng.core.AELog;
|
||||
*/
|
||||
class PartModelsHelper {
|
||||
|
||||
static List<ResourceLocation> createModels(Class<?> clazz) {
|
||||
List<ResourceLocation> locations = new ArrayList<>();
|
||||
static List<Identifier> createModels(Class<?> clazz) {
|
||||
List<Identifier> locations = new ArrayList<>();
|
||||
|
||||
// Check all static fields for used models
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
@@ -70,7 +70,7 @@ class PartModelsHelper {
|
||||
|
||||
// Make sure we can handle the return type
|
||||
Class<?> returnType = method.getReturnType();
|
||||
if (!ResourceLocation.class.isAssignableFrom(returnType)
|
||||
if (!Identifier.class.isAssignableFrom(returnType)
|
||||
&& !Collection.class.isAssignableFrom(returnType)) {
|
||||
AELog.error(
|
||||
"The @PartModels annotation can only be used on static methods that return a ResourceLocation or Collection of "
|
||||
@@ -97,13 +97,13 @@ class PartModelsHelper {
|
||||
return locations;
|
||||
}
|
||||
|
||||
private static void convertAndAddLocation(Object source, Object value, List<ResourceLocation> locations) {
|
||||
private static void convertAndAddLocation(Object source, Object value, List<Identifier> locations) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value instanceof ResourceLocation) {
|
||||
locations.add((ResourceLocation) value);
|
||||
if (value instanceof Identifier) {
|
||||
locations.add((Identifier) value);
|
||||
} else if (value instanceof IPartModel) {
|
||||
locations.addAll(((IPartModel) value).getModels());
|
||||
} else if (value instanceof Collection) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -208,7 +208,7 @@ public enum PartType {
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
private final Set<ResourceLocation> models;
|
||||
private final Set<Identifier> models;
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c) {
|
||||
this.features = Collections.unmodifiableSet(features);
|
||||
@@ -233,7 +233,7 @@ public enum PartType {
|
||||
return this.integrations;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getModels() {
|
||||
public Set<Identifier> getModels() {
|
||||
return this.models;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ package appeng.items.storage;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -29,11 +31,9 @@ import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -71,9 +71,9 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
this.component = whichCell;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
AEApi.instance().client().addCellInformation(
|
||||
AEApi.instance().registries().cell().getCellInventory(stack, null, this.getChannel()), lines);
|
||||
@@ -115,12 +115,12 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getUpgradesInventory(final ItemStack is) {
|
||||
public ItemTransferable getUpgradesInventory(final ItemStack is) {
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
}
|
||||
|
||||
// drop upgrades
|
||||
final IItemHandler upgradesInventory = this.getUpgradesInventory(stack);
|
||||
final ItemTransferable upgradesInventory = this.getUpgradesInventory(stack);
|
||||
for (int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSlots(); upgradeIndex++) {
|
||||
final ItemStack upgradeStack = upgradesInventory.getStackInSlot(upgradeIndex);
|
||||
final ItemStack leftStack = ia.addItems(upgradeStack);
|
||||
|
||||
@@ -20,13 +20,13 @@ package appeng.items.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -49,12 +49,12 @@ public class CreativeStorageCellItem extends AEBaseItem implements ICellWorkbenc
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getUpgradesInventory(final ItemStack is) {
|
||||
public ItemTransferable getUpgradesInventory(final ItemStack is) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ public class CreativeStorageCellItem extends AEBaseItem implements ICellWorkbenc
|
||||
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory(stack, null,
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
|
||||
@@ -20,18 +20,18 @@ package appeng.items.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.implementations.TransitionResult;
|
||||
import appeng.api.implementations.items.ISpatialStorageCell;
|
||||
@@ -53,9 +53,9 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
|
||||
this.maxRegion = spatialScale;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
final DimensionType dimType = this.getStoredDimension(stack);
|
||||
if (dimType == null) {
|
||||
@@ -87,7 +87,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
|
||||
final CompoundTag c = is.getTag();
|
||||
if (c != null && c.contains(TAG_DIMENSION_ID)) {
|
||||
try {
|
||||
ResourceLocation dimTypeId = new ResourceLocation(c.getString(TAG_DIMENSION_ID));
|
||||
Identifier dimTypeId = new Identifier(c.getString(TAG_DIMENSION_ID));
|
||||
return DimensionType.byName(dimTypeId);
|
||||
} catch (Exception e) {
|
||||
AELog.warn("Failed to retrieve storage cell dimension.", e);
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
package appeng.items.storage;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -59,8 +59,8 @@ public class ViewCellItem extends AEBaseItem implements ICellWorkbenchItem {
|
||||
.getStorageChannel(IItemStorageChannel.class).createList();
|
||||
|
||||
final ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();
|
||||
final IItemHandler upgrades = vc.getUpgradesInventory(currentViewCell);
|
||||
final IItemHandler config = vc.getConfigInventory(currentViewCell);
|
||||
final ItemTransferable upgrades = vc.getUpgradesInventory(currentViewCell);
|
||||
final ItemTransferable config = vc.getConfigInventory(currentViewCell);
|
||||
final FuzzyMode fzMode = vc.getFuzzyMode(currentViewCell);
|
||||
|
||||
boolean hasInverter = false;
|
||||
@@ -112,12 +112,12 @@ public class ViewCellItem extends AEBaseItem implements ICellWorkbenchItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getUpgradesInventory(final ItemStack is) {
|
||||
public ItemTransferable getUpgradesInventory(final ItemStack is) {
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
@@ -75,7 +75,7 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(final ItemStack is) {
|
||||
public Text getDisplayName(final ItemStack is) {
|
||||
final GameProfile username = this.getProfile(is);
|
||||
return username != null ? super.getDisplayName(is).appendText(" - " + username.getName())
|
||||
: super.getDisplayName(is);
|
||||
@@ -153,20 +153,20 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
final EnumSet<SecurityPermissions> perms = this.getPermissions(stack);
|
||||
if (perms.isEmpty()) {
|
||||
lines.add(new TranslationTextComponent(GuiText.NoPermissions.getLocal()));
|
||||
lines.add(new TranslatableText(GuiText.NoPermissions.getLocal()));
|
||||
} else {
|
||||
ITextComponent msg = null;
|
||||
Text msg = null;
|
||||
|
||||
for (final SecurityPermissions sp : perms) {
|
||||
if (msg == null) {
|
||||
msg = new TranslationTextComponent(sp.getTranslatedName());
|
||||
msg = new TranslatableText(sp.getTranslatedName());
|
||||
} else {
|
||||
msg = msg.appendText(", ").appendSibling(new TranslationTextComponent(sp.getTranslatedName()));
|
||||
msg = msg.appendText(", ").appendSibling(new TranslatableText(sp.getTranslatedName()));
|
||||
}
|
||||
}
|
||||
lines.add(msg);
|
||||
|
||||
@@ -20,23 +20,23 @@ package appeng.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
@@ -57,25 +57,25 @@ public class MemoryCardItem extends AEBaseItem implements IMemoryCard {
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
String firstLineKey = this.getFirstValidTranslationKey(this.getSettingsName(stack) + ".name",
|
||||
this.getSettingsName(stack));
|
||||
lines.add(new TranslationTextComponent(firstLineKey));
|
||||
lines.add(new TranslatableText(firstLineKey));
|
||||
|
||||
final CompoundTag data = this.getData(stack);
|
||||
if (data.contains("tooltip")) {
|
||||
String tooltipKey = getFirstValidTranslationKey(data.getString("tooltip") + ".name",
|
||||
data.getString("tooltip"));
|
||||
lines.add(new TranslationTextComponent(tooltipKey));
|
||||
lines.add(new TranslatableText(tooltipKey));
|
||||
}
|
||||
|
||||
if (data.contains("freq")) {
|
||||
final short freq = data.getShort("freq");
|
||||
final String freqTooltip = TextFormatting.BOLD + Platform.p2p().toHexString(freq);
|
||||
|
||||
lines.add(new TranslationTextComponent("gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip));
|
||||
lines.add(new TranslatableText("gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ package appeng.items.tools;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -67,16 +67,16 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
|
||||
if (pos == null) {
|
||||
return new NetworkToolViewer(is, null);
|
||||
}
|
||||
final TileEntity te = world.getTileEntity(pos);
|
||||
final BlockEntity te = world.getTileEntity(pos);
|
||||
return new NetworkToolViewer(is, (IGridHost) (te instanceof IGridHost ? te : null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final Hand hand) {
|
||||
if (Platform.isClient()) {
|
||||
final RayTraceResult mop = AppEng.proxy.getRTR();
|
||||
final HitResult mop = AppEng.proxy.getRTR();
|
||||
|
||||
if (mop == null || mop.getType() == RayTraceResult.Type.MISS) {
|
||||
if (mop == null || mop.getType() == HitResult.Type.MISS) {
|
||||
NetworkHandler.instance().sendToServer(new ClickPacket(hand));
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
|
||||
public ActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
final BlockRayTraceResult mop = new BlockRayTraceResult(context.getHitVec(), context.getFace(),
|
||||
context.getPos(), context.isInside());
|
||||
final TileEntity te = context.getWorld().getTileEntity(context.getPos());
|
||||
final BlockEntity te = context.getWorld().getTileEntity(context.getPos());
|
||||
|
||||
if (te instanceof IPartHost) {
|
||||
final SelectedPart part = ((IPartHost) te).selectPart(mop.getHitVec());
|
||||
@@ -129,7 +129,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
|
||||
|
||||
final BlockState bs = w.getBlockState(pos);
|
||||
if (!p.isCrouching()) {
|
||||
final TileEntity te = w.getTileEntity(pos);
|
||||
final BlockEntity te = w.getTileEntity(pos);
|
||||
if (!(te instanceof IGridHost)) {
|
||||
if (bs.rotate(w, pos, Rotation.CLOCKWISE_90) != bs) {
|
||||
bs.neighborChanged(w, pos, Blocks.AIR, pos, false);
|
||||
@@ -144,7 +144,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
|
||||
return true;
|
||||
}
|
||||
|
||||
final TileEntity te = w.getTileEntity(pos);
|
||||
final BlockEntity te = w.getTileEntity(pos);
|
||||
|
||||
if (te instanceof IGridHost) {
|
||||
ContainerOpener.openContainer(NetworkStatusContainer.TYPE, p,
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -43,7 +43,7 @@ public class ChargedStaffItem extends AEBasePoweredItem {
|
||||
this.extractAEPower(item, 300, Actionable.MODULATE);
|
||||
if (Platform.isServer()) {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
final AxisAlignedBB entityBoundingBox = target.getBoundingBox();
|
||||
final Box entityBoundingBox = target.getBoundingBox();
|
||||
final float dx = (float) (Platform.getRandomFloat() * target.getWidth() + entityBoundingBox.minX);
|
||||
final float dy = (float) (Platform.getRandomFloat() * target.getHeight() + entityBoundingBox.minY);
|
||||
final float dz = (float) (Platform.getRandomFloat() * target.getWidth() + entityBoundingBox.minZ);
|
||||
|
||||
@@ -22,10 +22,13 @@ import java.util.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -36,18 +39,15 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -82,29 +82,29 @@ import appeng.util.item.AEItemStack;
|
||||
public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
implements IStorageCell<IAEItemStack>, IItemGroup, IBlockTool, IMouseWheelItem {
|
||||
|
||||
private static final Map<ResourceLocation, AEColor> TAG_TO_COLOR = ImmutableMap.<ResourceLocation, AEColor>builder()
|
||||
.put(new ResourceLocation("forge:dyes/black"), AEColor.BLACK)
|
||||
.put(new ResourceLocation("forge:dyes/blue"), AEColor.BLUE)
|
||||
.put(new ResourceLocation("forge:dyes/brown"), AEColor.BROWN)
|
||||
.put(new ResourceLocation("forge:dyes/cyan"), AEColor.CYAN)
|
||||
.put(new ResourceLocation("forge:dyes/gray"), AEColor.GRAY)
|
||||
.put(new ResourceLocation("forge:dyes/green"), AEColor.GREEN)
|
||||
.put(new ResourceLocation("forge:dyes/light_blue"), AEColor.LIGHT_BLUE)
|
||||
.put(new ResourceLocation("forge:dyes/light_gray"), AEColor.LIGHT_GRAY)
|
||||
.put(new ResourceLocation("forge:dyes/lime"), AEColor.LIME)
|
||||
.put(new ResourceLocation("forge:dyes/magenta"), AEColor.MAGENTA)
|
||||
.put(new ResourceLocation("forge:dyes/orange"), AEColor.ORANGE)
|
||||
.put(new ResourceLocation("forge:dyes/pink"), AEColor.PINK)
|
||||
.put(new ResourceLocation("forge:dyes/purple"), AEColor.PURPLE)
|
||||
.put(new ResourceLocation("forge:dyes/red"), AEColor.RED)
|
||||
.put(new ResourceLocation("forge:dyes/white"), AEColor.WHITE)
|
||||
.put(new ResourceLocation("forge:dyes/yellow"), AEColor.YELLOW).build();
|
||||
private static final Map<Identifier, AEColor> TAG_TO_COLOR = ImmutableMap.<Identifier, AEColor>builder()
|
||||
.put(new Identifier("forge:dyes/black"), AEColor.BLACK)
|
||||
.put(new Identifier("forge:dyes/blue"), AEColor.BLUE)
|
||||
.put(new Identifier("forge:dyes/brown"), AEColor.BROWN)
|
||||
.put(new Identifier("forge:dyes/cyan"), AEColor.CYAN)
|
||||
.put(new Identifier("forge:dyes/gray"), AEColor.GRAY)
|
||||
.put(new Identifier("forge:dyes/green"), AEColor.GREEN)
|
||||
.put(new Identifier("forge:dyes/light_blue"), AEColor.LIGHT_BLUE)
|
||||
.put(new Identifier("forge:dyes/light_gray"), AEColor.LIGHT_GRAY)
|
||||
.put(new Identifier("forge:dyes/lime"), AEColor.LIME)
|
||||
.put(new Identifier("forge:dyes/magenta"), AEColor.MAGENTA)
|
||||
.put(new Identifier("forge:dyes/orange"), AEColor.ORANGE)
|
||||
.put(new Identifier("forge:dyes/pink"), AEColor.PINK)
|
||||
.put(new Identifier("forge:dyes/purple"), AEColor.PURPLE)
|
||||
.put(new Identifier("forge:dyes/red"), AEColor.RED)
|
||||
.put(new Identifier("forge:dyes/white"), AEColor.WHITE)
|
||||
.put(new Identifier("forge:dyes/yellow"), AEColor.YELLOW).build();
|
||||
|
||||
private static final String TAG_COLOR = "color";
|
||||
|
||||
public ColorApplicatorItem(Item.Properties props) {
|
||||
super(AEConfig.instance().getColorApplicatorBattery(), props);
|
||||
addPropertyOverride(new ResourceLocation(AppEng.MOD_ID, "colored"), (itemStack, world, entity) -> {
|
||||
addPropertyOverride(new Identifier(AppEng.MOD_ID, "colored"), (itemStack, world, entity) -> {
|
||||
// If the stack has no color, don't use the colored model since the impact of
|
||||
// calling getColor for every quad is extremely high, if the stack tries to
|
||||
// re-search its
|
||||
@@ -148,7 +148,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
|
||||
final double powerPerUse = 100;
|
||||
if (!paintBall.isEmpty() && paintBall.getItem() instanceof SnowballItem) {
|
||||
final TileEntity te = w.getTileEntity(pos);
|
||||
final BlockEntity te = w.getTileEntity(pos);
|
||||
// clean cables.
|
||||
if (te instanceof IColorableTile && p != null) {
|
||||
if (this.getAECurrentPower(is) > powerPerUse
|
||||
@@ -164,7 +164,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
|
||||
// clean paint balls..
|
||||
final Block testBlk = w.getBlockState(pos.offset(side)).getBlock();
|
||||
final TileEntity painted = w.getTileEntity(pos.offset(side));
|
||||
final BlockEntity painted = w.getTileEntity(pos.offset(side));
|
||||
if (this.getAECurrentPower(is) > powerPerUse && testBlk instanceof PaintSplotchesBlock
|
||||
&& painted instanceof PaintSplotchesTileEntity) {
|
||||
inv.extractItems(AEItemStack.fromItemStack(paintBall), Actionable.MODULATE, new BaseActionSource());
|
||||
@@ -194,13 +194,13 @@ public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(final ItemStack is) {
|
||||
ITextComponent extra = GuiText.Empty.textComponent();
|
||||
public Text getDisplayName(final ItemStack is) {
|
||||
Text extra = GuiText.Empty.textComponent();
|
||||
|
||||
final AEColor selected = this.getActiveColor(is);
|
||||
|
||||
if (selected != null && Platform.isClient()) {
|
||||
extra = new TranslationTextComponent(selected.translationKey);
|
||||
extra = new TranslatableText(selected.translationKey);
|
||||
}
|
||||
|
||||
return super.getDisplayName(is).appendText(" - ").appendSibling(extra);
|
||||
@@ -223,7 +223,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
final PaintBallItem ipb = (PaintBallItem) paintBall.getItem();
|
||||
return ipb.getColor();
|
||||
} else {
|
||||
for (Map.Entry<ResourceLocation, AEColor> entry : TAG_TO_COLOR.entrySet()) {
|
||||
for (Map.Entry<Identifier, AEColor> entry : TAG_TO_COLOR.entrySet()) {
|
||||
Tag<Item> tag = ItemTags.getCollection().get(entry.getKey());
|
||||
if (tag != null && paintBall.getItem().isIn(tag)) {
|
||||
return entry.getValue();
|
||||
@@ -355,8 +355,8 @@ public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
super.addInformation(stack, world, lines, advancedTooltips);
|
||||
|
||||
@@ -420,12 +420,12 @@ public class ColorApplicatorItem extends AEBasePoweredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getUpgradesInventory(final ItemStack is) {
|
||||
public ItemTransferable getUpgradesInventory(final ItemStack is) {
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
@@ -11,7 +11,7 @@ import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
public class ColorApplicatorItemRendering extends ItemRenderingCustomizer {
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void customize(IItemRendering rendering) {
|
||||
rendering.color(this::getColor);
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -203,9 +203,9 @@ public class EntropyManipulatorItem extends AEBasePoweredItem implements IBlockT
|
||||
// considered for onItemUse
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> onItemRightClick(final World w, final PlayerEntity p, final Hand hand) {
|
||||
final RayTraceResult target = rayTrace(w, p, RayTraceContext.FluidMode.ANY);
|
||||
final HitResult target = rayTrace(w, p, RayTraceContext.FluidMode.ANY);
|
||||
|
||||
if (target.getType() != RayTraceResult.Type.BLOCK) {
|
||||
if (target.getType() != HitResult.Type.BLOCK) {
|
||||
return new TypedActionResult<>(ActionResult.FAIL, p.getHeldItem(hand));
|
||||
} else {
|
||||
BlockPos pos = ((BlockRayTraceResult) target).getPos();
|
||||
|
||||
@@ -22,7 +22,10 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
@@ -31,25 +34,22 @@ import net.minecraft.entity.passive.SheepEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.EntityRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -92,9 +92,9 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
super(AEConfig.instance().getMatterCannonBattery(), props);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
super.addInformation(stack, world, lines, advancedTooltips);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
private void shootPaintBalls(final ItemStack type, final World w, final PlayerEntity p, final Vec3d Vec3d,
|
||||
final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2) {
|
||||
final AxisAlignedBB bb = new AxisAlignedBB(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
|
||||
final Box bb = new Box(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
|
||||
Math.min(Vec3d.z, Vec3d1.z), Math.max(Vec3d.x, Vec3d1.x), Math.max(Vec3d.y, Vec3d1.y),
|
||||
Math.max(Vec3d.z, Vec3d1.z)).grow(16, 16, 16);
|
||||
|
||||
@@ -197,7 +197,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
final float f1 = 0.3F;
|
||||
|
||||
final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow(f1, f1, f1);
|
||||
final Box boundingBox = entity1.getBoundingBox().grow(f1, f1, f1);
|
||||
final Vec3d intersection = boundingBox.rayTrace(Vec3d, Vec3d1).orElse(null);
|
||||
|
||||
if (intersection != null) {
|
||||
@@ -215,26 +215,26 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER,
|
||||
RayTraceContext.FluidMode.NONE, p);
|
||||
RayTraceResult pos = w.rayTraceBlocks(rayTraceContext);
|
||||
HitResult pos = w.rayTraceBlocks(rayTraceContext);
|
||||
|
||||
final Vec3d vec = new Vec3d(d0, d1, d2);
|
||||
if (entity != null && pos.getType() != RayTraceResult.Type.MISS
|
||||
if (entity != null && pos.getType() != HitResult.Type.MISS
|
||||
&& pos.getHitVec().squareDistanceTo(vec) > closest) {
|
||||
pos = new EntityRayTraceResult(entity, entityIntersection);
|
||||
} else if (entity != null && pos.getType() == RayTraceResult.Type.MISS) {
|
||||
} else if (entity != null && pos.getType() == HitResult.Type.MISS) {
|
||||
pos = new EntityRayTraceResult(entity, entityIntersection);
|
||||
}
|
||||
|
||||
try {
|
||||
AppEng.proxy.sendToAllNearExcept(null, d0, d1, d2, 128, w,
|
||||
new MatterCannonPacket(d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z,
|
||||
(byte) (pos.getType() == RayTraceResult.Type.MISS ? 32
|
||||
(byte) (pos.getType() == HitResult.Type.MISS ? 32
|
||||
: pos.getHitVec().squareDistanceTo(vec) + 1)));
|
||||
} catch (final Exception err) {
|
||||
AELog.debug(err);
|
||||
}
|
||||
|
||||
if (pos.getType() != RayTraceResult.Type.MISS && type != null && type.getItem() instanceof PaintBallItem) {
|
||||
if (pos.getType() != HitResult.Type.MISS && type != null && type.getItem() instanceof PaintBallItem) {
|
||||
final PaintBallItem ipb = (PaintBallItem) type.getItem();
|
||||
|
||||
final AEColor col = ipb.getColor();
|
||||
@@ -271,7 +271,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
});
|
||||
}
|
||||
|
||||
final TileEntity te = w.getTileEntity(hitPos);
|
||||
final BlockEntity te = w.getTileEntity(hitPos);
|
||||
if (te instanceof PaintSplotchesTileEntity) {
|
||||
final Vec3d hp = pos.getHitVec().subtract(hitPos.getX(), hitPos.getY(), hitPos.getZ());
|
||||
((PaintSplotchesTileEntity) te).addBlot(type, side.getOpposite(), hp);
|
||||
@@ -286,7 +286,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
while (penetration > 0 && hasDestroyed) {
|
||||
hasDestroyed = false;
|
||||
|
||||
final AxisAlignedBB bb = new AxisAlignedBB(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
|
||||
final Box bb = new Box(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
|
||||
Math.min(Vec3d.z, Vec3d1.z), Math.max(Vec3d.x, Vec3d1.x), Math.max(Vec3d.y, Vec3d1.y),
|
||||
Math.max(Vec3d.z, Vec3d1.z)).grow(16, 16, 16);
|
||||
|
||||
@@ -307,7 +307,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
final float f1 = 0.3F;
|
||||
|
||||
final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow(f1, f1, f1);
|
||||
final Box boundingBox = entity1.getBoundingBox().grow(f1, f1, f1);
|
||||
final Vec3d intersection = boundingBox.rayTrace(Vec3d, Vec3d1).orElse(null);
|
||||
|
||||
if (intersection != null) {
|
||||
@@ -326,24 +326,24 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER,
|
||||
RayTraceContext.FluidMode.NONE, p);
|
||||
final Vec3d vec = new Vec3d(d0, d1, d2);
|
||||
RayTraceResult pos = w.rayTraceBlocks(rayTraceContext);
|
||||
if (entity != null && pos.getType() != RayTraceResult.Type.MISS
|
||||
HitResult pos = w.rayTraceBlocks(rayTraceContext);
|
||||
if (entity != null && pos.getType() != HitResult.Type.MISS
|
||||
&& pos.getHitVec().squareDistanceTo(vec) > closest) {
|
||||
pos = new EntityRayTraceResult(entity, entityIntersection);
|
||||
} else if (entity != null && pos.getType() == RayTraceResult.Type.MISS) {
|
||||
} else if (entity != null && pos.getType() == HitResult.Type.MISS) {
|
||||
pos = new EntityRayTraceResult(entity, entityIntersection);
|
||||
}
|
||||
|
||||
try {
|
||||
AppEng.proxy.sendToAllNearExcept(null, d0, d1, d2, 128, w,
|
||||
new MatterCannonPacket(d0, d1, d2, (float) direction.x, (float) direction.y,
|
||||
(float) direction.z, (byte) (pos.getType() == RayTraceResult.Type.MISS ? 32
|
||||
(float) direction.z, (byte) (pos.getType() == HitResult.Type.MISS ? 32
|
||||
: pos.getHitVec().squareDistanceTo(vec) + 1)));
|
||||
} catch (final Exception err) {
|
||||
AELog.debug(err);
|
||||
}
|
||||
|
||||
if (pos.getType() != RayTraceResult.Type.MISS) {
|
||||
if (pos.getType() != HitResult.Type.MISS) {
|
||||
final DamageSource dmgSrc = new EntityDamageSource("matter_cannon", p);
|
||||
|
||||
if (pos instanceof EntityRayTraceResult) {
|
||||
@@ -398,12 +398,12 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getUpgradesInventory(final ItemStack is) {
|
||||
public ItemTransferable getUpgradesInventory(final ItemStack is) {
|
||||
return new CellUpgrades(is, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import alexiil.mc.lib.attributes.item.ItemTransferable;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -67,8 +67,8 @@ public class PortableCellItem extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
super.addInformation(stack, world, lines, advancedTooltips);
|
||||
|
||||
@@ -129,12 +129,12 @@ public class PortableCellItem extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getUpgradesInventory(final ItemStack is) {
|
||||
public ItemTransferable getUpgradesInventory(final ItemStack is) {
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
public ItemTransferable getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ package appeng.items.tools.powered;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -60,8 +60,8 @@ public class WirelessTerminalItem extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
super.addInformation(stack, world, lines, advancedTooltips);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class WirelessTerminalItem extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lines.add(new TranslationTextComponent("AppEng.GuiITooltip.Unlinked"));
|
||||
lines.add(new TranslatableText("AppEng.GuiITooltip.Unlinked"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,16 +22,16 @@ import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
@@ -53,9 +53,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
this.powerCapacity = powerCapacity;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
|
||||
public void addInformation(final ItemStack stack, final World world, final List<Text> lines,
|
||||
final ITooltipFlag advancedTooltips) {
|
||||
final CompoundTag tag = stack.getTag();
|
||||
double internalCurrentPower = 0;
|
||||
@@ -69,7 +69,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
lines.add(GuiText.StoredEnergy.textComponent()
|
||||
.appendText(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
|
||||
.appendSibling(new TranslationTextComponent(PowerUnits.AE.unlocalizedName))
|
||||
.appendSibling(new TranslatableText(PowerUnits.AE.unlocalizedName))
|
||||
.appendText(" - " + MessageFormat.format(" {0,number,#.##%} ", percent)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user