About finished with troughs just need to fix render and test fluid flow
This commit is contained in:
parent
8f7ac50fbf
commit
03348a71bb
8 changed files with 177 additions and 88 deletions
|
@ -5,6 +5,8 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import resonantinduction.archaic.blocks.BlockTurntable;
|
||||
import resonantinduction.archaic.channel.BlockChannel;
|
||||
import resonantinduction.archaic.channel.TileChannel;
|
||||
import resonantinduction.archaic.crate.BlockCrate;
|
||||
import resonantinduction.archaic.crate.ItemBlockCrate;
|
||||
import resonantinduction.archaic.crate.TileCrate;
|
||||
|
@ -43,11 +45,9 @@ import cpw.mods.fml.common.network.NetworkMod;
|
|||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Resonant Induction Archaic Module
|
||||
/** Resonant Induction Archaic Module
|
||||
*
|
||||
* @author DarkCow, Calclavia
|
||||
*/
|
||||
* @author DarkCow, Calclavia */
|
||||
@Mod(modid = Archaic.ID, name = Archaic.NAME, version = Reference.VERSION, dependencies = "required-after:" + ResonantInduction.ID)
|
||||
@NetworkMod(channels = Reference.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class Archaic
|
||||
|
@ -75,6 +75,7 @@ public class Archaic
|
|||
public static Block blockHotPlate;
|
||||
public static Block blockMillstone;
|
||||
public static Block blockCast;
|
||||
public static Block blockChannel;
|
||||
public static Item itemImprint;
|
||||
|
||||
// Machine and Processing
|
||||
|
@ -93,6 +94,7 @@ public class Archaic
|
|||
blockHotPlate = contentRegistry.createTile(BlockHotPlate.class, TileHotPlate.class);
|
||||
blockMillstone = contentRegistry.createTile(BlockMillstone.class, TileMillstone.class);
|
||||
blockCast = contentRegistry.createTile(BlockCast.class, TileCast.class);
|
||||
blockChannel = contentRegistry.createTile(BlockChannel.class, TileChannel.class);
|
||||
|
||||
itemImprint = contentRegistry.createItem(ItemImprint.class);
|
||||
itemHammer = contentRegistry.createItem(ItemHammer.class);
|
||||
|
@ -101,6 +103,7 @@ public class Archaic
|
|||
TabRI.ITEMSTACK = new ItemStack(blockEngineeringTable);
|
||||
|
||||
PacketAnnotation.register(TileFirebox.class);
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -132,5 +135,6 @@ public class Archaic
|
|||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(itemImprint, "PPP", "PIP", "PPP", 'P', Item.paper, 'I', new ItemStack(Item.dyePowder, 0)));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(itemHammer, "CC ", "CS ", " S", 'C', Block.cobblestone, 'S', Item.stick));
|
||||
proxy.postInit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
package resonantinduction.archaic;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import resonantinduction.archaic.channel.ItemChannelRenderer;
|
||||
import resonantinduction.archaic.channel.RenderChannel;
|
||||
import resonantinduction.archaic.channel.TileChannel;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
|
||||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileChannel.class, RenderChannel.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(Archaic.blockChannel.blockID, new ItemChannelRenderer());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package resonantinduction.archaic;
|
||||
|
||||
import resonantinduction.archaic.channel.RenderChannel;
|
||||
import resonantinduction.archaic.channel.TileChannel;
|
||||
import calclavia.lib.prefab.ProxyBase;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
public class CommonProxy extends ProxyBase
|
||||
{
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
package resonantinduction.archaic.channel;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.prefab.fluid.BlockFluidNetwork;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
|
||||
/** Early tier version of the basic pipe. Open on the top, and can't support pressure.
|
||||
|
@ -14,4 +20,34 @@ public class BlockChannel extends BlockFluidNetwork
|
|||
super(Settings.CONFIGURATION.getBlock("Channel", id).getInt(id), UniversalElectricity.machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
|
||||
}
|
||||
return super.onMachineActivated(world, x, y, z, entityplayer, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.client.model.ModelRenderer;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
|
||||
public class ModelOpenTrough extends ModelBase
|
||||
public class ModelChannel extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer base;
|
||||
|
@ -52,7 +52,7 @@ public class ModelOpenTrough extends ModelBase
|
|||
ModelRenderer cornerFrontLeft;
|
||||
ModelRenderer cornerFrontRight;
|
||||
|
||||
public ModelOpenTrough()
|
||||
public ModelChannel()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
|
@ -1,10 +1,16 @@
|
|||
package resonantinduction.archaic.channel;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.api.mechanical.fluid.IFluidNetwork;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidPipe;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.part.PartFramedConnection;
|
||||
import resonantinduction.mechanical.fluid.pipe.EnumPipeMaterial;
|
||||
import resonantinduction.mechanical.fluid.pipe.ModelPipe;
|
||||
import resonantinduction.mechanical.fluid.pipe.PartPipe;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
|
@ -12,27 +18,27 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderChannel
|
||||
public class RenderChannel extends TileEntitySpecialRenderer
|
||||
{
|
||||
public static final RenderChannel INSTANCE = new RenderChannel();
|
||||
|
||||
public static ModelOpenTrough MODEL_TROUGH_PIPE = new ModelOpenTrough();
|
||||
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png");
|
||||
|
||||
public void render(PartPipe part, double x, double y, double z, float f)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
render(0, part.getAllCurrentConnections());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
public static ModelChannel MODEL_TROUGH_PIPE = new ModelChannel();
|
||||
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "white.png");
|
||||
|
||||
public static void render(int meta, byte sides)
|
||||
{
|
||||
RenderUtility.enableBlending();
|
||||
RenderUtility.bind(TEXTURE);
|
||||
MODEL_TROUGH_PIPE.render(sides, meta == 0 ? true : false);
|
||||
RenderUtility.disableBlending();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f)
|
||||
{
|
||||
System.out.println("Update tick channel renderer");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
render(0, (tileentity instanceof TileChannel ? ((TileChannel) tileentity).renderSides : (byte)0));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -2,13 +2,16 @@ package resonantinduction.archaic.channel;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidConnector;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidNetwork;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidPipe;
|
||||
import resonantinduction.core.prefab.fluid.PipeNetwork;
|
||||
import resonantinduction.core.prefab.fluid.TileFluidNetwork;
|
||||
import resonantinduction.mechanical.fluid.tank.TileTank;
|
||||
import calclavia.lib.multiblock.fake.IBlockActivate;
|
||||
import calclavia.lib.utility.WrenchUtility;
|
||||
|
||||
|
@ -55,6 +58,28 @@ public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFl
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (tileEntity instanceof IFluidPipe)
|
||||
{
|
||||
if (tileEntity instanceof TileChannel)
|
||||
{
|
||||
getNetwork().merge(((IFluidConnector) tileEntity).getNetwork());
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks[side.ordinal()] = tileEntity;
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof IFluidHandler)
|
||||
{
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks[side.ordinal()] = tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFlow()
|
||||
{
|
||||
|
@ -125,5 +150,4 @@ public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFl
|
|||
{
|
||||
return 500;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.archaic.channel.ModelOpenTrough;
|
||||
import resonantinduction.archaic.channel.ModelChannel;
|
||||
import resonantinduction.core.Reference;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -16,7 +16,7 @@ public class RenderPipe
|
|||
public static final RenderPipe INSTANCE = new RenderPipe();
|
||||
|
||||
public static ModelPipe MODEL_PIPE = new ModelPipe();
|
||||
public static ModelOpenTrough MODEL_TROUGH_PIPE = new ModelOpenTrough();
|
||||
public static ModelChannel MODEL_TROUGH_PIPE = new ModelChannel();
|
||||
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png");
|
||||
|
||||
public void render(PartPipe part, double x, double y, double z, float f)
|
||||
|
|
Loading…
Reference in a new issue