Cleanup && Finished Animation & most of piston

Mostly just a code upload to move work to my other pc but i did get
steam piston's animation done. I also cleaned up a little moved EU
vampire to dev blocks, removed old steam piston, and corrected GUI.
Current bugs: Mech energy will not trade, Steam piston GUI willl not
display Newtons out putted, and slight lag being cause by packets.
This commit is contained in:
Rseifert 2012-10-02 23:27:18 -04:00
parent b26beba828
commit 3d238fdd38
17 changed files with 164 additions and 408 deletions

1
.gitignore vendored
View file

@ -30,6 +30,7 @@ LICENSE
/src/common/universalelectricity/*
/src/common/basiccomponents/*
/src/common/buildcraft/*
/src/common/aa/*
/bin/
/conf/
/docs/

View file

@ -1,84 +0,0 @@
package aa;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.src.Block;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
public class BlockDev extends BlockContainer {
public BlockDev(int par1) {
super(par1, Material.rock);
this.setBlockName("Machine");
this.setCreativeTab(CreativeTabs.tabBlock);
//this.setRequiresSelfNotify();
// this.blockIndexInTexture = 26;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
//TODO change later when custom models are added
return true;
}
public int getBlockTextureFromSideAndMetadata(int side, int meta)
{
if(meta == 0)
{
if(side == 0 || side == 1)
{
return 1;
}
}
return 0;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return 0;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
public void addCreativeItems(ArrayList itemList)
{
itemList.add(new ItemStack(this, 1,0));
}
@Override
public TileEntity createNewTileEntity(World var1,int meta) {
// TODO Auto-generated method stub
if(meta == 0)
{
return new TileEntityAntiMob();
}
return null;
}
@Override
public TileEntity createNewTileEntity(World var1) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getTextureFile() {
return "/textures/DevBlocks.png";}
}

View file

@ -1,54 +0,0 @@
package aa;
import java.io.File;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraftforge.common.Configuration;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "DevBox", name = "Dev Box", version = "Unknown")
@NetworkMod(channels = { "DevD" }, clientSideRequired = true, serverSideRequired = false)
public class DevMain{
public DevMain instance;
@SidedProxy(clientSide = "aa.DevProxy", serverSide = "aa.DevProxy")
public static DevProxy proxy;
Block devBlock = new BlockDev(3533);
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
proxy.preInit();
GameRegistry.registerBlock(devBlock);
}
@Init
public void load(FMLInitializationEvent evt)
{
//register
proxy.init();
GameRegistry.registerTileEntity(TileEntityAntiMob.class, "DevAntiMob");
//Names and lang stuff
}
@PostInit
public void postInit(FMLPostInitializationEvent event)
{
proxy.postInit();
}
}

View file

@ -1,63 +0,0 @@
package aa;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraftforge.client.MinecraftForgeClient;
import basicpipes.BasicPipesMain;
import basicpipes.conductors.TileEntityPipe;
import basicpipes.machines.TileEntityPump;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
public class DevProxy implements IGuiHandler
{
@SideOnly(Side.CLIENT)
public void renders()
{
MinecraftForgeClient.preloadTexture("textures/Devblocks.png");
}
public void preInit()
{
renders();
}
public void init()
{
}
public void postInit()
{
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
switch(ID)
{
}
}
return null;
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
switch(ID)
{
}
}
return null;
}
}

View file

@ -1,37 +0,0 @@
package aa;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityMob;
import net.minecraft.src.EntitySlime;
import net.minecraft.src.TileEntity;
public class TileEntityAntiMob extends TileEntity {
@Override
public void updateEntity()
{
List<Entity> ee = worldObj.loadedEntityList;
List<Entity> mobs = new ArrayList<Entity>();
for(int i = 0; i <ee.size(); i++)
{
if(ee.get(i) instanceof EntityMob || ee.get(i) instanceof EntitySlime)
{
mobs.add(ee.get(i));
}
}
for(int j =0; j < mobs.size();j++)
{
Entity mod = mobs.get(j);
if(mod.getDistance(xCoord, yCoord, zCoord) < 40)
{
mobs.get(j).setDead();
mobs.remove(j);
}
}
}
}

View file

@ -42,17 +42,18 @@ public class BasicPipesMain{
public static int machineID;
private static int toolID;
public static int valveID;
public static int rodID;
public static Block pipe = new BlockPipe(pipeID).setBlockName("pipe");
public static Block machine = new BlockMachine(machineID).setBlockName("pump");
public static Block valve = new BlockValve(valveID).setBlockName("valve");
public static Block rod = new BlockRod(valveID+1);
public static Block rod = new BlockRod(rodID);
public static Item parts = new ItemParts(partID);
public static Item itemPipes = new ItemPipe(ppipeID);
public static Item gauge = new ItemGuage(toolID);
public static String channel = "Pipes";
public static String textureFile = "/textures";
public static boolean ueLoaded = false;
public static int configurationProperties()
@ -61,6 +62,7 @@ public class BasicPipesMain{
pipeID = Integer.parseInt(config.getOrCreateIntProperty("PipeBlock", Configuration.CATEGORY_BLOCK, 155).value);
machineID = Integer.parseInt(config.getOrCreateIntProperty("machineBlock", Configuration.CATEGORY_BLOCK, 156).value);
valveID = Integer.parseInt(config.getOrCreateIntProperty("ValveBlock", Configuration.CATEGORY_BLOCK, 157).value);
rodID = Integer.parseInt(config.getOrCreateIntProperty("gearBlock", Configuration.CATEGORY_BLOCK, 158).value);
partID = Integer.parseInt(config.getOrCreateIntProperty("parts", Configuration.CATEGORY_ITEM, 23022).value);
ppipeID = Integer.parseInt(config.getOrCreateIntProperty("pipes", Configuration.CATEGORY_ITEM, 23023).value);
toolID = Integer.parseInt(config.getOrCreateIntProperty("ToolID", Configuration.CATEGORY_ITEM, 23024).value);
@ -112,8 +114,7 @@ public class BasicPipesMain{
//crafting pipes
//{"black", "red", "green", "brown", "blue", "purple", "cyan",
//"silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"};
//steam
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,0), new Object[] { new ItemStack(parts, 1,0),new ItemStack(parts, 1,4)});
//water
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,1), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4),new ItemStack(Item.dyePowder, 1,4)});
//lava TODO change to use obby pipe and nether items
@ -126,7 +127,8 @@ public class BasicPipesMain{
try{
GameRegistry.addRecipe(new ItemStack(parts, 2,0), new Object[] { "@@@", '@',BasicComponents.itemBronzeIngot});//bronze tube
//steam
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,0), new Object[] { new ItemStack(parts, 1,0),new ItemStack(parts, 1,4)});
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',BasicComponents.itemBronzeIngot});//tank
//pump
@ -138,12 +140,16 @@ public class BasicPipesMain{
, 'C',BasicComponents.blockCopperWire
, 'T',new ItemStack(parts, 1,6)
});
}
catch(Exception e)
{
e.printStackTrace();
System.out.print("UE based recipes not loaded");
}
this.ueLoaded = true;
}
catch(Exception e)
{
System.out.print("UE based recipes not loaded");
//secondary boiler tank
GameRegistry.addRecipe(new ItemStack(parts, 1,6), new Object[] { " @ ","@ @"," @ ", '@',Item.ingotIron});//tank
//steam
GameRegistry.addShapelessRecipe(new ItemStack(itemPipes, 1,0), new Object[] { new ItemStack(parts, 1,1),new ItemStack(parts, 1,4)});
}
}
}

View file

@ -127,9 +127,11 @@ public class BlockMachine extends universalelectricity.prefab.BlockMachine
{
switch(meta)
{
case 1: return new TileEntityBoiler();
case 2: return new TileEntityFireBox();
case 15: return new TileEntityNuller();
case 1: return new TileEntityBoiler();
case 2: return new TileEntityFireBox();
case 3: return new TileEntityFireBox();
case 4: return new TileEntityFireBox();
case 5: return new TileEntityFireBox();
}
return null;
}

View file

@ -77,14 +77,12 @@ public class SteamPowerMain{
public void load(FMLInitializationEvent evt)
{
proxy.init();
GameRegistry.registerTileEntity(TileEntityNuller.class, "EUNuller");
GameRegistry.registerTileEntity(TileEntitytopGen.class, "gentop");
//Names...............
LanguageRegistry.addName((new ItemStack(machine, 1, 1)), "Boiler");
LanguageRegistry.addName((new ItemStack(gen, 1, 0)), "Generator");
LanguageRegistry.addName((new ItemStack(machine, 1, 2)), "FireBox");
LanguageRegistry.addName((new ItemStack(itemEngine, 1, 0)), "SteamPiston");
LanguageRegistry.addName((new ItemStack(machine, 1, 15)), "EUVampire");
}
@ -96,12 +94,9 @@ public class SteamPowerMain{
//Crafting
try{
/**
case 0: return new TileEntityGrinder(); <-Removed
case 1: return new TileEntityBoiler();
case 2: return new TileEntityFireBox();
case 3: return new TileEntityGenerator();
case 14: return new TileEntityCondenser();<-Removed
case 15: return new TileEntityNuller();<-Just for testing Not craftable*/
TileEntityBoiler();<- metadata 1
TileEntityFireBox();<-metadata 2-5
*/
GameRegistry.addRecipe(new ItemStack(machine, 1, 1), new Object [] {"@T@", "OVO", "@T@",
'T',new ItemStack(BasicPipesMain.parts, 1,6),

View file

@ -42,7 +42,7 @@ public class SteamProxy implements IGuiHandler{
{
case 0: return new GUIFireBox(player.inventory, ((TileEntityFireBox)tileEntity));
case 1: return new GuiBoiler(player.inventory, ((TileEntityBoiler)tileEntity));
case 2: return new GUIGenerator(player.inventory, ((TileEntitySteamPiston)tileEntity));
case 2: return new GUISteamPiston(player.inventory, ((TileEntitySteamPiston)tileEntity));
}
}

View file

@ -5,21 +5,18 @@ import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList;
import net.minecraft.src.Packet;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import universalelectricity.network.PacketManager;
import universalelectricity.prefab.TileEntityElectricityReceiver;
public class TileEntityMachine extends TileEntityElectricityReceiver implements IInventory, ISidedInventory
import universalelectricity.prefab.Vector3;
public class TileEntityMachine extends TileEntity implements IInventory, ISidedInventory
{
public int facing = 0;
private int count = 0;
public ItemStack[] storedItems = new ItemStack[this.getInvSize()];
public int getTickInterval()
{
return 5;
}
private int getInvSize() {
return 1;
}
@ -77,11 +74,6 @@ public class TileEntityMachine extends TileEntityElectricityReceiver implements
this.facing = par1NBTTagCompound.getInteger("facing");
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canUpdate()
{
return true;
@ -94,9 +86,10 @@ public class TileEntityMachine extends TileEntityElectricityReceiver implements
{
super.updateEntity();
if(!worldObj.isRemote)
if(count ++ >= 10 && !worldObj.isRemote)
{
PacketManager.sendTileEntityPacket(this, SteamPowerMain.channel, getSendData());
Packet packet = PacketManager.getPacket(SteamPowerMain.channel,this, getSendData());
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 40);
}
}
@ -220,15 +213,4 @@ public class TileEntityMachine extends TileEntityElectricityReceiver implements
// TODO Auto-generated method stub
}
@Override
public void onReceive(TileEntity sender, double amps, double voltage,
ForgeDirection side) {
// TODO Auto-generated method stub
}
@Override
public double wattRequest() {
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -1,32 +0,0 @@
package steampower;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.implement.IElectricityReceiver;
public class TileEntityNuller extends TileEntityMachine implements IElectricityReceiver {
@Override
public boolean canReceiveFromSide(ForgeDirection side)
{
return true;
}
public double wattRequest()
{
return 400;
}
@Override
public double getVoltage()
{
return 1000;
}
@Override
public int getTickInterval()
{
return 20;
}
@Override
public boolean canConnect(ForgeDirection side)
{
return true;
}
}

View file

@ -176,11 +176,11 @@ public class TileEntityBoiler extends TileEntityMachine implements IPacketReceiv
if(blockE instanceof IHeatProducer)
{
this.isBeingHeated = true;
heatStored = (int) Math.min((heatStored + ((IHeatProducer)blockE).onProduceHeat(SteamPowerMain.fireOutput*getTickInterval(), 1)), heatMax);
heatStored = (int) Math.min((heatStored + ((IHeatProducer)blockE).onProduceHeat(SteamPowerMain.fireOutput, 1)), heatMax);
}
else if(worldObj.getBlockId(xCoord, yCoord-1, zCoord) == Block.lavaStill.blockID)
{
heatStored += (int) Math.min((int)(random.nextDouble()*10)*getTickInterval(), heatMax);
heatStored += (int) Math.min((int)(random.nextDouble()*10), heatMax);
}
}
super.updateEntity();

View file

@ -24,27 +24,33 @@ import com.google.common.io.ByteArrayDataInput;
public class TileEntitySteamPiston extends TileEntityMachine implements IPacketReceiver,ILiquidConsumer,ILiquidProducer,IMechenical
{
public int force = 0;
private int force = 0;
public int aForce = 0;
private int frictionLoad = 10;
public int steam = 0;
public int water = 0;
public int maxWater = 1;
public int maxWater = 2;
public int maxSteam = 10;
public int pos = 0; //max at 7
private int tickCount = 0;
private int runTime = 0;
private int genRate = 0;//max 100
private int posCount = 0;
private ForgeDirection frontDir;
private ForgeDirection backDir;
public TileEntity bb;
public TileEntity ff;
public boolean running= false;
@Override
public void updateEntity()
{
super.updateEntity();
if(tickCount++ >=10)
{
//++runTime;
//pos += 1;if(pos > 7){pos =0;} //for testing
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
int nMeta = 0;
switch(meta)
@ -56,43 +62,54 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
}
frontDir = ForgeDirection.getOrientation(nMeta);
backDir = ForgeDirection.getOrientation(nMeta).getOpposite();
bb = worldObj.getBlockTileEntity(xCoord+backDir.offsetX, yCoord+1, zCoord+backDir.offsetZ);
ff = worldObj.getBlockTileEntity(xCoord+frontDir.offsetX, yCoord+1, zCoord+frontDir.offsetZ);
if(this.runTime > 0)
{
this.running = true;
}else
{
this.running = false;
}
if(this.running)
{
int countA = 10 - (genRate/10);
if(posCount++ >=countA)
{
posCount = 0;
pos += 1;if(pos > 7){pos =0;}
}
}
if(bb instanceof TileEntitySteamPiston)
{
this.pos = ((TileEntitySteamPiston) bb).pos + 1;
if(this.pos > 7){pos = 0;}
}
if(!worldObj.isRemote)
{
if(this.runTime < 0 && this.steam > 0)
if(this.runTime <= 0 && this.steam > 0)
{
this.steam--;
this.runTime+=60;
this.runTime+=30;
}else
if(this.runTime > 0)
{
this.running = true;
this.runTime-=1;
}else
{
this.running = false;
this.force = genRate * 10;
}
TileEntity ff = worldObj.getBlockTileEntity(xCoord+frontDir.offsetX, yCoord+1, zCoord+frontDir.offsetZ);
TileEntity bb = worldObj.getBlockTileEntity(xCoord+backDir.offsetX, yCoord+1, zCoord+backDir.offsetZ);
if(ff instanceof IMechenical)
{
((IMechenical) ff).applyForce(this.aForce);
}
if(bb instanceof TileEntitySteamPiston)
if(genRate <=0 && runTime > 0)
{
this.pos = ((TileEntitySteamPiston) bb).pos + 1;
if(this.pos > 7)
{
pos = 0;
}
genRate++;
}else
if(this.running)
{
this.pos += 1;
if(this.pos > 7)
{
pos = 0;
}
genRate--;
}
}
}
}
@ -126,6 +143,7 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
@Override
public double applyForce(int force) {
this.aForce = this.force + force- frictionLoad;
return aForce;
}
@ -173,7 +191,7 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
public int onReceiveLiquid(Liquid type, int vol, ForgeDirection side) {
if(type == Liquid.STEAM)
{
int rejectedSteam = Math.max((this.steam + vol) - this.getLiquidCapacity(Liquid.STEAM), 0);
int rejectedSteam = Math.max((this.steam + vol) - this.maxSteam, 0);
this.steam += vol - rejectedSteam;
return rejectedSteam;
}
@ -219,7 +237,7 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
//----------------
public Object[] getSendData()
{
return new Object[]{steam,water,force,aForce,pos};
return new Object[]{steam,water,force,aForce,genRate,runTime};
}
@Override
public void handlePacketData(NetworkManager network,Packet250CustomPayload packet, EntityPlayer player,ByteArrayDataInput dataStream) {
@ -229,7 +247,9 @@ public class TileEntitySteamPiston extends TileEntityMachine implements IPacketR
this.water = dataStream.readInt();
this.force = dataStream.readInt();
this.aForce = dataStream.readInt();
this.pos = dataStream.readInt();
this.genRate= dataStream.readInt();
this.runTime = dataStream.readInt();
//System.out.print("Packet \n");
}
catch(Exception e)
{

View file

@ -11,14 +11,14 @@ import steampower.turbine.TileEntitySteamPiston;
import universalelectricity.electricity.ElectricInfo;
import universalelectricity.electricity.ElectricInfo.ElectricUnit;
public class GUIGenerator extends GuiContainer
public class GUISteamPiston extends GuiContainer
{
private TileEntitySteamPiston tileEntity;
private int containerWidth;
private int containerHeight;
public GUIGenerator(InventoryPlayer par1InventoryPlayer, TileEntitySteamPiston tileEntity)
public GUISteamPiston(InventoryPlayer par1InventoryPlayer, TileEntitySteamPiston tileEntity)
{
super(new ContainerGenerator(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
@ -29,11 +29,13 @@ import universalelectricity.electricity.ElectricInfo.ElectricUnit;
*/
protected void drawGuiContainerForegroundLayer()
{
this.fontRenderer.drawString("Steam Engine MkI", 55, 6, 4210752);
this.fontRenderer.drawString("Steam Piston Guage Read outs", 55, 6, 4210752);
this.fontRenderer.drawString("MeterReadings", 90, 33, 4210752);
String displayText = "";
String displayText2 = "";
String displayText3 = "";
String displayText4 = "";
String displayText5 = "";
/**
if(tileEntity.connectedElectricUnit == null)
{
@ -54,13 +56,17 @@ import universalelectricity.electricity.ElectricInfo.ElectricUnit;
else
{
//displayText = ElectricUnit.getWattDisplay((int)(tileEntity.generateRate*20));
displayText = "Force: "+tileEntity.force+"N";
displayText = "ForceOut: "+tileEntity.aForce+"N";
}
displayText2 = "water" + "-" + tileEntity.water;
displayText3 = "steam" + "-" + tileEntity.steam;
if(tileEntity.bb != null){displayText4 = "Debug:bb" + "=" + tileEntity.bb.toString();}
if(tileEntity.ff != null){displayText5 = "Debugff" + "=" + tileEntity.ff.toString();}
this.fontRenderer.drawString(displayText, (int)(105-displayText.length()*1), 45, 4210752);
this.fontRenderer.drawString(displayText2, (int)(105-displayText.length()*1), 55, 4210752);
this.fontRenderer.drawString(displayText3, (int)(105-displayText.length()*1), 65, 4210752);
// this.fontRenderer.drawString(displayText4, (int)(105-displayText.length()*1), 75, 4210752);
// this.fontRenderer.drawString(displayText5, (int)(105-displayText.length()*1), 85, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}

View file

@ -1,48 +0,0 @@
package steampower;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import steampower.turbine.TileEntitySteamPiston;
public class RenderSteamEngine extends TileEntitySpecialRenderer
{
int type = 0;
private ModelEngine model;
public RenderSteamEngine()
{
model = new ModelEngine();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float d3) {
bindTextureByName(SteamPowerMain.textureFile+"Engine.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
float p = ((TileEntitySteamPiston)tileEntity).pos;
//boolean cc = ((TileEntitySteamPiston)tileEntity).isConnected;
int meta = ((TileEntityMachine) tileEntity).getDirection();
switch(meta)
{
case 1:GL11.glRotatef(0f, 0f, 1f, 0f);break;
case 2:GL11.glRotatef(90f, 0f, 1f, 0f);break;
case 3:GL11.glRotatef(180f, 0f, 1f, 0f);break;
case 4:GL11.glRotatef(270f, 0f, 1f, 0f);break;
}
model.renderTop(0.0625F);
model.renderMid(0.0625F,p);
model.renderBot(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -45,7 +45,7 @@ public class ModelGearPiston extends ModelBase
ModelRenderer RigthF1;
ModelRenderer RigthGCC;
ModelRenderer RightSlide;
ModelRenderer LeftSlide;
ModelRenderer midRod;
ModelRenderer RightRod2;
ModelRenderer LeftGCC;
ModelRenderer LeftRod2;
@ -242,12 +242,12 @@ public class ModelGearPiston extends ModelBase
LeftRod2.setTextureSize(128, 128);
LeftRod2.mirror = true;
setRotation(LeftRod2, 0F, 0F, 0F);
LeftSlide = new ModelRenderer(this, 0, 32);
LeftSlide.addBox(-1F, -2F, -2F, 1, 7, 4);
LeftSlide.setRotationPoint(4F, 0F, 0F);
LeftSlide.setTextureSize(128, 128);
LeftSlide.mirror = true;
setRotation(LeftSlide, 0F, 0F, 0F);
midRod = new ModelRenderer(this, 0, 32);
midRod.addBox(-1F, -2F, -2F, 1, 7, 4);
midRod.setRotationPoint(4F, 0F, 0F);
midRod.setTextureSize(128, 128);
midRod.mirror = true;
setRotation(midRod, 0F, 0F, 0F);
}
public void renderBody(float f5)
{
@ -271,16 +271,78 @@ public class ModelGearPiston extends ModelBase
}
public void renderR(float f5,int pos)
{
int change = pos/2;
switch(pos)
{
case 0:
RSpiston.setRotationPoint(1F, 3F, 0F);
LSpiston.setRotationPoint(2F, 3F, 0F);
RodPiston.setRotationPoint(0F, 8F, 0F);
setRotation(RSpiston, 0F, 0F, 0F);
setRotation(LSpiston, 0F, 0F, 0F);
break;
case 1:
RodPiston.setRotationPoint(0F, 6F, 0F);
LSpiston.setRotationPoint(2F, 2F, 2F);
RSpiston.setRotationPoint(1F, 2F, 2F);
setRotation(LSpiston, -0.5235988F, 0F, 0F);
setRotation(RSpiston, -0.5235988F, 0F, 0F);
break;
case 2:
LSpiston.setRotationPoint(2F, 0F, 3F);
RSpiston.setRotationPoint(1F, 0F, 3F);
RodPiston.setRotationPoint(0F, 3F, 0F);
setRotation(RSpiston, -1.047198F, 0F, 0F);
setRotation(LSpiston, -1.047198F, 0F, 0F);
break;
case 3:
LSpiston.setRotationPoint(2F, -2F, 2F);
RSpiston.setRotationPoint(1F, -2F, 2F);
RodPiston.setRotationPoint(0F, 1F, 0F);
setRotation(LSpiston, -0.7853982F, 0F, 0F);
setRotation(RSpiston, -0.7853982F, 0F, 0F);
break;
case 4:
LSpiston.setRotationPoint(2F, -3F, 0F);
RSpiston.setRotationPoint(1F, -3F, 0F);
RodPiston.setRotationPoint(0F, 1F, 0F);
setRotation(LSpiston, 0F, 0F, 0F);
setRotation(RSpiston, 0F, 0F, 0F);
break;
case 5:
LSpiston.setRotationPoint(2F, -2F, -2F);
RSpiston.setRotationPoint(1F, -2F, -2F);
RodPiston.setRotationPoint(0F, 1F, 0F);
setRotation(LSpiston, 0.7853982F, 0F, 0F);
setRotation(RSpiston, 0.7853982F, 0F, 0F);
break;
case 6:
RSpiston.setRotationPoint(1F, 0F, -3F);
LSpiston.setRotationPoint(2F, 0F, -3F);
RodPiston.setRotationPoint(0F, 2F, 0F);
setRotation(RSpiston, 1.047198F, 0F, 0F);
setRotation(LSpiston, 1.047198F, 0F, 0F);
break;
case 7:
RodPiston.setRotationPoint(0F, 6F, 0F);
LSpiston.setRotationPoint(2F, 2F, -2F);
RSpiston.setRotationPoint(1F, 2F, -2F);
setRotation(LSpiston, 0.5235988F, 0F, 0F);
setRotation(RSpiston, 0.5235988F, 0F, 0F);
break;
}
//Piston Arm
RSpiston.render(f5);
LSpiston.render(f5);
RodPiston.render(f5);
RodPiston.setRotationPoint(0, 8f-change, 0);
//GearShaft
RightSlide.rotateAngleX = 0.7853982F * pos;
midRod.rotateAngleX = 0.7853982F * pos;
midRod.rotateAngleX = 0.7853982F * pos;
RightRod2.rotateAngleX = 0.7853982F * pos;
LeftRod2.rotateAngleX = 0.7853982F * pos;
LeftSlide2.rotateAngleX = 0.7853982F * pos;
RightSlide.render(f5);
LeftSlide.render(f5);
midRod.render(f5);
RightRod2.render(f5);
LeftRod2.render(f5);
LeftSlide2.render(f5);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB