Work on GUIs (specifically to get SkyChest GUI)

This commit is contained in:
Sebastian Hartte
2020-06-02 02:14:09 +02:00
parent 271e8889a1
commit 9f63859769
109 changed files with 1133 additions and 1301 deletions
@@ -19,18 +19,23 @@
package appeng.items.misc;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import appeng.api.util.AEColor;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class ItemPaintBall extends AEBaseItem
{
private static final ITextComponent LUMEN_PREFIX = new TranslationTextComponent(GuiText.Lumen.getTranslationKey())
.appendText(" ");
private static final int DAMAGE_THRESHOLD = 20;
public ItemPaintBall()
@@ -39,14 +44,21 @@ public class ItemPaintBall extends AEBaseItem
}
@Override
public String getItemStackDisplayName( final ItemStack is )
public ITextComponent getDisplayName(final ItemStack is )
{
return super.getItemStackDisplayName( is ) + " - " + this.getExtraName( is );
// FIXME: in the new system, we should have different items for the colors,
// FIXME: Making this function fully redundant
return super.getDisplayName( is ).shallowCopy().appendText(" - ").appendSibling(this.getExtraName( is ));
}
private String getExtraName( final ItemStack is )
private ITextComponent getExtraName( final ItemStack is )
{
return ( is.getDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
ITextComponent colorText = new TranslationTextComponent(this.getColor(is).translationKey);
if (is.getDamage() >= DAMAGE_THRESHOLD) {
return LUMEN_PREFIX.shallowCopy().appendSibling(colorText);
} else {
return colorText;
}
}
public AEColor getColor( final ItemStack is )
@@ -66,8 +78,8 @@ public class ItemPaintBall extends AEBaseItem
}
@Override
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks) {
for( final AEColor c : AEColor.values() )
{
if( c != AEColor.TRANSPARENT )
@@ -41,6 +41,7 @@ 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.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.registries.ForgeRegistries;
@@ -76,14 +77,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public String getItemStackDisplayName( final ItemStack is )
{
public ITextComponent getDisplayName(ItemStack is) {
try
{
final ItemStack in = this.getTextureItem( is );
if( !in.isEmpty() )
{
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
return super.getDisplayName( is ).shallowCopy().appendText(" - ").appendSibling(in.getDisplayName());
}
}
catch( final Throwable ignored )
@@ -91,7 +91,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
return super.getItemStackDisplayName( is );
return super.getDisplayName( is );
}
@Override
@@ -19,10 +19,11 @@
package appeng.items.storage;
import appeng.core.Api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
@@ -42,9 +43,10 @@ import appeng.util.prioritylist.PrecisePriorityList;
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{
public ItemViewCell()
{
this.setMaxStackSize( 1 );
super(new Item.Properties().maxStackSize(1));
}
public static IPartitionList<IAEItemStack> createFilter( final ItemStack[] list )
@@ -52,7 +52,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IItemGroup;
@@ -203,7 +202,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( selected != null && Platform.isClient() )
{
extra = Platform.gui_localize( selected.unlocalizedName );
extra = Platform.gui_localize( selected.translationKey);
}
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;