Utils ported

This commit is contained in:
Sebastian Hartte
2020-06-28 03:41:44 +02:00
parent 7c28a71e10
commit fee5b7fdfc
204 changed files with 1371 additions and 1737 deletions
@@ -26,7 +26,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.Formatting;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
@@ -63,7 +63,7 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
.format(myStack.getStackSize());
final String format = String.format(local, formattedAmount);
currentToolTip.add(TextFormatting.GRAY + format);
currentToolTip.add(Formatting.GRAY + format);
}
if (myStack.getCountRequestable() > 0) {
@@ -82,7 +82,7 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
final String format = String.format(local, formattedAmount);
currentToolTip.add(TextFormatting.GRAY + format);
currentToolTip.add(Formatting.GRAY + format);
this.renderTooltip(currentToolTip, x, y, this.font);
@@ -32,6 +32,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.Sprite;
import net.minecraft.util.Formatting;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
@@ -53,7 +54,6 @@ import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.text.Text;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -198,11 +198,11 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
lines = Lists.newArrayList(lines); // Make a copy
// Make the first line white
lines.set(0, TextFormatting.WHITE + lines.get(0));
lines.set(0, Formatting.WHITE + lines.get(0));
// All lines after the first are colored gray
for (int i = 1; i < lines.size(); i++) {
lines.set(i, TextFormatting.GRAY + lines.get(i));
lines.set(i, Formatting.GRAY + lines.get(i));
}
this.renderTooltip(lines, x, y, this.font);
@@ -504,7 +504,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
if (getPlayer().inventory.getItemStack().isEmpty() && theSlot != null) {
for (int j = 0; j < 9; ++j) {
if (getMinecraft().gameSettings.keyBindsHotbar[j].isActiveAndMatches(input)) {
if (getMinecraft().options.keyBindsHotbar[j].isActiveAndMatches(input)) {
final List<Slot> slots = this.getInventorySlots();
for (final Slot s : slots) {
if (s.getSlotIndex() == j && s.inventory == ((AEBaseContainer) this.container).getPlayerInv()) {
@@ -22,7 +22,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraftforge.fml.client.gui.GuiUtils;
import alexiil.mc.lib.attributes.item.ItemTransferable;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.config.ActionItems;
import appeng.api.config.CopyMode;
@@ -118,9 +118,9 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
this.copyMode.setState(this.container.getCopyMode() == CopyMode.CLEAR_ON_REMOVE);
boolean hasFuzzy = false;
final ItemTransferable inv = this.container.getCellUpgradeInventory();
for (int x = 0; x < inv.getSlots(); x++) {
final ItemStack is = inv.getStackInSlot(x);
final FixedItemInv inv = this.container.getCellUpgradeInventory();
for (int x = 0; x < inv.getSlotCount(); x++) {
final ItemStack is = inv.getInvStack(x);
if (!is.isEmpty() && is.getItem() instanceof IUpgradeModule) {
if (((IUpgradeModule) is.getItem()).getType(is) == Upgrades.FUZZY) {
hasFuzzy = true;
@@ -223,7 +223,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
for (int x = 0; x < current.getInventory().getSlots(); x++) {
final String which = Integer.toString(x);
if (invData.contains(which)) {
current.getInventory().setStackInSlot(x, ItemStack.read(invData.getCompound(which)));
current.getInventory().setStackInSlot(x, ItemStack.fromTag(invData.getCompound(which)));
}
}
} catch (final NumberFormatException ignored) {
@@ -319,7 +319,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
for (int i = 0; i < outTag.size(); i++) {
final ItemStack parsedItemStack = ItemStack.read(outTag.getCompound(i));
final ItemStack parsedItemStack = ItemStack.fromTag(outTag.getCompound(i));
if (!parsedItemStack.isEmpty()) {
final String displayName = Platform.getItemDisplayName(AEApi.instance().storage()
.getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack)).getString()