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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user