Fixed up slanted belt render

This commit is contained in:
Henry Mao 2013-01-10 19:50:11 +08:00
parent 370681e042
commit 7d822b0cee
14 changed files with 167 additions and 87 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@ CHANGELOG
!/models/
!info.txt
!publish.bat
!publish_obf.bat
!include.bat
!buildlocal.bat
!/README

52
publish_obf.bat Normal file
View file

@ -0,0 +1,52 @@
::ASSEMBLY LINE BUILDER
@echo off
echo Promotion Type? (Choose * for recommended, @ for stable and x for unstable)
set /p PROMOTION=
set /p MODVERSION=<modversion.txt
set /p CurrentBuild=<buildnumber.txt
set /a BUILD_NUMBER=%CurrentBuild%+1
set NAME=AssemblyLine_v%MODVERSION%.%BUILD_NUMBER%
set FILE_NAME=%NAME%.jar
set TEMP_FILE=%NAME%_temp.jar
set TEMP_FILE2=%NAME%_temp2.jar
set TEMP_FOLDER=%NAME%_temp
set API_NAME=%NAME%_api.zip
set BACKUP_NAME=%NAME%_backup.zip
echo Starting to build %NAME%
::BUILD
::runtime\bin\python\python_mcp runtime\recompile.py %*
::runtime\bin\python\python_mcp runtime\reobfuscate.py %*
::ZIP-UP
cd reobf\minecraft\
"..\..\..\7za.exe" a "..\..\builds\%TEMP_FILE_NAME%" "*"
cd ..\..\
cd resources\
"..\..\7za.exe" a "..\builds\%FILE_NAME%" "*"
"..\..\7za.exe" a "..\builds\%BACKUP_NAME%" "*" -pdarkguardsman
cd ..\
cd src\
"..\..\7za.exe" a "..\builds\%BACKUP_NAME%" "*\assemblyline\" -pdarkguardsman
"..\..\7za.exe" a "..\builds\%API_NAME%" "*\assemblyline\api\"
cd ..\
::Obfuscation
echo Injector Minecraft Source
cd obf_minecraft
"..\..\7za.exe" a "..\builds\%TEMP_FILE_NAME%" "*"
cd ..\
echo Obfuscating...
java -jar "retroguard.jar" "builds\%TEMP_FILE_NAME%" "builds\%TEMP_FILE2%" obf.rgs
echo Repacking
"..\7za.exe" x "builds\%TEMP_FILE_NAME%" "builds\%TEMP_FOLDER%"
cd "builds\%TEMP_FOLDER%"
"..\..\..\7za.exe" a "..\..\builds\%FILE_NAME%" "*"
cd ..\..\
echo Done building %NAME%
pause

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,018 B

View file

@ -16,86 +16,86 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderConveyorBelt extends TileEntitySpecialRenderer
{
private ModelConveyorBelt model = new ModelConveyorBelt();
private ModelAngledBelt model2 = new ModelAngledBelt();
public static final ModelConveyorBelt MODEL = new ModelConveyorBelt();
public static final ModelAngledBelt MODEL2 = new ModelAngledBelt();
private void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f)
{
boolean mid = tileEntity.getIsMiddleBelt();
SlantType slantType = tileEntity.getSlant();
int face = tileEntity.getDirection().ordinal();
private void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f)
{
boolean mid = tileEntity.getIsMiddleBelt();
SlantType slantType = tileEntity.getSlant();
int face = tileEntity.getDirection().ordinal();
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glRotatef(180f, 0f, 0f, 1f);
int frame = tileEntity.getAnimationFrame();
int frame = tileEntity.getAnimationFrame();
if (slantType != null && slantType != SlantType.NONE)
{
switch (face)
{
case 2:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 4:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 5:
GL11.glRotatef(-90f, 0f, 1f, 0f);
break;
}
if (slantType == SlantType.UP)
{
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "slantedbelt/Upframe0.png");
//GL11.glRotatef(-90f, 1f, 0f, 0f);
model2.render(0.0625F);
}
else if (slantType == SlantType.DOWN)
{
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "slantedbelt/frame"+frame+".png");
GL11.glRotatef(180f, 0f, 1f, 0f);
model2.render(0.0625F);
if (slantType != null && slantType != SlantType.NONE)
{
switch (face)
{
case 2:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 4:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 5:
GL11.glRotatef(-90f, 0f, 1f, 0f);
break;
}
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "slantedbelt/frame" + frame + ".png");
}
}
else
{
switch (face)
{
case 2:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 4:
GL11.glRotatef(-90f, 0f, 1f, 0f);
break;
case 5:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
}
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "belt/frame" + frame + ".png");
model.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false);
if (slantType == SlantType.UP)
{
GL11.glTranslatef(0f, 0.8f, -0.8f);
GL11.glRotatef(180f, 0f, 1f, 1f);
MODEL2.render(0.0625F);
}
else
{
GL11.glRotatef(180f, 0f, 1f, 0f);
MODEL2.render(0.0625F);
}
}
else
{
switch (face)
{
case 2:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
case 3:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 4:
GL11.glRotatef(-90f, 0f, 1f, 0f);
break;
case 5:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
}
}
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "belt/frame" + frame + ".png");
MODEL.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false);
int ent = tileEntity.worldObj.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
}
GL11.glPopMatrix();
int ent = tileEntity.worldObj.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
}
GL11.glPopMatrix();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityConveyorBelt) tileEntity, var2, var4, var6, var8);
}
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityConveyorBelt) tileEntity, var2, var4, var6, var8);
}
}

