pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ColoredPartItem<T extends IPart> extends ItemPart<T> {
|
||||
|
||||
|
||||
@@ -18,21 +18,18 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
|
||||
|
||||
/**
|
||||
* Handles rendering customization for facade items. Please note that this works very differently
|
||||
* from actually rendering a Facade in a cable bus.
|
||||
* Handles rendering customization for facade items. Please note that this works
|
||||
* very differently from actually rendering a Facade in a cable bus.
|
||||
*/
|
||||
public class FacadeRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
@Override
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
// This actually just uses the path it will look for by default, no custom model redirection needed
|
||||
// FIXME rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
|
||||
}
|
||||
public class FacadeRendering extends ItemRenderingCustomizer {
|
||||
@Override
|
||||
public void customize(IItemRendering rendering) {
|
||||
// This actually just uses the path it will look for by default, no custom model
|
||||
// redirection needed
|
||||
// FIXME rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,16 +18,15 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
@@ -47,277 +46,232 @@ import appeng.facade.FacadePart;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassItem {
|
||||
|
||||
public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassItem
|
||||
{
|
||||
private static final String TAG_ITEM_ID = "item";
|
||||
|
||||
private static final String TAG_ITEM_ID = "item";
|
||||
private List<ItemStack> subTypes = null;
|
||||
|
||||
private List<ItemStack> subTypes = null;
|
||||
public ItemFacade(Properties properties) {
|
||||
super(properties);
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
}
|
||||
|
||||
public ItemFacade(Properties properties) {
|
||||
super(properties);
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
}
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
return AEApi.instance().partHelper().placeBus(stack, context.getPos(), context.getFace(), context.getPlayer(),
|
||||
context.getHand(), context.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( ItemStack stack, ItemUseContext context )
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( stack, context.getPos(), context.getFace(), context.getPlayer(), context.getHand(), context.getWorld() );
|
||||
}
|
||||
@Override
|
||||
public ITextComponent getDisplayName(ItemStack is) {
|
||||
try {
|
||||
final ItemStack in = this.getTextureItem(is);
|
||||
if (!in.isEmpty()) {
|
||||
return super.getDisplayName(is).deepCopy().appendText(" - ").appendSibling(in.getDisplayName());
|
||||
}
|
||||
} catch (final Throwable ignored) {
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName(ItemStack is) {
|
||||
try
|
||||
{
|
||||
final ItemStack in = this.getTextureItem( is );
|
||||
if( !in.isEmpty() )
|
||||
{
|
||||
return super.getDisplayName( is ).deepCopy().appendText(" - ").appendSibling(in.getDisplayName());
|
||||
}
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
return super.getDisplayName(is);
|
||||
}
|
||||
|
||||
return super.getDisplayName( is );
|
||||
}
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
this.calculateSubTypes();
|
||||
items.addAll(this.subTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
this.calculateSubTypes();
|
||||
items.addAll( this.subTypes );
|
||||
}
|
||||
private void calculateSubTypes() {
|
||||
if (this.subTypes == null) {
|
||||
this.subTypes = new ArrayList<>(1000);
|
||||
for (final Block b : ForgeRegistries.BLOCKS) {
|
||||
try {
|
||||
final Item item = Item.getItemFromBlock(b);
|
||||
if (item == Items.AIR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
private void calculateSubTypes()
|
||||
{
|
||||
if( this.subTypes == null )
|
||||
{
|
||||
this.subTypes = new ArrayList<>( 1000 );
|
||||
for( final Block b : ForgeRegistries.BLOCKS )
|
||||
{
|
||||
try
|
||||
{
|
||||
final Item item = Item.getItemFromBlock( b );
|
||||
if( item == Items.AIR )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Item blockItem = b.asItem();
|
||||
if (blockItem != null && blockItem.getGroup() != null) {
|
||||
final NonNullList<ItemStack> tmpList = NonNullList.create();
|
||||
b.fillItemGroup(blockItem.getGroup(), tmpList);
|
||||
for (final ItemStack l : tmpList) {
|
||||
final ItemStack facade = this.createFacadeForItem(l, false);
|
||||
if (!facade.isEmpty()) {
|
||||
this.subTypes.add(facade);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
// just absorb..
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item blockItem = b.asItem();
|
||||
if (blockItem != null && blockItem.getGroup() != null) {
|
||||
final NonNullList<ItemStack> tmpList = NonNullList.create();
|
||||
b.fillItemGroup(blockItem.getGroup(), tmpList);
|
||||
for (final ItemStack l : tmpList) {
|
||||
final ItemStack facade = this.createFacadeForItem(l, false);
|
||||
if (!facade.isEmpty()) {
|
||||
this.subTypes.add(facade);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
// just absorb..
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public ItemStack createFacadeForItem(final ItemStack itemStack, final boolean returnItem) {
|
||||
if (itemStack.isEmpty()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public ItemStack createFacadeForItem( final ItemStack itemStack, final boolean returnItem )
|
||||
{
|
||||
if( itemStack.isEmpty() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
final Block block = Block.getBlockFromItem(itemStack.getItem());
|
||||
if (block == Blocks.AIR || itemStack.hasTag()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final Block block = Block.getBlockFromItem( itemStack.getItem() );
|
||||
if( block == Blocks.AIR || itemStack.hasTag() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
final int metadata = 0; // FIXME itemStack.getItem().getMetadata( itemStack.getDamage() );
|
||||
|
||||
final int metadata = 0; // FIXME itemStack.getItem().getMetadata( itemStack.getDamage() );
|
||||
// Try to get the block state based on the item stack's meta. If this fails,
|
||||
// don't consider it for a facade
|
||||
// This for example fails for Pistons because they hardcoded an invalid meta
|
||||
// value in vanilla
|
||||
BlockState blockState;
|
||||
try {
|
||||
blockState = null; // FIXME block.getStateFromMeta( metadata );
|
||||
} catch (Exception e) {
|
||||
AELog.debug(e, "Cannot create a facade for " + block.getRegistryName());
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
// Try to get the block state based on the item stack's meta. If this fails, don't consider it for a facade
|
||||
// This for example fails for Pistons because they hardcoded an invalid meta value in vanilla
|
||||
BlockState blockState;
|
||||
try
|
||||
{
|
||||
blockState = null; // FIXME block.getStateFromMeta( metadata );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.debug( e, "Cannot create a facade for " + block.getRegistryName() );
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
final boolean areTileEntitiesEnabled = FacadeConfig.instance().allowTileEntityFacades();
|
||||
final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed(block, metadata);
|
||||
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
|
||||
|
||||
final boolean areTileEntitiesEnabled = FacadeConfig.instance().allowTileEntityFacades();
|
||||
final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed( block, metadata );
|
||||
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
|
||||
final BlockState defaultState = block.getDefaultState();
|
||||
final boolean isTileEntity = block.hasTileEntity(defaultState);
|
||||
final boolean isFullCube = true; // FIXME defaultState.isFullCube( defaultState );
|
||||
|
||||
final BlockState defaultState = block.getDefaultState();
|
||||
final boolean isTileEntity = block.hasTileEntity( defaultState );
|
||||
final boolean isFullCube = true; // FIXME defaultState.isFullCube( defaultState );
|
||||
final boolean isTileEntityAllowed = !isTileEntity || (areTileEntitiesEnabled && isWhiteListed);
|
||||
final boolean isBlockAllowed = isFullCube || isWhiteListed;
|
||||
|
||||
final boolean isTileEntityAllowed = !isTileEntity || ( areTileEntitiesEnabled && isWhiteListed );
|
||||
final boolean isBlockAllowed = isFullCube || isWhiteListed;
|
||||
if (isModel && isTileEntityAllowed && isBlockAllowed) {
|
||||
if (returnItem) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
if( isModel && isTileEntityAllowed && isBlockAllowed )
|
||||
{
|
||||
if( returnItem )
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
final ItemStack is = new ItemStack(this);
|
||||
final CompoundNBT data = new CompoundNBT();
|
||||
data.putString(TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString());
|
||||
is.setTag(data);
|
||||
return is;
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final ItemStack is = new ItemStack( this );
|
||||
final CompoundNBT data = new CompoundNBT();
|
||||
data.putString(TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString());
|
||||
is.setTag( data );
|
||||
return is;
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@Override
|
||||
public FacadePart createPartFromItemStack(final ItemStack is, final AEPartLocation side) {
|
||||
final ItemStack in = this.getTextureItem(is);
|
||||
if (!in.isEmpty()) {
|
||||
return new FacadePart(is, side);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FacadePart createPartFromItemStack( final ItemStack is, final AEPartLocation side )
|
||||
{
|
||||
final ItemStack in = this.getTextureItem( is );
|
||||
if( !in.isEmpty() )
|
||||
{
|
||||
return new FacadePart( is, side );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getTextureItem(ItemStack is) {
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
{
|
||||
CompoundNBT nbt = is.getTag();
|
||||
|
||||
CompoundNBT nbt = is.getTag();
|
||||
if (nbt == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if( nbt == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
ResourceLocation itemId;
|
||||
|
||||
ResourceLocation itemId;
|
||||
// Handle legacy facades
|
||||
if (nbt.contains("x")) {
|
||||
int[] data = nbt.getIntArray("x");
|
||||
if (data.length != 2) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
// Handle legacy facades
|
||||
if( nbt.contains("x") )
|
||||
{
|
||||
int[] data = nbt.getIntArray( "x" );
|
||||
if( data.length != 2 )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
Item item = Registry.ITEM.getByValue(data[0]);
|
||||
if (item == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
Item item = Registry.ITEM.getByValue( data[0] );
|
||||
if( item == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
itemId = item.getRegistryName();
|
||||
} else {
|
||||
// First item is numeric item id
|
||||
itemId = new ResourceLocation(nbt.getString(TAG_ITEM_ID));
|
||||
}
|
||||
|
||||
itemId = item.getRegistryName();
|
||||
}
|
||||
else
|
||||
{
|
||||
// First item is numeric item id
|
||||
itemId = new ResourceLocation( nbt.getString( TAG_ITEM_ID ) );
|
||||
}
|
||||
Item baseItem = ForgeRegistries.ITEMS.getValue(itemId);
|
||||
|
||||
Item baseItem = ForgeRegistries.ITEMS.getValue( itemId );
|
||||
if (baseItem == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if( baseItem == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return new ItemStack(baseItem, 1);
|
||||
}
|
||||
|
||||
return new ItemStack( baseItem, 1 );
|
||||
}
|
||||
@Override
|
||||
public BlockState getTextureBlockState(ItemStack is) {
|
||||
|
||||
@Override
|
||||
public BlockState getTextureBlockState( ItemStack is )
|
||||
{
|
||||
ItemStack baseItemStack = this.getTextureItem(is);
|
||||
|
||||
ItemStack baseItemStack = this.getTextureItem( is );
|
||||
if (baseItemStack.isEmpty()) {
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
if( baseItemStack.isEmpty() )
|
||||
{
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
Block block = Block.getBlockFromItem(baseItemStack.getItem());
|
||||
|
||||
Block block = Block.getBlockFromItem( baseItemStack.getItem() );
|
||||
if (block == Blocks.AIR) {
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
if( block == Blocks.AIR )
|
||||
{
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
int metadata = 0; // FIXME baseItemStack.getItem().getMetadata( baseItemStack );
|
||||
|
||||
int metadata = 0; // FIXME baseItemStack.getItem().getMetadata( baseItemStack );
|
||||
try {
|
||||
return null; // FIXME block.getStateFromMeta( metadata );
|
||||
} catch (Exception e) {
|
||||
AELog.warn("Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(),
|
||||
baseItemStack.getDamage());
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return null; // FIXME block.getStateFromMeta( metadata );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getDamage() );
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
}
|
||||
public List<ItemStack> getFacades() {
|
||||
this.calculateSubTypes();
|
||||
return this.subTypes;
|
||||
}
|
||||
|
||||
public List<ItemStack> getFacades()
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
return this.subTypes;
|
||||
}
|
||||
public ItemStack getCreativeTabIcon() {
|
||||
this.calculateSubTypes();
|
||||
if (this.subTypes.isEmpty()) {
|
||||
return new ItemStack(Items.CAKE);
|
||||
}
|
||||
return this.subTypes.get(0);
|
||||
}
|
||||
|
||||
public ItemStack getCreativeTabIcon()
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
if( this.subTypes.isEmpty() )
|
||||
{
|
||||
return new ItemStack( Items.CAKE );
|
||||
}
|
||||
return this.subTypes.get( 0 );
|
||||
}
|
||||
public ItemStack createFromID(final int id) {
|
||||
ItemStack facadeStack = AEApi.instance().definitions().items().facade().maybeStack(1).orElseThrow(
|
||||
() -> new MissingDefinitionException("Tried to create a facade, while facades are being deactivated."));
|
||||
|
||||
public ItemStack createFromID( final int id )
|
||||
{
|
||||
ItemStack facadeStack = AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.facade()
|
||||
.maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to create a facade, while facades are being deactivated." ) );
|
||||
// Convert back to a registry name...
|
||||
Item item = Registry.ITEM.getByValue(id);
|
||||
if (item == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
// Convert back to a registry name...
|
||||
Item item = Registry.ITEM.getByValue( id );
|
||||
if( item == null )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
final CompoundNBT facadeTag = new CompoundNBT();
|
||||
facadeTag.putString(TAG_ITEM_ID, item.getRegistryName().toString());
|
||||
facadeStack.setTag(facadeTag);
|
||||
|
||||
final CompoundNBT facadeTag = new CompoundNBT();
|
||||
facadeTag.putString(TAG_ITEM_ID, item.getRegistryName().toString());
|
||||
facadeStack.setTag( facadeTag );
|
||||
return facadeStack;
|
||||
}
|
||||
|
||||
return facadeStack;
|
||||
}
|
||||
@Override
|
||||
public boolean useAlphaPass(final ItemStack is) {
|
||||
BlockState blockState = this.getTextureBlockState(is);
|
||||
|
||||
@Override
|
||||
public boolean useAlphaPass( final ItemStack is )
|
||||
{
|
||||
BlockState blockState = this.getTextureBlockState( is );
|
||||
if (blockState == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if( blockState == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RenderTypeLookup.canRenderInLayer( blockState, RenderType.getTranslucent() )
|
||||
|| RenderTypeLookup.canRenderInLayer( blockState, RenderType.getTranslucentNoCrumbling() );
|
||||
}
|
||||
return RenderTypeLookup.canRenderInLayer(blockState, RenderType.getTranslucent())
|
||||
|| RenderTypeLookup.canRenderInLayer(blockState, RenderType.getTranslucentNoCrumbling());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,24 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
@@ -28,127 +46,99 @@ import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T>, IItemGroup {
|
||||
private final PartType type;
|
||||
|
||||
private final Function<ItemStack, T> factory;
|
||||
|
||||
public class ItemPart<T extends IPart> extends AEBaseItem implements IPartItem<T>, IItemGroup
|
||||
{
|
||||
private final PartType type;
|
||||
public ItemPart(Properties properties, PartType type, Function<ItemStack, T> factory) {
|
||||
super(properties);
|
||||
this.type = type;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
private final Function<ItemStack, T> factory;
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context) {
|
||||
PlayerEntity player = context.getPlayer();
|
||||
ItemStack held = player.getHeldItem(context.getHand());
|
||||
if (held.getItem() != this) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
public ItemPart(Properties properties, PartType type, Function<ItemStack, T> factory) {
|
||||
super(properties);
|
||||
this.type = type;
|
||||
this.factory = factory;
|
||||
}
|
||||
return AEApi.instance().partHelper().placeBus(held, context.getPos(), context.getFace(), player,
|
||||
context.getHand(), context.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse( ItemUseContext context )
|
||||
{
|
||||
PlayerEntity player = context.getPlayer();
|
||||
ItemStack held = player.getHeldItem( context.getHand() );
|
||||
if( held.getItem() != this )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
public PartType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
return AEApi.instance().partHelper().placeBus( held, context.getPos(), context.getFace(), player, context.getHand(), context.getWorld() );
|
||||
}
|
||||
@Override
|
||||
public T createPart(ItemStack is) {
|
||||
return factory.apply(is);
|
||||
}
|
||||
|
||||
public PartType getType() {
|
||||
return type;
|
||||
}
|
||||
private static PartType getTypeByStack(ItemStack is) {
|
||||
if (is.getItem() instanceof ItemPart) {
|
||||
return ((ItemPart<?>) is.getItem()).getType();
|
||||
}
|
||||
return PartType.INVALID_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T createPart(ItemStack is) {
|
||||
return factory.apply(is);
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnlocalizedGroupName(final Set<ItemStack> others, final ItemStack is) {
|
||||
boolean importBus = false;
|
||||
boolean importBusFluids = false;
|
||||
boolean exportBus = false;
|
||||
boolean exportBusFluids = false;
|
||||
boolean group = false;
|
||||
|
||||
private static PartType getTypeByStack(ItemStack is) {
|
||||
if (is.getItem() instanceof ItemPart) {
|
||||
return ((ItemPart<?>) is.getItem()).getType();
|
||||
}
|
||||
return PartType.INVALID_TYPE;
|
||||
}
|
||||
final PartType u = getTypeByStack(is);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
boolean importBus = false;
|
||||
boolean importBusFluids = false;
|
||||
boolean exportBus = false;
|
||||
boolean exportBusFluids = false;
|
||||
boolean group = false;
|
||||
for (final ItemStack stack : others) {
|
||||
if (stack.getItem() == this) {
|
||||
final PartType pt = getTypeByStack(stack);
|
||||
switch (pt) {
|
||||
case IMPORT_BUS:
|
||||
importBus = true;
|
||||
if (u == pt) {
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
case FLUID_IMPORT_BUS:
|
||||
importBusFluids = true;
|
||||
if (u == pt) {
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
case EXPORT_BUS:
|
||||
exportBus = true;
|
||||
if (u == pt) {
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
case FLUID_EXPORT_BUS:
|
||||
exportBusFluids = true;
|
||||
if (u == pt) {
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final PartType u = getTypeByStack( is );
|
||||
if (group && importBus && exportBus && (u == PartType.IMPORT_BUS || u == PartType.EXPORT_BUS)) {
|
||||
return GuiText.IOBuses.getTranslationKey();
|
||||
}
|
||||
if (group && importBusFluids && exportBusFluids
|
||||
&& (u == PartType.FLUID_IMPORT_BUS || u == PartType.FLUID_EXPORT_BUS)) {
|
||||
return GuiText.IOBusesFluids.getTranslationKey();
|
||||
}
|
||||
|
||||
for( final ItemStack stack : others )
|
||||
{
|
||||
if( stack.getItem() == this )
|
||||
{
|
||||
final PartType pt = getTypeByStack( stack );
|
||||
switch( pt )
|
||||
{
|
||||
case IMPORT_BUS:
|
||||
importBus = true;
|
||||
if( u == pt )
|
||||
{
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
case FLUID_IMPORT_BUS:
|
||||
importBusFluids = true;
|
||||
if( u == pt )
|
||||
{
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
case EXPORT_BUS:
|
||||
exportBus = true;
|
||||
if( u == pt )
|
||||
{
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
case FLUID_EXPORT_BUS:
|
||||
exportBusFluids = true;
|
||||
if( u == pt )
|
||||
{
|
||||
group = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( group && importBus && exportBus && ( u == PartType.IMPORT_BUS || u == PartType.EXPORT_BUS ) )
|
||||
{
|
||||
return GuiText.IOBuses.getTranslationKey();
|
||||
}
|
||||
if( group && importBusFluids && exportBusFluids && ( u == PartType.FLUID_IMPORT_BUS || u == PartType.FLUID_EXPORT_BUS ) )
|
||||
{
|
||||
return GuiText.IOBusesFluids.getTranslationKey();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,32 +18,29 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.StaticItemColor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class ItemPartRendering extends ItemRenderingCustomizer {
|
||||
|
||||
public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
private final AEColor color;
|
||||
|
||||
private final AEColor color;
|
||||
public ItemPartRendering() {
|
||||
this.color = AEColor.TRANSPARENT;
|
||||
}
|
||||
|
||||
public ItemPartRendering() {
|
||||
this.color = AEColor.TRANSPARENT;
|
||||
}
|
||||
public ItemPartRendering(AEColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public ItemPartRendering(AEColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.color( new StaticItemColor(color) );
|
||||
}
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void customize(IItemRendering rendering) {
|
||||
rendering.color(new StaticItemColor(color));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,21 +18,17 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* This annotation is used to mark static fields or static methods that return/contain models used
|
||||
* for a part. They are automatically registered as part of the part item registration.
|
||||
* This annotation is used to mark static fields or static methods that
|
||||
* return/contain models used for a part. They are automatically registered as
|
||||
* part of the part item registration.
|
||||
*/
|
||||
@Retention( RetentionPolicy.RUNTIME )
|
||||
@Target( {
|
||||
ElementType.FIELD,
|
||||
ElementType.METHOD
|
||||
} )
|
||||
public @interface PartModels
|
||||
{}
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.FIELD, ElementType.METHOD })
|
||||
public @interface PartModels {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -15,130 +14,111 @@ import net.minecraft.util.ResourceLocation;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.core.AELog;
|
||||
|
||||
|
||||
/**
|
||||
* Helps with the reflection magic needed to gather all models for AE2 cable bus parts.
|
||||
* Helps with the reflection magic needed to gather all models for AE2 cable bus
|
||||
* parts.
|
||||
*/
|
||||
class PartModelsHelper
|
||||
{
|
||||
class PartModelsHelper {
|
||||
|
||||
static List<ResourceLocation> createModels( Class<?> clazz )
|
||||
{
|
||||
List<ResourceLocation> locations = new ArrayList<>();
|
||||
static List<ResourceLocation> createModels(Class<?> clazz) {
|
||||
List<ResourceLocation> locations = new ArrayList<>();
|
||||
|
||||
// Check all static fields for used models
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for( Field field : fields )
|
||||
{
|
||||
if( field.getAnnotation( PartModels.class ) == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Check all static fields for used models
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getAnnotation(PartModels.class) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !Modifier.isStatic( field.getModifiers() ) )
|
||||
{
|
||||
AELog.error( "The @PartModels annotation can only be used on static fields or methods. Was seen on: " + field );
|
||||
continue;
|
||||
}
|
||||
if (!Modifier.isStatic(field.getModifiers())) {
|
||||
AELog.error("The @PartModels annotation can only be used on static fields or methods. Was seen on: "
|
||||
+ field);
|
||||
continue;
|
||||
}
|
||||
|
||||
Object value;
|
||||
try
|
||||
{
|
||||
field.setAccessible( true );
|
||||
value = field.get( null );
|
||||
}
|
||||
catch( IllegalAccessException e )
|
||||
{
|
||||
AELog.error( e, "Cannot access field annotated with @PartModels: " + field );
|
||||
continue;
|
||||
}
|
||||
Object value;
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
value = field.get(null);
|
||||
} catch (IllegalAccessException e) {
|
||||
AELog.error(e, "Cannot access field annotated with @PartModels: " + field);
|
||||
continue;
|
||||
}
|
||||
|
||||
convertAndAddLocation( field, value, locations );
|
||||
}
|
||||
convertAndAddLocation(field, value, locations);
|
||||
}
|
||||
|
||||
// Check all static methods for the annotation
|
||||
for( Method method : clazz.getDeclaredMethods() )
|
||||
{
|
||||
if( method.getAnnotation( PartModels.class ) == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Check all static methods for the annotation
|
||||
for (Method method : clazz.getDeclaredMethods()) {
|
||||
if (method.getAnnotation(PartModels.class) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !Modifier.isStatic( method.getModifiers() ) )
|
||||
{
|
||||
AELog.error( "The @PartModels annotation can only be used on static fields or methods. Was seen on: " + method );
|
||||
continue;
|
||||
}
|
||||
if (!Modifier.isStatic(method.getModifiers())) {
|
||||
AELog.error("The @PartModels annotation can only be used on static fields or methods. Was seen on: "
|
||||
+ method);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for parameter count
|
||||
if( method.getParameters().length != 0 )
|
||||
{
|
||||
AELog.error( "The @PartModels annotation can only be used on static methods without parameters. Was seen on: " + method );
|
||||
continue;
|
||||
}
|
||||
// Check for parameter count
|
||||
if (method.getParameters().length != 0) {
|
||||
AELog.error(
|
||||
"The @PartModels annotation can only be used on static methods without parameters. Was seen on: "
|
||||
+ method);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make sure we can handle the return type
|
||||
Class<?> returnType = method.getReturnType();
|
||||
if( !ResourceLocation.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 " + "ResourceLocations. Was seen on: " + method );
|
||||
continue;
|
||||
}
|
||||
// Make sure we can handle the return type
|
||||
Class<?> returnType = method.getReturnType();
|
||||
if (!ResourceLocation.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 "
|
||||
+ "ResourceLocations. Was seen on: " + method);
|
||||
continue;
|
||||
}
|
||||
|
||||
Object value = null;
|
||||
try
|
||||
{
|
||||
method.setAccessible( true );
|
||||
value = method.invoke( null );
|
||||
}
|
||||
catch( IllegalAccessException | InvocationTargetException e )
|
||||
{
|
||||
AELog.error( e, "Failed to invoke the @PartModels annotated method " + method );
|
||||
continue;
|
||||
}
|
||||
Object value = null;
|
||||
try {
|
||||
method.setAccessible(true);
|
||||
value = method.invoke(null);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
AELog.error(e, "Failed to invoke the @PartModels annotated method " + method);
|
||||
continue;
|
||||
}
|
||||
|
||||
convertAndAddLocation( method, value, locations );
|
||||
}
|
||||
convertAndAddLocation(method, value, locations);
|
||||
}
|
||||
|
||||
if( clazz.getSuperclass() != null )
|
||||
{
|
||||
locations.addAll( createModels( clazz.getSuperclass() ) );
|
||||
}
|
||||
if (clazz.getSuperclass() != null) {
|
||||
locations.addAll(createModels(clazz.getSuperclass()));
|
||||
}
|
||||
|
||||
return locations;
|
||||
}
|
||||
return locations;
|
||||
}
|
||||
|
||||
private static void convertAndAddLocation( Object source, Object value, List<ResourceLocation> locations )
|
||||
{
|
||||
if( value == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
private static void convertAndAddLocation(Object source, Object value, List<ResourceLocation> locations) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( value instanceof ResourceLocation )
|
||||
{
|
||||
locations.add( (ResourceLocation) value );
|
||||
}
|
||||
else if( value instanceof IPartModel )
|
||||
{
|
||||
locations.addAll( ( (IPartModel) value ).getModels() );
|
||||
}
|
||||
else if( value instanceof Collection )
|
||||
{
|
||||
// Check that each object is an IPartModel
|
||||
Collection values = (Collection) value;
|
||||
for( Object candidate : values )
|
||||
{
|
||||
if( !( candidate instanceof IPartModel ) )
|
||||
{
|
||||
AELog.error( "List of locations obtained from {} contains a non resource location: {}", source, candidate );
|
||||
continue;
|
||||
}
|
||||
if (value instanceof ResourceLocation) {
|
||||
locations.add((ResourceLocation) value);
|
||||
} else if (value instanceof IPartModel) {
|
||||
locations.addAll(((IPartModel) value).getModels());
|
||||
} else if (value instanceof Collection) {
|
||||
// Check that each object is an IPartModel
|
||||
Collection values = (Collection) value;
|
||||
for (Object candidate : values) {
|
||||
if (!(candidate instanceof IPartModel)) {
|
||||
AELog.error("List of locations obtained from {} contains a non resource location: {}", source,
|
||||
candidate);
|
||||
continue;
|
||||
}
|
||||
|
||||
locations.addAll( ( (IPartModel) candidate ).getModels() );
|
||||
}
|
||||
}
|
||||
}
|
||||
locations.addAll(((IPartModel) candidate).getModels());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,21 +18,18 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.parts.p2p.*;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
@@ -50,6 +47,7 @@ import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCableCovered;
|
||||
import appeng.parts.networking.PartDenseCableSmart;
|
||||
import appeng.parts.networking.PartQuartzFiber;
|
||||
import appeng.parts.p2p.*;
|
||||
import appeng.parts.reporting.PartConversionMonitor;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartDarkPanel;
|
||||
@@ -60,187 +58,177 @@ import appeng.parts.reporting.PartSemiDarkPanel;
|
||||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
|
||||
public enum PartType {
|
||||
INVALID_TYPE(EnumSet.of(AEFeature.CORE), EnumSet.noneOf(IntegrationType.class), null),
|
||||
|
||||
public enum PartType
|
||||
{
|
||||
INVALID_TYPE(EnumSet.of( AEFeature.CORE ), EnumSet.noneOf( IntegrationType.class ), null ),
|
||||
CABLE_GLASS(EnumSet.of(AEFeature.GLASS_CABLES), EnumSet.noneOf(IntegrationType.class), PartCableGlass.class) {
|
||||
@Override
|
||||
public boolean isCable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_GLASS(EnumSet.of( AEFeature.GLASS_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
CABLE_COVERED(EnumSet.of(AEFeature.COVERED_CABLES), EnumSet.noneOf(IntegrationType.class), PartCableCovered.class) {
|
||||
@Override
|
||||
public boolean isCable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_COVERED(EnumSet.of( AEFeature.COVERED_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
CABLE_SMART(EnumSet.of(AEFeature.CHANNELS, AEFeature.SMART_CABLES), EnumSet.noneOf(IntegrationType.class),
|
||||
PartCableSmart.class) {
|
||||
@Override
|
||||
public boolean isCable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_SMART(EnumSet.of( AEFeature.CHANNELS, AEFeature.SMART_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
CABLE_DENSE_SMART(EnumSet.of(AEFeature.CHANNELS, AEFeature.DENSE_CABLES), EnumSet.noneOf(IntegrationType.class),
|
||||
PartDenseCableSmart.class) {
|
||||
@Override
|
||||
public boolean isCable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_DENSE_SMART(EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartDenseCableSmart.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
CABLE_DENSE_COVERED(EnumSet.of(AEFeature.CHANNELS, AEFeature.DENSE_CABLES), EnumSet.noneOf(IntegrationType.class),
|
||||
PartDenseCableCovered.class) {
|
||||
@Override
|
||||
public boolean isCable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_DENSE_COVERED(EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartDenseCableCovered.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
TOGGLE_BUS(EnumSet.of(AEFeature.TOGGLE_BUS), EnumSet.noneOf(IntegrationType.class), PartToggleBus.class),
|
||||
|
||||
TOGGLE_BUS(EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
|
||||
INVERTED_TOGGLE_BUS(EnumSet.of(AEFeature.TOGGLE_BUS), EnumSet.noneOf(IntegrationType.class),
|
||||
PartInvertedToggleBus.class),
|
||||
|
||||
INVERTED_TOGGLE_BUS(EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
|
||||
CABLE_ANCHOR(EnumSet.of(AEFeature.CABLE_ANCHOR), EnumSet.noneOf(IntegrationType.class), PartCableAnchor.class),
|
||||
|
||||
CABLE_ANCHOR(EnumSet.of( AEFeature.CABLE_ANCHOR ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
|
||||
QUARTZ_FIBER(EnumSet.of(AEFeature.QUARTZ_FIBER), EnumSet.noneOf(IntegrationType.class), PartQuartzFiber.class),
|
||||
|
||||
QUARTZ_FIBER(EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
MONITOR(EnumSet.of(AEFeature.PANELS), EnumSet.noneOf(IntegrationType.class), PartPanel.class),
|
||||
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class),
|
||||
SEMI_DARK_MONITOR(EnumSet.of(AEFeature.PANELS), EnumSet.noneOf(IntegrationType.class), PartSemiDarkPanel.class),
|
||||
|
||||
SEMI_DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class),
|
||||
DARK_MONITOR(EnumSet.of(AEFeature.PANELS), EnumSet.noneOf(IntegrationType.class), PartDarkPanel.class),
|
||||
|
||||
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.noneOf(IntegrationType.class),
|
||||
PartFluidStorageBus.class),
|
||||
|
||||
STORAGE_BUS(EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS(EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
|
||||
IMPORT_BUS(EnumSet.of(AEFeature.IMPORT_BUS), EnumSet.noneOf(IntegrationType.class), PartImportBus.class),
|
||||
|
||||
IMPORT_BUS(EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
|
||||
FLUID_IMPORT_BUS(EnumSet.of(AEFeature.FLUID_IMPORT_BUS), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidImportBus.class),
|
||||
|
||||
FLUID_IMPORT_BUS(EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
EXPORT_BUS(EnumSet.of(AEFeature.EXPORT_BUS), EnumSet.noneOf(IntegrationType.class), PartExportBus.class),
|
||||
|
||||
EXPORT_BUS(EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
|
||||
FLUID_EXPORT_BUS(EnumSet.of(AEFeature.FLUID_EXPORT_BUS), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidExportBus.class),
|
||||
|
||||
FLUID_EXPORT_BUS(EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
LEVEL_EMITTER(EnumSet.of(AEFeature.LEVEL_EMITTER), EnumSet.noneOf(IntegrationType.class), PartLevelEmitter.class),
|
||||
FLUID_LEVEL_EMITTER(EnumSet.of(AEFeature.FLUID_LEVEL_EMITTER), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidLevelEmitter.class),
|
||||
|
||||
LEVEL_EMITTER(EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER(EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
|
||||
ANNIHILATION_PLANE(EnumSet.of(AEFeature.ANNIHILATION_PLANE), EnumSet.noneOf(IntegrationType.class),
|
||||
PartAnnihilationPlane.class),
|
||||
|
||||
ANNIHILATION_PLANE(EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
|
||||
IDENTITY_ANNIHILATION_PLANE(EnumSet.of(AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE),
|
||||
EnumSet.noneOf(IntegrationType.class), PartIdentityAnnihilationPlane.class),
|
||||
|
||||
IDENTITY_ANNIHILATION_PLANE(EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
|
||||
FLUID_ANNIHILATION_PLANE(EnumSet.of(AEFeature.FLUID_ANNIHILATION_PLANE), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidAnnihilationPlane.class),
|
||||
|
||||
FLUID_ANNIHILATION_PLANE(EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
|
||||
FORMATION_PLANE(EnumSet.of(AEFeature.FORMATION_PLANE), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFormationPlane.class),
|
||||
|
||||
FORMATION_PLANE(EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
|
||||
FLUID_FORMATION_PLANE(EnumSet.of(AEFeature.FLUID_FORMATION_PLANE), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidFormationPlane.class),
|
||||
|
||||
FLUID_FORMATION_PLANE(EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
|
||||
PATTERN_TERMINAL(EnumSet.of(AEFeature.PATTERNS), EnumSet.noneOf(IntegrationType.class), PartPatternTerminal.class),
|
||||
|
||||
PATTERN_TERMINAL(EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
|
||||
CRAFTING_TERMINAL(EnumSet.of(AEFeature.CRAFTING_TERMINAL), EnumSet.noneOf(IntegrationType.class),
|
||||
PartCraftingTerminal.class),
|
||||
|
||||
CRAFTING_TERMINAL(EnumSet.of( AEFeature.CRAFTING_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartCraftingTerminal.class ),
|
||||
TERMINAL(EnumSet.of(AEFeature.TERMINAL), EnumSet.noneOf(IntegrationType.class), PartTerminal.class),
|
||||
|
||||
TERMINAL(EnumSet.of( AEFeature.TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
|
||||
STORAGE_MONITOR(EnumSet.of(AEFeature.STORAGE_MONITOR), EnumSet.noneOf(IntegrationType.class),
|
||||
PartStorageMonitor.class),
|
||||
|
||||
STORAGE_MONITOR(EnumSet.of( AEFeature.STORAGE_MONITOR ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
|
||||
CONVERSION_MONITOR(EnumSet.of(AEFeature.PART_CONVERSION_MONITOR), EnumSet.noneOf(IntegrationType.class),
|
||||
PartConversionMonitor.class),
|
||||
|
||||
CONVERSION_MONITOR(EnumSet.of( AEFeature.PART_CONVERSION_MONITOR ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
|
||||
INTERFACE(EnumSet.of(AEFeature.INTERFACE), EnumSet.noneOf(IntegrationType.class), PartInterface.class),
|
||||
FLUID_INTERFACE(EnumSet.of(AEFeature.FLUID_INTERFACE), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidInterface.class),
|
||||
|
||||
INTERFACE(EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
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),
|
||||
|
||||
P2P_TUNNEL_ME(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class),
|
||||
P2P_TUNNEL_REDSTONE(EnumSet.of(AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE),
|
||||
EnumSet.noneOf(IntegrationType.class), PartP2PRedstone.class),
|
||||
|
||||
P2P_TUNNEL_REDSTONE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class),
|
||||
P2P_TUNNEL_ITEM(EnumSet.of(AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS), EnumSet.noneOf(IntegrationType.class),
|
||||
PartP2PItems.class),
|
||||
|
||||
P2P_TUNNEL_ITEM(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class),
|
||||
|
||||
P2P_TUNNEL_FLUID(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class),
|
||||
P2P_TUNNEL_FLUID(EnumSet.of(AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS),
|
||||
EnumSet.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 ),
|
||||
|
||||
P2P_TUNNEL_LIGHT(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class),
|
||||
P2P_TUNNEL_LIGHT(EnumSet.of(AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT),
|
||||
EnumSet.noneOf(IntegrationType.class), PartP2PLight.class),
|
||||
|
||||
P2P_TUNNEL_FE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class),
|
||||
P2P_TUNNEL_FE(EnumSet.of(AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE), EnumSet.noneOf(IntegrationType.class),
|
||||
PartP2PFEPower.class),
|
||||
|
||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel,
|
||||
// AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel
|
||||
// ),
|
||||
|
||||
INTERFACE_TERMINAL(EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
|
||||
INTERFACE_TERMINAL(EnumSet.of(AEFeature.INTERFACE_TERMINAL), EnumSet.noneOf(IntegrationType.class),
|
||||
PartInterfaceTerminal.class),
|
||||
|
||||
FLUID_TERMINAL(EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
FLUID_TERMINAL(EnumSet.of(AEFeature.FLUID_TERMINAL), EnumSet.noneOf(IntegrationType.class),
|
||||
PartFluidTerminal.class);
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private final Set<ResourceLocation> models;
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private final Set<ResourceLocation> models;
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c)
|
||||
{
|
||||
this.features = Collections.unmodifiableSet( features );
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c) {
|
||||
this.features = Collections.unmodifiableSet(features);
|
||||
this.integrations = Collections.unmodifiableSet(integrations);
|
||||
|
||||
if( c != null )
|
||||
{
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
if (c != null) {
|
||||
this.models = new HashSet<>(PartModelsHelper.createModels(c));
|
||||
} else {
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean isCable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<AEFeature> getFeature()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
public Set<AEFeature> getFeature() {
|
||||
return this.features;
|
||||
}
|
||||
|
||||
Set<IntegrationType> getIntegrations()
|
||||
{
|
||||
return this.integrations;
|
||||
}
|
||||
Set<IntegrationType> getIntegrations() {
|
||||
return this.integrations;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getModels()
|
||||
{
|
||||
return this.models;
|
||||
}
|
||||
public Set<ResourceLocation> getModels() {
|
||||
return this.models;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum IntegrationType {}
|
||||
enum IntegrationType {
|
||||
}
|
||||
Reference in New Issue
Block a user