Renamed items, added back waila.
This commit is contained in:
@@ -48,20 +48,14 @@ import java.util.function.Function;
|
||||
|
||||
public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T>, IItemGroup
|
||||
{
|
||||
private static final int INITIAL_REGISTERED_CAPACITY = PartType.values().length;
|
||||
private static final Comparator<Entry<Integer, PartTypeWithVariant>> REGISTERED_COMPARATOR = new RegisteredComparator();
|
||||
|
||||
private final PartType type;
|
||||
|
||||
private final Function<ItemStack, T> factory;
|
||||
|
||||
private final Map<Integer, PartTypeWithVariant> registered;
|
||||
|
||||
public ItemPart(Properties properties, PartType type, Function<ItemStack, T> factory) {
|
||||
super(properties);
|
||||
this.type = type;
|
||||
this.factory = factory;
|
||||
this.registered = new HashMap<>( INITIAL_REGISTERED_CAPACITY );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,38 +71,6 @@ public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T
|
||||
return AEApi.instance().partHelper().placeBus( held, context.getPos(), context.getFace(), player, context.getHand(), context.getWorld() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
return "item.appliedenergistics2.multi_part." + this.getTypeByStack( is ).getTranslationKey().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(final ItemStack is )
|
||||
{
|
||||
final PartType pt = this.getTypeByStack( is );
|
||||
|
||||
if( pt.isCable() )
|
||||
{
|
||||
final AEColor[] variants = AEColor.values();
|
||||
|
||||
final int itemDamage = is.getDamage();
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling(new TranslationTextComponent(variants[registeredPartType.variant].translationKey));
|
||||
}
|
||||
}
|
||||
|
||||
if( pt.getExtraName() != null )
|
||||
{
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling(pt.getExtraName().textComponent());
|
||||
}
|
||||
|
||||
return super.getDisplayName( is );
|
||||
}
|
||||
|
||||
public PartType getType() {
|
||||
return type;
|
||||
}
|
||||
@@ -118,17 +80,6 @@ public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T
|
||||
return factory.apply(is);
|
||||
}
|
||||
|
||||
public int variantOf( final int itemDamage )
|
||||
{
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return registeredPartType.variant;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static PartType getTypeByStack(ItemStack is) {
|
||||
if (is.getItem() instanceof ItemPart) {
|
||||
return ((ItemPart<?>) is.getItem()).getType();
|
||||
@@ -200,43 +151,4 @@ public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final class PartTypeWithVariant
|
||||
{
|
||||
private final PartType part;
|
||||
private final int variant;
|
||||
|
||||
private PartTypeWithVariant( final PartType part, final int variant )
|
||||
{
|
||||
assert part != null;
|
||||
assert variant >= 0;
|
||||
|
||||
this.part = part;
|
||||
this.variant = variant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "PartTypeWithVariant{" + "part=" + this.part + ", variant=" + this.variant + '}';
|
||||
}
|
||||
}
|
||||
|
||||
private static final class RegisteredComparator implements Comparator<Entry<Integer, PartTypeWithVariant>>
|
||||
{
|
||||
@Override
|
||||
public int compare( final Entry<Integer, PartTypeWithVariant> o1, final Entry<Integer, PartTypeWithVariant> o2 )
|
||||
{
|
||||
final String string1 = o1.getValue().part.name();
|
||||
final String string2 = o2.getValue().part.name();
|
||||
final int comparedString = string1.compareTo( string2 );
|
||||
|
||||
if( comparedString == 0 )
|
||||
{
|
||||
return Integer.compare( o1.getKey(), o2.getKey() );
|
||||
}
|
||||
|
||||
return comparedString;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
@@ -122,12 +120,12 @@ public enum PartType
|
||||
|
||||
QUARTZ_FIBER(EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class, "itemIlluminatedPanel" ),
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class),
|
||||
|
||||
SEMI_DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class),
|
||||
|
||||
DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class),
|
||||
|
||||
STORAGE_BUS(EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS(EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
@@ -175,74 +173,25 @@ public enum PartType
|
||||
FLUID_INTERFACE(EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
|
||||
P2P_TUNNEL_ME(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class),
|
||||
|
||||
P2P_TUNNEL_REDSTONE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class),
|
||||
|
||||
P2P_TUNNEL_ITEM(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class),
|
||||
|
||||
P2P_TUNNEL_FLUID(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class),
|
||||
|
||||
//FIXME P2P_TUNNEL_IC2( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
|
||||
//FIXME .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||
//FIXME {
|
||||
//FIXME @Override
|
||||
//FIXME String getTranslationKey()
|
||||
//FIXME {
|
||||
//FIXME return "p2p_tunnel";
|
||||
//FIXME }
|
||||
//FIXME },
|
||||
//FIXME .of( IntegrationType.IC2 ), PartP2PIC2Power.class ),
|
||||
|
||||
P2P_TUNNEL_LIGHT(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class),
|
||||
|
||||
P2P_TUNNEL_FE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class),
|
||||
|
||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
@@ -254,32 +203,13 @@ public enum PartType
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
private final GuiText extraName;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private final Set<ResourceLocation> models;
|
||||
private final String oreName;
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c)
|
||||
{
|
||||
this(features, integrations, c, null, null );
|
||||
}
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final String oreDict)
|
||||
{
|
||||
this(features, integrations, c, null, oreDict );
|
||||
}
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en)
|
||||
{
|
||||
this(features, integrations, c, en, null );
|
||||
}
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en, final String oreDict)
|
||||
{
|
||||
this.features = Collections.unmodifiableSet( features );
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
this.extraName = en;
|
||||
this.oreName = oreDict;
|
||||
|
||||
if( c != null )
|
||||
{
|
||||
@@ -306,21 +236,6 @@ public enum PartType
|
||||
return this.integrations;
|
||||
}
|
||||
|
||||
String getTranslationKey()
|
||||
{
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
|
||||
GuiText getExtraName()
|
||||
{
|
||||
return this.extraName;
|
||||
}
|
||||
|
||||
public String getOreName()
|
||||
{
|
||||
return this.oreName;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getModels()
|
||||
{
|
||||
return this.models;
|
||||
|
||||
Reference in New Issue
Block a user