API compiles
This commit is contained in:
@@ -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