Reimplemented cable and parts rendering.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
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.core.AppEng;
|
||||
|
||||
|
||||
/**
|
||||
* Helper for maintaining the models used for a variant of the P2P bus.
|
||||
*/
|
||||
class P2PModels
|
||||
{
|
||||
|
||||
public static final ResourceLocation MODEL_STATUS_OFF = new ResourceLocation( AppEng.MOD_ID, "part/p2p/p2p_tunnel_status_off" );
|
||||
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;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getModel( boolean hasPower, boolean hasChannel )
|
||||
{
|
||||
if( hasPower && hasChannel )
|
||||
{
|
||||
return modelsHasChannel;
|
||||
}
|
||||
else if( hasPower )
|
||||
{
|
||||
return modelsOn;
|
||||
}
|
||||
else
|
||||
{
|
||||
return modelsOff;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getModels() {
|
||||
List<ResourceLocation> result = new ArrayList<>();
|
||||
result.addAll( modelsOff );
|
||||
result.addAll( modelsOn );
|
||||
result.addAll( modelsHasChannel );
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ 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;
|
||||
@@ -43,6 +44,7 @@ import appeng.core.settings.TickRates;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBuildCraftTransport;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.tile.inventory.AppEngNullInventory;
|
||||
@@ -57,6 +59,14 @@ import appeng.util.inv.WrapperMCISidedInventory;
|
||||
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements /* IPipeConnection, */ISidedInventory, IGridTickable
|
||||
{
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_items" );
|
||||
|
||||
@PartModels
|
||||
public static List<ResourceLocation> getModels()
|
||||
{
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private final LinkedList<IInventory> which = new LinkedList<IInventory>();
|
||||
private int oldSize = 0;
|
||||
private boolean requested;
|
||||
@@ -412,4 +422,11 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements /* IPip
|
||||
// {
|
||||
// return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getStaticModels()
|
||||
{
|
||||
return MODELS.getModel( isPowered(), isActive() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,14 @@ package appeng.parts.p2p;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
@@ -35,12 +37,21 @@ import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
|
||||
public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTickable
|
||||
{
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_light" );
|
||||
|
||||
@PartModels
|
||||
public static List<ResourceLocation> getModels()
|
||||
{
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private int lastValue = 0;
|
||||
private float opacity = -1;
|
||||
|
||||
@@ -213,4 +224,11 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
{
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getStaticModels()
|
||||
{
|
||||
return MODELS.getModel( isPowered(), isActive() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,17 +27,27 @@ 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.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
|
||||
public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFluidHandler
|
||||
{
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_liquids" );
|
||||
|
||||
@PartModels
|
||||
public static List<ResourceLocation> getModels()
|
||||
{
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private static final ThreadLocal<Stack<PartP2PLiquids>> DEPTH = new ThreadLocal<Stack<PartP2PLiquids>>();
|
||||
private static final FluidTankInfo[] ACTIVE_TANK = { new FluidTankInfo( null, 10000 ) };
|
||||
private static final FluidTankInfo[] INACTIVE_TANK = { new FluidTankInfo( null, 0 ) };
|
||||
@@ -292,4 +302,11 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
}
|
||||
return INACTIVE_TANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getStaticModels()
|
||||
{
|
||||
return MODELS.getModel( isPowered(), isActive() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
package appeng.parts.p2p;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRedstoneWire;
|
||||
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;
|
||||
|
||||
@@ -32,6 +35,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.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -39,6 +43,14 @@ import appeng.util.Platform;
|
||||
public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
{
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_redstone" );
|
||||
|
||||
@PartModels
|
||||
public static List<ResourceLocation> getModels()
|
||||
{
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private int power;
|
||||
private boolean recursive = false;
|
||||
|
||||
@@ -195,4 +207,11 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getStaticModels()
|
||||
{
|
||||
return MODELS.getModel( isPowered(), isActive() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,12 +22,14 @@ package appeng.parts.p2p;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
@@ -42,6 +44,7 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.parts.PartModels;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.Connections;
|
||||
import appeng.me.cache.helpers.TunnelConnection;
|
||||
@@ -51,6 +54,14 @@ import appeng.me.helpers.AENetworkProxy;
|
||||
public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements IGridTickable
|
||||
{
|
||||
|
||||
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_me" );
|
||||
|
||||
@PartModels
|
||||
public static List<ResourceLocation> getModels()
|
||||
{
|
||||
return MODELS.getModels();
|
||||
}
|
||||
|
||||
private final Connections connection = new Connections( this );
|
||||
private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
|
||||
|
||||
@@ -246,4 +257,11 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceLocation> getStaticModels()
|
||||
{
|
||||
return MODELS.getModel( isPowered(), isActive() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user