Fixes anchor rendering (#2698)

* Fixes #2680: Use a shorter cable anchor model when blocked by a facade.
* Fixes #2664: Prevent anchors from creating intersection.

Replaced the simple List<ResourceLocation> for the static models with a
new container also indicating a solid part, which can be used to prevent
the creation of an intersection.
This commit is contained in:
yueh 2016-12-14 22:37:10 +01:00 committed by GitHub
parent 8bed7f223e
commit a14cf2204d
74 changed files with 525 additions and 320 deletions

View File

@ -25,10 +25,11 @@ package appeng.api.parts;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nonnull;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@ -39,7 +40,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -71,7 +71,8 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
ItemStack getItemStack( PartItemStack type );
/**
* Render dynamic portions of this part, as part of the cable bus TESR. This part has to return true for {@link #requireDynamicRender()} in order for
* Render dynamic portions of this part, as part of the cable bus TESR. This part has to return true for
* {@link #requireDynamicRender()} in order for
* this method to be called.
*/
@SideOnly( Side.CLIENT )
@ -267,8 +268,10 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
boolean canBePlacedOn( BusSupport what );
/**
* This method is used when a chunk is rebuilt to determine how this part should be rendered. The returned models should represent the
* part oriented north. They will be automatically rotated to match the part's actual orientation. Tint indices 1-4 can be used in the
* This method is used when a chunk is rebuilt to determine how this part should be rendered. The returned models
* should represent the
* part oriented north. They will be automatically rotated to match the part's actual orientation. Tint indices 1-4
* can be used in the
* models to access the parts color.
*
* <dl>
@ -279,18 +282,23 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* <dt>Tint Index 3</dt>
* <dd>The {@link AEColor#whiteVariant bright variant color} of the cable that this part is attached to.</dd>
* <dt>Tint Index 4</dt>
* <dd>A color variant that is between the cable's {@link AEColor#mediumVariant color} and its {@link AEColor#whiteVariant bright variant}.</dd>
* <dd>A color variant that is between the cable's {@link AEColor#mediumVariant color} and its
* {@link AEColor#whiteVariant bright variant}.</dd>
* </dl>
*
* <b>Important:</b> All models must have been registered via the {@link IPartModels} API before use.
*/
default List<ResourceLocation> getStaticModels()
@Nonnull
default IPartModel getStaticModels()
{
return Collections.emptyList();
return new IPartModel()
{
};
}
/**
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be forwarded to parts on the appropriate
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
* forwarded to parts on the appropriate
* side.
*
* @see TileEntity#hasCapability(Capability, EnumFacing)
@ -303,7 +311,8 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
}
/**
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be forwarded to parts on the appropriate
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
* forwarded to parts on the appropriate
* side.
*
* @see TileEntity#getCapability(Capability, EnumFacing)

View File

@ -0,0 +1,65 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 - 2015 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.util.ResourceLocation;
/**
* A container to store a collection of {@link ResourceLocation} as models for a part as well as other properties.
*/
public interface IPartModel
{
/**
* A solid {@link IPartModel} indicates that the rendering requires a cable connection, which will also result in
* creating an intersection for the cable.
*
* This should be true for pretty much all parts.
*
* @return true for a solid part.
*/
default boolean requireCableConnection()
{
return true;
}
/**
* A collection of {@link ResourceLocation} used as models for a part.
*
* @return a collection of models, never null.
*/
@Nonnull
default List<ResourceLocation> getModels()
{
return Collections.emptyList();
}
}

View File

@ -31,10 +31,8 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;

View File

@ -22,6 +22,7 @@ package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.ImmutablePair;

View File

@ -22,6 +22,7 @@ package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.Block;

View File

@ -21,6 +21,7 @@ package appeng.block.networking;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.properties.IProperty;

View File

@ -4,6 +4,7 @@ package appeng.block.paint;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Function;

View File

@ -4,6 +4,7 @@ package appeng.block.qnb;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.base.Function;

View File

@ -26,6 +26,7 @@ import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import net.minecraft.block.Block;

View File

@ -54,7 +54,6 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiScrollbar;

View File

@ -22,6 +22,7 @@ package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;

View File

@ -21,6 +21,7 @@ package appeng.client.render;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;

View File

@ -22,6 +22,7 @@ package appeng.client.render;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;

View File

@ -25,6 +25,8 @@ import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@ -41,6 +43,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.block.networking.BlockCableBus;
@ -81,8 +84,9 @@ public class CableBusBakedModel implements IBakedModel
List<BakedQuad> quads = new ArrayList<>();
// The core parts of the cable will only be rendered in the CUTOUT layer. TRANSLUCENT is used only for translucent facades further down below.
if ( layer == BlockRenderLayer.CUTOUT )
// The core parts of the cable will only be rendered in the CUTOUT layer. TRANSLUCENT is used only for
// translucent facades further down below.
if( layer == BlockRenderLayer.CUTOUT )
{
// First, handle the cable at the center of the cable bus
addCableQuads( renderState, quads );
@ -90,13 +94,13 @@ public class CableBusBakedModel implements IBakedModel
// Then handle attachments
for( EnumFacing facing : EnumFacing.values() )
{
List<ResourceLocation> models = renderState.getAttachments().get( facing );
if( models == null )
final IPartModel partModel = renderState.getAttachments().get( facing );
if( partModel == null )
{
continue;
}
for( ResourceLocation model : models )
for( ResourceLocation model : partModel.getModels() )
{
IBakedModel bakedModel = partModels.get( model );
@ -122,8 +126,7 @@ public class CableBusBakedModel implements IBakedModel
renderState.getBoundingBoxes(),
renderState.getAttachments().keySet(),
rand,
quads
);
quads );
return quads;
}
@ -131,25 +134,30 @@ public class CableBusBakedModel implements IBakedModel
// Determines whether a cable is connected to exactly two sides that are opposite each other
private static boolean isStraightLine( AECableType cableType, EnumMap<EnumFacing, AECableType> sides )
{
Iterator<EnumFacing> it = sides.keySet().iterator();
final Iterator<Entry<EnumFacing, AECableType>> it = sides.entrySet().iterator();
if( !it.hasNext() )
{
return false; // No connections
}
EnumFacing firstSide = it.next();
AECableType firstType = sides.get( firstSide );
final Entry<EnumFacing, AECableType> nextConnection = it.next();
final EnumFacing firstSide = nextConnection.getKey();
final AECableType firstType = nextConnection.getValue();
if( !it.hasNext() )
{
return false; // Only a single connection
}
if( firstSide.getOpposite() != it.next() )
if( firstSide.getOpposite() != it.next().getKey() )
{
return false; // Connected to two sides that are not opposite each other
}
if (it.hasNext()) {
if( it.hasNext() )
{
return false; // Must not have any other connection points
}
AECableType secondType = sides.get( firstSide.getOpposite() );
final AECableType secondType = sides.get( firstSide.getOpposite() );
// Certain cable types have restrictions on when they're rendered as a straight connection
switch( cableType )
@ -176,8 +184,8 @@ public class CableBusBakedModel implements IBakedModel
// If the connection is straight, no busses are attached, and no covered core has been forced (in case of glass
// cables), then render the cable as a simplified straight line.
boolean noAttachments = renderState.getAttachments().isEmpty();
if( isStraightLine( cableType, connectionTypes ) && noAttachments )
boolean noAttachments = !renderState.getAttachments().values().stream().anyMatch( IPartModel::requireCableConnection );
if( noAttachments && isStraightLine( cableType, connectionTypes ) )
{
EnumFacing facing = connectionTypes.keySet().iterator().next();
@ -227,11 +235,12 @@ public class CableBusBakedModel implements IBakedModel
}
// Render all outgoing connections using the appropriate type
for( EnumFacing facing : connectionTypes.keySet() )
for( final Entry<EnumFacing, AECableType> connection : connectionTypes.entrySet() )
{
AECableType connectionType = connectionTypes.get( facing );
boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
int channels = renderState.getChannelsOnSide().get( facing );
final EnumFacing facing = connection.getKey();
final AECableType connectionType = connection.getValue();
final boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
final int channels = renderState.getChannelsOnSide().get( facing );
switch( cableType )
{
@ -269,9 +278,9 @@ public class CableBusBakedModel implements IBakedModel
// If no core is present, just use the first part that comes into play
for( EnumFacing side : renderState.getAttachments().keySet() )
{
List<ResourceLocation> models = renderState.getAttachments().get( side );
IPartModel partModel = renderState.getAttachments().get( side );
for( ResourceLocation model : models )
for( ResourceLocation model : partModel.getModels() )
{
IBakedModel bakedModel = partModels.get( model );
@ -282,9 +291,11 @@ public class CableBusBakedModel implements IBakedModel
TextureAtlasSprite particleTexture = bakedModel.getParticleTexture();
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't add it,
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't
// add
// it,
// so we don't get ugly missing texture break particles.
if ( textureMap.getMissingSprite() != particleTexture )
if( textureMap.getMissingSprite() != particleTexture )
{
result.add( particleTexture );
}

View File

@ -25,9 +25,9 @@ import java.util.EnumSet;
import java.util.List;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
@ -60,7 +60,7 @@ public class CableBusRenderState
// connections contains a corresponding entry.
private EnumMap<EnumFacing, Integer> channelsOnSide = new EnumMap<>( EnumFacing.class );
private EnumMap<EnumFacing, List<ResourceLocation>> attachments = new EnumMap<>( EnumFacing.class );
private EnumMap<EnumFacing, IPartModel> attachments = new EnumMap<>( EnumFacing.class );
// For each attachment, this contains the distance from the edge until which a cable connection should be drawn
private EnumMap<EnumFacing, Integer> attachmentConnections = new EnumMap<>( EnumFacing.class );
@ -68,7 +68,8 @@ public class CableBusRenderState
// Contains the facade to use for each side that has a facade attached
private EnumMap<EnumFacing, FacadeRenderState> facades = new EnumMap<>( EnumFacing.class );
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This list is only populated if there are
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This
// list is only populated if there are
// facades on this cable bus
private List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
@ -132,7 +133,7 @@ public class CableBusRenderState
this.cableBusAdjacent = cableBusAdjacent;
}
public EnumMap<EnumFacing, List<ResourceLocation>> getAttachments()
public EnumMap<EnumFacing, IPartModel> getAttachments()
{
return attachments;
}

View File

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
import javax.vecmath.Vector4f;
import com.google.common.base.Preconditions;

View File

@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.vecmath.Vector3f;

View File

@ -2,6 +2,7 @@ package appeng.client.render.crafting;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;

View File

@ -21,6 +21,7 @@ package appeng.client.render.model;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;

View File

@ -4,6 +4,7 @@ package appeng.client.render.model;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;

View File

@ -32,6 +32,7 @@ import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.base.Charsets;

View File

@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import com.google.common.base.Stopwatch;

View File

@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;

View File

@ -34,11 +34,11 @@ import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketJEIRecipe;
import appeng.core.sync.packets.PacketLightning;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketMatterCannon;
import appeng.core.sync.packets.PacketMockExplosion;
import appeng.core.sync.packets.PacketJEIRecipe;
import appeng.core.sync.packets.PacketNewStorageDimension;
import appeng.core.sync.packets.PacketPaintedEntity;
import appeng.core.sync.packets.PacketPartPlacement;

View File

@ -2,6 +2,7 @@ package appeng.decorative.slab;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.Block;

View File

@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableSet;

View File

@ -21,6 +21,7 @@ package appeng.integration.modules.jei;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Splitter;

View File

@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View File

@ -1,3 +1,4 @@
package appeng.items.parts;
@ -11,6 +12,7 @@ import java.util.List;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AELog;
@ -22,7 +24,7 @@ class PartModelsHelper
static List<ResourceLocation> createModels( Class<?> clazz )
{
List<ResourceLocation> locations = new ArrayList<>( );
List<ResourceLocation> locations = new ArrayList<>();
// Check all static fields for used models
Field[] fields = clazz.getDeclaredFields();
@ -33,7 +35,6 @@ class PartModelsHelper
continue;
}
if( !Modifier.isStatic( field.getModifiers() ) )
{
AELog.error( "The @PartModels annotation can only be used on static fields or methods. Was seen on: " + field );
@ -80,8 +81,8 @@ class PartModelsHelper
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 );
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;
}
@ -119,18 +120,23 @@ class PartModelsHelper
{
locations.add( (ResourceLocation) value );
}
else if( value instanceof IPartModel )
{
locations.addAll( ( (IPartModel) value ).getModels() );
}
else if( value instanceof Collection )
{
// Check that each object is a ResourceLocation
// Check that each object is an IPartModel
Collection values = (Collection) value;
for( Object candidate : values )
{
if ( !( candidate instanceof ResourceLocation )) {
if( !( candidate instanceof IPartModel ) )
{
AELog.error( "List of locations obtained from {} contains a non resource location: {}", source, candidate );
continue;
}
locations.add( (ResourceLocation) candidate );
locations.addAll( ( (IPartModel) candidate ).getModels() );
}
}
}

View File

@ -62,8 +62,8 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.block.paint.BlockPaint;
import appeng.block.networking.BlockCableBus;
import appeng.block.paint.BlockPaint;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.helpers.IMouseWheelItem;

View File

@ -25,6 +25,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;

View File

@ -0,0 +1,80 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.parts;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
public class PartModel implements IPartModel
{
private final boolean isSolid;
private final List<ResourceLocation> resources;
public PartModel( ResourceLocation resource )
{
this( true, resource );
}
public PartModel( ResourceLocation... resources )
{
this( true, resources );
}
public PartModel( boolean isSolid, ResourceLocation resource )
{
this( isSolid, ImmutableList.of( resource ) );
}
public PartModel( boolean isSolid, ResourceLocation... resources )
{
this( isSolid, ImmutableList.copyOf( resources ) );
}
public PartModel( List<ResourceLocation> resources )
{
this( true, resources );
}
public PartModel( boolean isSolid, List<ResourceLocation> resources )
{
this.isSolid = isSolid;
this.resources = resources;
}
@Override
public boolean requireCableConnection()
{
return this.isSolid;
}
@Override
public List<ResourceLocation> getModels()
{
return this.resources;
}
}

View File

@ -31,7 +31,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -53,6 +52,7 @@ import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
@ -74,7 +74,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
private static final PlaneModels MODELS = new PlaneModels( "part/annihilation_plane_", "part/annihilation_plane_on_" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -233,8 +233,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
boolean capture = false;
final BlockPos pos = this.getTile().getPos();
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it "touching" the plane
double posYMiddle = (entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY) / 2.0D;
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it
// "touching" the plane
double posYMiddle = ( entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY ) / 2.0D;
switch( this.getSide() )
{
@ -244,7 +245,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
{
if( ( entity.posY > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this.getSide() == AEPartLocation.DOWN ) )
if( ( entity.posY > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this
.getSide() == AEPartLocation.DOWN ) )
{
capture = true;
}
@ -257,7 +259,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
{
if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this.getSide() == AEPartLocation.NORTH ) )
if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this
.getSide() == AEPartLocation.NORTH ) )
{
capture = true;
}
@ -270,7 +273,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
{
if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this.getSide() == AEPartLocation.WEST ) )
if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this
.getSide() == AEPartLocation.WEST ) )
{
capture = true;
}
@ -288,7 +292,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if( changed )
{
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(),
new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) );
}
}
}
@ -452,7 +457,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG );
this.breakBlockAndStoreItems( w, pos, items );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w,
new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) );
}
else
{
@ -500,9 +506,12 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final Material material = state.getMaterial();
final float hardness = state.getBlockHardness( w, pos );
final boolean ignoreMaterials = material == Material.AIR || material == Material.LAVA || material == Material.WATER || material.isLiquid();
final boolean ignoreBlocks = state.getBlock() == Blocks.BEDROCK || state.getBlock() == Blocks.END_PORTAL || state.getBlock() == Blocks.END_PORTAL_FRAME || state.getBlock() == Blocks.COMMAND_BLOCK;
final boolean ignoreBlocks = state.getBlock() == Blocks.BEDROCK || state.getBlock() == Blocks.END_PORTAL || state
.getBlock() == Blocks.END_PORTAL_FRAME || state.getBlock() == Blocks.COMMAND_BLOCK;
return !ignoreMaterials && !ignoreBlocks && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody( Platform.getPlayer( w ), pos ) && hardness >= 0f;
return !ignoreMaterials && !ignoreBlocks && hardness >= 0f && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody(
Platform.getPlayer( w ),
pos );
}
protected List<ItemStack> obtainBlockDrops( final WorldServer w, final BlockPos pos )
@ -568,7 +577,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
w.setBlockToAir( pos );
final AxisAlignedBB box = new AxisAlignedBB( pos.getX() - 0.2, pos.getY() - 0.2, pos.getZ() - 0.2, pos.getX() + 1.2, pos.getY() + 1.2, pos.getZ() + 1.2 );
final AxisAlignedBB box = new AxisAlignedBB( pos.getX() - 0.2, pos.getY() - 0.2, pos.getZ() - 0.2, pos.getX() + 1.2, pos.getY() + 1.2, pos
.getZ() + 1.2 );
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if( ei instanceof EntityItem )
@ -586,7 +596,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( getConnections(), isPowered(), isActive() );
}