View file

@ -144,7 +144,7 @@ public class AssemblyLine
GameRegistry.addRecipe(new ShapedOreRecipe(blockCrate, new Object[] { "TST", "S S", "TST", 'S', "ingotSteel", 'T', Item.stick }));
// Conveyor Belt
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 8), new Object[] { "III", "WMW", 'I', "ingotSteel", 'W', Block.wood, 'M', "motor" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 10), new Object[] { "III", "WMW", 'I', "ingotSteel", 'W', Block.wood, 'M', "motor" }));
// Rejector
GameRegistry.addRecipe(new ShapedOreRecipe(blockRejector, new Object[] { "WPW", "@R@", '@', "plateSteel", 'R', Item.redstone, 'P', Block.pistonBase, 'C', "basicCircuit", 'W', "copperWire" }));

View file

@ -32,7 +32,8 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
NONE, UP, DOWN
}
public static final int NUM_FRAMES = 13;
public static final int MAX_FRAME = 13;
public static final int MAX_SLANT_FRAME = 23;
/**
* Joules required to run this thing.
@ -41,14 +42,12 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
public final float maxSpeed = 0.1f;
public float wheelRotation = 0;
public int animFrame = 0; // this is from 0 to 15
private int animFrame = 0; // this is from 0 to 15
private SlantType slantType = SlantType.NONE;
public TileEntityConveyorBelt()
{
super();
// ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN,
// ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH));
ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN));
}
@ -120,18 +119,30 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
if (this.isRunning())
{
// System.out.println(FMLCommonHandler.instance().getEffectiveSide());
this.wheelRotation += 40;
if (this.wheelRotation > 360)
this.wheelRotation = 0;
float wheelRotPct = wheelRotation / 360f;
animFrame = (int) (wheelRotPct * NUM_FRAMES); // sync the animation
if (animFrame < 0)
animFrame = 0;
if (animFrame > NUM_FRAMES)
animFrame = NUM_FRAMES;
// Sync the animation. Slant belts are slower.
if (this.getSlant() == SlantType.NONE)
{
this.animFrame = (int) (wheelRotPct * MAX_FRAME);
if (this.animFrame < 0)
this.animFrame = 0;
if (this.animFrame > MAX_FRAME)
this.animFrame = MAX_FRAME;
}
else
{
this.animFrame = (int) (wheelRotPct * MAX_SLANT_FRAME);
if (this.animFrame < 0)
this.animFrame = 0;
if (this.animFrame > MAX_SLANT_FRAME)
this.animFrame = MAX_SLANT_FRAME;
}
}
}
@ -263,15 +274,31 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
public int getAnimationFrame()
{
TileEntity te = null;
te = worldObj.getBlockTileEntity(xCoord - 1, yCoord, zCoord);
te = this.worldObj.getBlockTileEntity(this.xCoord - 1, this.yCoord, this.zCoord);
if (te != null)
{
if (te instanceof TileEntityConveyorBelt)
return ((TileEntityConveyorBelt) te).getAnimationFrame();
te = worldObj.getBlockTileEntity(xCoord, yCoord, zCoord - 1);
{
if (((TileEntityConveyorBelt) te).getSlant() == this.slantType)
return ((TileEntityConveyorBelt) te).getAnimationFrame();
}
}
te = this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord - 1);
if (te != null)
{
if (te instanceof TileEntityConveyorBelt)
return ((TileEntityConveyorBelt) te).getAnimationFrame();
return animFrame;
{
if (((TileEntityConveyorBelt) te).getSlant() == this.slantType)
return ((TileEntityConveyorBelt) te).getAnimationFrame();
}
}
return this.animFrame;
}
/**