View File

@ -19,8 +19,6 @@
package appeng.parts.automation;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -49,6 +47,7 @@ import appeng.api.networking.security.MachineSource;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
@ -61,6 +60,7 @@ import appeng.helpers.MultiCraftingTracker;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
@ -70,22 +70,16 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/export_bus_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/export_bus_off" )
);
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_off" ) );
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/export_bus_on" )
);
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_on" ) );
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/export_bus_has_channel" )
);
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_has_channel" ) );
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker( this, 9 );
private final BaseActionSource mySrc;
private long itemToSend = 1;
@ -154,7 +148,8 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
if( this.isCraftingEnabled() )
{
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
}
continue;
}
@ -179,7 +174,8 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
if( this.itemToSend == before && this.isCraftingEnabled() )
{
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
}
}
@ -362,7 +358,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{

View File

@ -37,7 +37,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -62,6 +61,7 @@ import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartItem;
import appeng.api.parts.IPartModel;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
@ -90,7 +90,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
private static final PlaneModels MODELS = new PlaneModels( "part/formation_plane_", "part/formation_plane_on_" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -447,8 +447,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
if( w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ) )
{
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item.getItemFromBlock(
Blocks.REEDS ) ) )
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item
.getItemFromBlock(
Blocks.REEDS ) ) )
{
final EntityPlayer player = Platform.getPlayer( (WorldServer) w );
Platform.configurePlayer( player, side, this.getTile() );
@ -614,7 +615,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( getConnections(), isPowered(), isActive() );
}

View File

@ -26,7 +26,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
@ -34,6 +33,7 @@ import net.minecraftforge.common.util.FakePlayerFactory;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AEPartLocation;
import appeng.items.parts.PartModels;
@ -44,7 +44,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
private static final PlaneModels MODELS = new PlaneModels( "part/identity_annihilation_plane_", "part/identity_annihilation_plane_on_" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -105,7 +105,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( getConnections(), isPowered(), isActive() );
}

View File

@ -19,10 +19,6 @@
package appeng.parts.automation;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
@ -44,6 +40,7 @@ import appeng.api.networking.security.MachineSource;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
@ -54,6 +51,7 @@ import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.IInventoryDestination;
@ -65,21 +63,12 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/import_bus_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/import_bus_off" )
);
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/import_bus_off" ) );
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/import_bus_on" )
);
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/import_bus_on" ) );
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/import_bus_has_channel" )
);
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/import_bus_has_channel" ) );
private final BaseActionSource source;
private IMEInventory<IAEItemStack> destination = null;
private IAEItemStack lastItemChecked = null;
@ -104,7 +93,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
return false;
}
final IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, this.source );
final IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE,
this.source );
if( out == null )
{
return true;
@ -173,7 +163,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
try
{
this.itemToSend = this.calculateItemsToSend();
this.itemToSend = Math.min( this.itemToSend, (int) ( 0.01 + this.getProxy().getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) );
this.itemToSend = Math.min( this.itemToSend,
(int) ( 0.01 + this.getProxy().getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) );
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory();
final IEnergyGrid energy = this.getProxy().getEnergy();
@ -235,7 +226,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( newItems != null )
{
newItems.stackSize = (int) ( Math.min( newItems.stackSize, energy.extractAEPower( newItems.stackSize, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01 );
newItems.stackSize = (int) ( Math.min( newItems.stackSize,
energy.extractAEPower( newItems.stackSize, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01 );
this.itemToSend -= newItems.stackSize;
if( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) )
@ -321,7 +313,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{

View File

@ -20,11 +20,8 @@ package appeng.parts.automation;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
@ -62,6 +59,7 @@ import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.storage.IStackWatcher;
import appeng.api.networking.storage.IStackWatcherHost;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
@ -76,6 +74,7 @@ import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
@ -95,12 +94,12 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
@PartModels
public static final ResourceLocation MODEL_STATUS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/level_emitter_status_has_channel" );
public static final List<ResourceLocation> MODEL_OFF_OFF = ImmutableList.of( MODEL_BASE_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODEL_OFF_ON = ImmutableList.of( MODEL_BASE_OFF, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODEL_OFF_HAS_CHANNEL = ImmutableList.of( MODEL_BASE_OFF, MODEL_STATUS_HAS_CHANNEL );
public static final List<ResourceLocation> MODEL_ON_OFF = ImmutableList.of( MODEL_BASE_ON, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODEL_ON_ON = ImmutableList.of( MODEL_BASE_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODEL_ON_HAS_CHANNEL = ImmutableList.of( MODEL_BASE_ON, MODEL_STATUS_HAS_CHANNEL );
public static final PartModel MODEL_OFF_OFF = new PartModel( MODEL_BASE_OFF, MODEL_STATUS_OFF );
public static final PartModel MODEL_OFF_ON = new PartModel( MODEL_BASE_OFF, MODEL_STATUS_ON );
public static final PartModel MODEL_OFF_HAS_CHANNEL = new PartModel( MODEL_BASE_OFF, MODEL_STATUS_HAS_CHANNEL );
public static final PartModel MODEL_ON_OFF = new PartModel( MODEL_BASE_ON, MODEL_STATUS_OFF );
public static final PartModel MODEL_ON_ON = new PartModel( MODEL_BASE_ON, MODEL_STATUS_ON );
public static final PartModel MODEL_ON_HAS_CHANNEL = new PartModel( MODEL_BASE_ON, MODEL_STATUS_HAS_CHANNEL );
private static final int FLAG_ON = 4;
@ -445,7 +444,8 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D, new int[0] );
world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
new int[0] );
}
}
@ -561,7 +561,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{

View File

@ -24,12 +24,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.parts.PartModel;
/**
@ -42,26 +43,26 @@ class PlaneModels
public static final ResourceLocation MODEL_CHASSIS_ON = new ResourceLocation( AppEng.MOD_ID, "part/transition_plane_on" );
public static final ResourceLocation MODEL_CHASSIS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/transition_plane_has_channel" );
private final Map<PlaneConnections, List<ResourceLocation>> modelsOff;
private final Map<PlaneConnections, IPartModel> modelsOff;
private final Map<PlaneConnections, List<ResourceLocation>> modelsOn;
private final Map<PlaneConnections, IPartModel> modelsOn;
private final Map<PlaneConnections, List<ResourceLocation>> modelsHasChannel;
private final Map<PlaneConnections, IPartModel> modelsHasChannel;
public PlaneModels( String prefixOff, String prefixOn )
{
Map<PlaneConnections, List<ResourceLocation>> modelsOff = new HashMap<>();
Map<PlaneConnections, List<ResourceLocation>> modelsOn = new HashMap<>();
Map<PlaneConnections, List<ResourceLocation>> modelsHasChannel = new HashMap<>();
Map<PlaneConnections, IPartModel> modelsOff = new HashMap<>();
Map<PlaneConnections, IPartModel> modelsOn = new HashMap<>();
Map<PlaneConnections, IPartModel> modelsHasChannel = new HashMap<>();
for( PlaneConnections permutation : PlaneConnections.PERMUTATIONS )
{
ResourceLocation planeOff = new ResourceLocation( AppEng.MOD_ID, prefixOff + permutation.getFilenameSuffix() );
ResourceLocation planeOn = new ResourceLocation( AppEng.MOD_ID, prefixOn + permutation.getFilenameSuffix() );
modelsOff.put( permutation, ImmutableList.of( MODEL_CHASSIS_OFF, planeOff ) );
modelsOn.put( permutation, ImmutableList.of( MODEL_CHASSIS_ON, planeOff ) );
modelsHasChannel.put( permutation, ImmutableList.of( MODEL_CHASSIS_HAS_CHANNEL, planeOn ) );
modelsOff.put( permutation, new PartModel( MODEL_CHASSIS_OFF, planeOff ) );
modelsOn.put( permutation, new PartModel( MODEL_CHASSIS_ON, planeOff ) );
modelsHasChannel.put( permutation, new PartModel( MODEL_CHASSIS_HAS_CHANNEL, planeOn ) );
}
this.modelsOff = ImmutableMap.copyOf( modelsOff );
@ -69,7 +70,7 @@ class PlaneModels
this.modelsHasChannel = ImmutableMap.copyOf( modelsHasChannel );
}
public List<ResourceLocation> getModel( PlaneConnections connections, boolean hasPower, boolean hasChannel )
public IPartModel getModel( PlaneConnections connections, boolean hasPower, boolean hasChannel )
{
if( hasPower && hasChannel )
{
@ -85,12 +86,12 @@ class PlaneModels
}
}
public List<ResourceLocation> getModels()
public List<IPartModel> getModels()
{
List<ResourceLocation> result = new ArrayList<>();
modelsOff.values().forEach( result::addAll );
modelsOn.values().forEach( result::addAll );
modelsHasChannel.values().forEach( result::addAll );
List<IPartModel> result = new ArrayList<>();
modelsOff.values().forEach( result::add );
modelsOn.values().forEach( result::add );
modelsHasChannel.values().forEach( result::add );
return result;
}

View File

@ -23,8 +23,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Random;
import com.google.common.collect.ImmutableList;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@ -44,18 +42,23 @@ import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.parts.PartItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AppEng;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartCableAnchor implements IPart
{
@PartModels
public static final List<ResourceLocation> MODELS = ImmutableList.of( new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor" ) );
public static final PartModel DEFAULT_MODELS = new PartModel( false, new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor" ) );
@PartModels
public static final PartModel FACADE_MODELS = new PartModel( false, new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor_short" ) );
private ItemStack is = null;
private IPartHost host = null;
@ -237,9 +240,16 @@ public class PartCableAnchor implements IPart
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS;
if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null )
{
return FACADE_MODELS;
}
else
{
return DEFAULT_MODELS;
}
}
}

View File

@ -22,7 +22,6 @@ package appeng.parts.misc;
import java.util.EnumSet;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
@ -52,6 +51,7 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
@ -66,6 +66,7 @@ import appeng.helpers.IPriorityHost;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartBasicState;
import appeng.parts.PartModel;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
@ -76,21 +77,15 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
{
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/interface_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/interface_off" )
);
public static final PartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/interface_off" ) );
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/interface_on" )
);
public static final PartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/interface_on" ) );
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/interface_has_channel" )
);
public static final PartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/interface_has_channel" ) );
private final DualityInterface duality = new DualityInterface( this.getProxy(), this );
@ -421,7 +416,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{

View File

@ -19,16 +19,14 @@
package appeng.parts.misc;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartInvertedToggleBus extends PartToggleBus
@ -36,9 +34,9 @@ public class PartInvertedToggleBus extends PartToggleBus
@PartModels
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/inverted_toggle_bus_base" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(MODEL_BASE, MODEL_STATUS_OFF);
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(MODEL_BASE, MODEL_STATUS_ON);
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(MODEL_BASE, MODEL_STATUS_HAS_CHANNEL);
public static final PartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_STATUS_OFF );
public static final PartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_STATUS_ON );
public static final PartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_STATUS_HAS_CHANNEL );
@Reflected
public PartInvertedToggleBus( final ItemStack is )
@ -57,7 +55,7 @@ public class PartInvertedToggleBus extends PartToggleBus
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( hasRedstoneFlag() && isActive() && isPowered() )
{

View File

@ -23,8 +23,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -58,6 +56,7 @@ import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
@ -84,6 +83,7 @@ import appeng.me.GridAccessException;
import appeng.me.storage.ITickingMonitor;
import appeng.me.storage.MEInventoryHandler;
import appeng.me.storage.MEMonitorIInventory;
import appeng.parts.PartModel;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
@ -96,22 +96,16 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_off" )
);
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_off" ) ) ;
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_on" )
);
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_on" ) ) ;
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_has_channel" )
);
public static final IPartModel MODELS_HAS_CHANNEL =new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/storage_bus_has_channel" ) );
private final BaseActionSource mySrc;
private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
private int priority = 0;
@ -223,7 +217,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
private void resetCache( final boolean fullReset )
{
if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost().getTile().getWorld().isRemote )
if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost()
.getTile()
.getWorld().isRemote )
{
return;
}
@ -465,7 +461,8 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{
this.handler.setPartitionList( new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
this.handler
.setPartitionList( new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) ) );
}
else
{
@ -587,7 +584,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{
@ -602,5 +599,5 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return MODELS_OFF;
}
}
}

View File

@ -23,8 +23,6 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -38,6 +36,7 @@ import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AppEng;
@ -45,6 +44,7 @@ import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.helpers.AENetworkProxy;
import appeng.parts.PartBasicState;
import appeng.parts.PartModel;
import appeng.util.Platform;
@ -60,9 +60,9 @@ public class PartToggleBus extends PartBasicState
@PartModels
public static final ResourceLocation MODEL_STATUS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/toggle_bus_status_has_channel" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(MODEL_BASE, MODEL_STATUS_OFF);
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(MODEL_BASE, MODEL_STATUS_ON);
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(MODEL_BASE, MODEL_STATUS_HAS_CHANNEL);
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_STATUS_HAS_CHANNEL );
private static final int REDSTONE_FLAG = 4;
private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
@ -86,8 +86,9 @@ public class PartToggleBus extends PartBasicState
return cf | ( this.getIntention() ? REDSTONE_FLAG : 0 );
}
public boolean hasRedstoneFlag() {
return (getClientFlags() & REDSTONE_FLAG) == REDSTONE_FLAG;
public boolean hasRedstoneFlag()
{
return ( getClientFlags() & REDSTONE_FLAG ) == REDSTONE_FLAG;
}
protected boolean getIntention()
@ -222,7 +223,7 @@ public class PartToggleBus extends PartBasicState
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( hasRedstoneFlag() && isActive() && isPowered() )
{

View File

@ -43,6 +43,7 @@ import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
@ -56,7 +57,8 @@ import appeng.util.Platform;
public class PartCable extends AEBasePart implements IPartCable
{
private static final ImmutableSet<AEPartLocation> STRAIGHT_PART_LOCATIONS = ImmutableSet.of( AEPartLocation.DOWN, AEPartLocation.NORTH, AEPartLocation.EAST );
private static final ImmutableSet<AEPartLocation> STRAIGHT_PART_LOCATIONS = ImmutableSet.of( AEPartLocation.DOWN, AEPartLocation.NORTH,
AEPartLocation.EAST );
private final int[] channelsOnSide = { 0, 0, 0, 0, 0, 0 };
@ -388,10 +390,10 @@ public class PartCable extends AEBasePart implements IPartCable
ch = ( (int) data.readByte() ) & 0xFF;
}
if( ch != this.getChannelsOnSide(d.ordinal()) )
if( ch != this.getChannelsOnSide( d.ordinal() ) )
{
channelsChanged = true;
this.setChannelsOnSide(d.ordinal(), ch);
this.setChannelsOnSide( d.ordinal(), ch );
}
}
}
@ -427,4 +429,5 @@ public class PartCable extends AEBasePart implements IPartCable
{
this.connections = connections;
}
}

View File

@ -19,9 +19,7 @@
package appeng.parts.networking;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
@ -38,6 +36,7 @@ import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.energy.IEnergyGridProvider;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AppEng;
@ -45,13 +44,14 @@ import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.helpers.AENetworkProxy;
import appeng.parts.AEBasePart;
import appeng.parts.PartModel;
public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
{
@PartModels
private static final List<ResourceLocation> MODELS = Collections.singletonList( new ResourceLocation( AppEng.MOD_ID, "part/quartz_fiber" ) );
private static final IPartModel MODELS = new PartModel( new ResourceLocation( AppEng.MOD_ID, "part/quartz_fiber" ) );
private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", this.getProxy().getMachineRepresentation(), true );
@ -220,7 +220,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS;
}

View File

@ -22,11 +22,11 @@ package appeng.parts.p2p;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.parts.PartModel;
/**
@ -39,19 +39,19 @@ class P2PModels
public static final ResourceLocation MODEL_STATUS_ON = new ResourceLocation( AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_on" );
public static final ResourceLocation MODEL_STATUS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_has_channel" );
private final List<ResourceLocation> modelsOff;
private final List<ResourceLocation> modelsOn;
private final List<ResourceLocation> modelsHasChannel;
private final IPartModel modelsOff;
private final IPartModel modelsOn;
private final IPartModel modelsHasChannel;
public P2PModels( String frontModelPath )
{
ResourceLocation frontModel = new ResourceLocation( AppEng.MOD_ID, frontModelPath );
modelsOff = ImmutableList.of( MODEL_STATUS_OFF, frontModel );
modelsOn = ImmutableList.of( MODEL_STATUS_ON, frontModel );
modelsHasChannel = ImmutableList.of( MODEL_STATUS_HAS_CHANNEL, frontModel );
modelsOff = new PartModel( MODEL_STATUS_OFF, frontModel );
modelsOn = new PartModel( MODEL_STATUS_ON, frontModel );
modelsHasChannel = new PartModel( MODEL_STATUS_HAS_CHANNEL, frontModel );
}
public List<ResourceLocation> getModel( boolean hasPower, boolean hasChannel )
public IPartModel getModel( boolean hasPower, boolean hasChannel )
{
if( hasPower && hasChannel )
{
@ -67,11 +67,12 @@ class P2PModels
}
}
public List<ResourceLocation> getModels() {
List<ResourceLocation> result = new ArrayList<>();
result.addAll( modelsOff );
result.addAll( modelsOn );
result.addAll( modelsHasChannel );
public List<IPartModel> getModels()
{
List<IPartModel> result = new ArrayList<>();
result.add( modelsOff );
result.add( modelsOn );
result.add( modelsHasChannel );
return result;
}

View File

@ -25,7 +25,6 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergyEmitter;
@ -33,6 +32,7 @@ import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import appeng.api.config.PowerUnits;
import appeng.api.parts.IPartModel;
import appeng.coremod.annotations.Integration.Interface;
import appeng.coremod.annotations.Integration.InterfaceList;
import appeng.integration.IntegrationType;
@ -57,7 +57,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements I
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_ic2" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -255,7 +255,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements I
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}

View File

@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import appeng.api.networking.IGridNode;
@ -40,6 +39,7 @@ import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartModel;
import appeng.core.settings.TickRates;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
@ -58,7 +58,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements /* IPip
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_items" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -390,16 +390,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements /* IPip
return null;
}
// TODO: BC Integration
// @Override
// @Method( iname = "BuildCraftTransport" )
// public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
// {
// return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
// }
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}

View File

@ -27,7 +27,6 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import appeng.api.networking.IGridNode;
@ -36,6 +35,7 @@ import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartModel;
import appeng.core.settings.TickRates;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
@ -47,7 +47,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_light" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -226,7 +226,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}

View File

@ -27,12 +27,12 @@ import java.util.Stack;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
@ -43,7 +43,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_liquids" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -304,7 +304,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}

View File

@ -27,7 +27,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -35,6 +34,7 @@ import appeng.api.networking.events.MENetworkBootingStatusChange;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.util.Platform;
@ -46,7 +46,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_redstone" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -209,7 +209,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}

View File

@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnection;
@ -39,6 +38,7 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AELog;
@ -57,7 +57,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_me" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@ -239,14 +239,17 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
{
try
{
connections.getConnections().put( me.getGridNode(), new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) );
connections.getConnections().put( me.getGridNode(),
new TunnelConnection( me, AEApi.instance().createGridConnection( this.outerProxy.getNode(), me.outerProxy.getNode() ) ) );
}
catch( final FailedConnection e )
{
final TileEntity start = this.getTile();
final TileEntity end = me.getTile();
AELog.warn( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", start.getPos().getX(), start.getPos().getY(), start.getPos().getZ(), end.getPos().getX(), end.getPos().getY(), end.getPos().getZ() );
AELog.warn( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]",
start.getPos().getX(), start.getPos().getY(), start.getPos().getZ(), end.getPos().getX(), end.getPos().getY(),
end.getPos().getZ() );
// :(
}
}
@ -259,7 +262,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( isPowered(), isActive() );
}

View File

@ -20,7 +20,6 @@ package appeng.parts.reporting;
import java.io.IOException;
import java.util.List;
import io.netty.buffer.ByteBuf;
@ -31,7 +30,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
@ -41,6 +39,7 @@ import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.storage.IStackWatcher;
import appeng.api.networking.storage.IStackWatcherHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
@ -146,7 +145,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
{
if( Platform.isClient() )
{
return true;
@ -318,8 +317,8 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
return false;
}
protected List<ResourceLocation> selectModel(List<ResourceLocation> off, List<ResourceLocation> on, List<ResourceLocation> hasChannel,
List<ResourceLocation> lockedOff, List<ResourceLocation> lockedOn, List<ResourceLocation> lockedHasChannel) {
protected IPartModel selectModel( IPartModel off, IPartModel on, IPartModel hasChannel, IPartModel lockedOff, IPartModel lockedOn, IPartModel lockedHasChannel )
{
if( isActive() )
{
if( isLocked() )

View File

@ -20,7 +20,6 @@ package appeng.parts.reporting;
import java.io.IOException;
import java.util.List;
import io.netty.buffer.ByteBuf;
@ -29,7 +28,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@ -40,6 +38,7 @@ import appeng.api.networking.events.MENetworkBootingStatusChange;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.util.AEPartLocation;
import appeng.me.GridAccessException;
import appeng.parts.AEBasePart;
@ -291,7 +290,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
}
protected List<ResourceLocation> selectModel( List<ResourceLocation> offModels, List<ResourceLocation> onModels, List<ResourceLocation> hasChannelModels )
protected IPartModel selectModel( IPartModel offModels, IPartModel onModels, IPartModel hasChannelModels )
{
if( isActive() )
{

View File

@ -22,8 +22,6 @@ package appeng.parts.reporting;
import java.util.Collections;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -34,12 +32,14 @@ import net.minecraft.util.math.Vec3d;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.PlayerSource;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
@ -57,13 +57,13 @@ public class PartConversionMonitor extends AbstractPartMonitor
@PartModels
public static final ResourceLocation MODEL_LOCKED_ON = new ResourceLocation( AppEng.MOD_ID, "part/conversion_monitor_locked_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final List<ResourceLocation> MODELS_LOCKED_OFF = ImmutableList.of( MODEL_BASE, MODEL_LOCKED_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_LOCKED_ON = ImmutableList.of( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_LOCKED_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_LOCKED_OFF = new PartModel( MODEL_BASE, MODEL_LOCKED_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_LOCKED_ON = new PartModel( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_LOCKED_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_HAS_CHANNEL );
@Reflected
public PartConversionMonitor( final ItemStack is )
{
@ -184,10 +184,10 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return selectModel( MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL,
MODELS_LOCKED_OFF, MODELS_LOCKED_ON, MODELS_LOCKED_HAS_CHANNEL );
}
}

View File

@ -21,18 +21,18 @@ package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
import appeng.tile.inventory.AppEngInternalInventory;
@ -44,9 +44,9 @@ public class PartCraftingTerminal extends AbstractPartTerminal
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/crafting_terminal_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
private final AppEngInternalInventory craftingGrid = new AppEngInternalInventory( this, 9 );
@ -115,7 +115,7 @@ public class PartCraftingTerminal extends AbstractPartTerminal
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return selectModel( MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL );
}

View File

@ -19,16 +19,14 @@
package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartDarkPanel extends AbstractPartPanel
@ -39,8 +37,8 @@ public class PartDarkPanel extends AbstractPartPanel
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/monitor_dark_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON );
@Reflected
public PartDarkPanel( final ItemStack is )
@ -55,7 +53,7 @@ public class PartDarkPanel extends AbstractPartPanel
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return isPowered() ? MODELS_ON : MODELS_OFF;
}

View File

@ -19,19 +19,17 @@
package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.core.sync.GuiBridge;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
import appeng.util.Platform;
@ -43,9 +41,9 @@ public class PartInterfaceTerminal extends AbstractPartDisplay
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/interface_terminal_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public PartInterfaceTerminal( final ItemStack is )
{
@ -74,7 +72,7 @@ public class PartInterfaceTerminal extends AbstractPartDisplay
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return selectModel( MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL );
}

View File

@ -19,16 +19,14 @@
package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartPanel extends AbstractPartPanel
@ -39,8 +37,8 @@ public class PartPanel extends AbstractPartPanel
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/monitor_bright_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON );
@Reflected
public PartPanel( final ItemStack is )
@ -55,7 +53,7 @@ public class PartPanel extends AbstractPartPanel
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return isPowered() ? MODELS_ON : MODELS_OFF;
}

View File

@ -21,8 +21,6 @@ package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -31,11 +29,13 @@ import net.minecraft.util.ResourceLocation;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.parts.IPartModel;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AppEng;
import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.InvOperation;
@ -48,9 +48,9 @@ public class PartPatternTerminal extends AbstractPartTerminal
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/pattern_terminal_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON ) ;
public static final IPartModel MODELS_HAS_CHANNEL =new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL ) ;
private final AppEngInternalInventory crafting = new AppEngInternalInventory( this, 9 );
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 3 );
@ -214,7 +214,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return selectModel( MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL );
}

View File

@ -19,16 +19,14 @@
package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartSemiDarkPanel extends AbstractPartPanel
@ -38,8 +36,8 @@ public class PartSemiDarkPanel extends AbstractPartPanel
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/monitor_medium_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON );
public static final PartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON );
@Reflected
public PartSemiDarkPanel( final ItemStack is )
@ -56,7 +54,7 @@ public class PartSemiDarkPanel extends AbstractPartPanel
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return isPowered() ? MODELS_ON : MODELS_OFF;
}

View File

@ -19,16 +19,14 @@
package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
/**
@ -49,13 +47,13 @@ public class PartStorageMonitor extends AbstractPartMonitor
@PartModels
public static final ResourceLocation MODEL_LOCKED_ON = new ResourceLocation( AppEng.MOD_ID, "part/storage_monitor_locked_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final List<ResourceLocation> MODELS_LOCKED_OFF = ImmutableList.of( MODEL_BASE, MODEL_LOCKED_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_LOCKED_ON = ImmutableList.of( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_LOCKED_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_LOCKED_OFF = new PartModel( MODEL_BASE, MODEL_LOCKED_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_LOCKED_ON = new PartModel( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_LOCKED_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_LOCKED_ON, MODEL_STATUS_HAS_CHANNEL );
@Reflected
public PartStorageMonitor( final ItemStack is )
@ -64,7 +62,7 @@ public class PartStorageMonitor extends AbstractPartMonitor
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return selectModel( MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL,
MODELS_LOCKED_OFF, MODELS_LOCKED_ON, MODELS_LOCKED_HAS_CHANNEL );

View File

@ -19,15 +19,13 @@
package appeng.parts.reporting;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartTerminal extends AbstractPartTerminal
@ -38,9 +36,9 @@ public class PartTerminal extends AbstractPartTerminal
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/terminal_on" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public PartTerminal( final ItemStack is )
{
@ -48,7 +46,7 @@ public class PartTerminal extends AbstractPartTerminal
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return selectModel( MODELS_OFF, MODELS_ON, MODELS_HAS_CHANNEL );
}

View File

@ -32,6 +32,7 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;

View File

@ -20,6 +20,7 @@ package appeng.tile;
import java.util.EnumMap;
import javax.annotation.Nullable;
import net.minecraft.block.Block;

View File

@ -22,6 +22,7 @@ package appeng.tile.networking;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;

View File

@ -20,6 +20,7 @@ package appeng.tile.powersink;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;

View File

@ -22,6 +22,7 @@ package appeng.tile.storage;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;

View File

@ -19,7 +19,6 @@
package appeng.util;
import java.lang.reflect.Method;
import java.security.InvalidParameterException;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -30,6 +29,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.WeakHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -76,7 +76,6 @@ import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;

View File

@ -26,6 +26,7 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.security.InvalidParameterException;
import java.util.List;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;

View File

@ -0,0 +1,21 @@
{
"textures": {
"0": "appliedenergistics2:parts/cable_anchor",
"particle": "appliedenergistics2:parts/cable_anchor"
},
"elements": [
{
"name": "Element",
"from": [ 7.0, 7.0, 1.0 ],
"to": [ 9.0, 9.0, 6 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"east": { "texture": "#0", "uv": [ 1.0, 0.0, 6.0, 2.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"west": { "texture": "#0", "uv": [ 1.0, 0.0, 6.0, 2.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 1.0, 2.0, 6.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 1.0, 2.0, 6.0 ] }
}
}
]
}