Added stone and iron gear shafts

This commit is contained in:
Calclavia 2014-02-25 22:52:40 +08:00
parent a2338c043a
commit 202c400de8
4 changed files with 59 additions and 6 deletions

View file

@ -162,7 +162,9 @@ public class Mechanical
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 0), "SWS", "W W", "SWS", 'W', "plankWood", 'S', Item.stick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 0), "SWS", "W W", "SWS", 'W', "plankWood", 'S', Item.stick));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 1), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 0), 'W', Block.cobblestone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 1), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 0), 'W', Block.cobblestone));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 2), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 1), 'W', Item.ingotIron)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 2), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 1), 'W', Item.ingotIron));
GameRegistry.addRecipe(new ShapedOreRecipe(itemGearShaft, "S", "S", "S", 'S', Item.stick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGearShaft, 1, 0), "S", "S", "S", 'S', Item.stick));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGearShaft, 1, 1), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 0), 'S', Block.cobblestone));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGearShaft, 1, 2), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 1), 'S', Item.ingotIron));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 4), "III", "GGG", 'I', Item.ingotIron, 'G', itemGear)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 4), "III", "GGG", 'I', Item.ingotIron, 'G', itemGear));
GameRegistry.addRecipe(new ShapedOreRecipe(blockManipulator, "SSS", "SRS", "SCS", 'S', Item.ingotIron, 'C', blockConveyorBelt, 'R', Block.blockRedstone)); GameRegistry.addRecipe(new ShapedOreRecipe(blockManipulator, "SSS", "SRS", "SCS", 'S', Item.ingotIron, 'C', blockConveyorBelt, 'R', Block.blockRedstone));
GameRegistry.addRecipe(new ShapedOreRecipe(blockDetector, "SWS", "SRS", "SWS", 'S', Item.ingotIron, 'W', UniversalRecipe.WIRE.get())); GameRegistry.addRecipe(new ShapedOreRecipe(blockDetector, "SWS", "SRS", "SWS", 'S', Item.ingotIron, 'W', UniversalRecipe.WIRE.get()));

View file

@ -1,5 +1,8 @@
package resonantinduction.mechanical.gear; package resonantinduction.mechanical.gear;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -29,4 +32,13 @@ public class ItemGearShaft extends JItemMultiPart implements IHighlight
return part; return part;
} }
@Override
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo)
{
for (int i = 0; i < 3; i++)
{
listToAddTo.add(new ItemStack(itemID, 1, i));
}
}
} }

View file

@ -45,6 +45,7 @@ public class PartGearShaft extends PartMechanical
ForgeDirection dir = ForgeDirection.getOrientation((byte) (side ^ 1)); ForgeDirection dir = ForgeDirection.getOrientation((byte) (side ^ 1));
// Unwind rotation. We can only have "3" axis. // Unwind rotation. We can only have "3" axis.
this.placementSide = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal()); this.placementSide = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal());
tier = itemDamage;
} }
@Override @Override
@ -54,9 +55,22 @@ public class PartGearShaft extends PartMechanical
if (!this.world().isRemote) if (!this.world().isRemote)
{ {
// Decelerate the gear. // Decelerate the shaft.
switch (tier)
{
default:
torque *= 0.997f;
angularVelocity *= 0.998f;
break;
case 1:
torque *= 0.998f;
angularVelocity *= 0.997f;
break;
case 2:
torque *= 0.99f; torque *= 0.99f;
angularVelocity *= 0.99f; angularVelocity *= 0.999f;
break;
}
} }
} }

View file

@ -24,7 +24,20 @@ public class RenderGearShaft implements ISimpleItemRenderer
public void renderInventoryItem(ItemStack itemStack) public void renderInventoryItem(ItemStack itemStack)
{ {
GL11.glRotatef(90, 1, 0, 0); GL11.glRotatef(90, 1, 0, 0);
switch (itemStack.getItemDamage())
{
default:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png"); RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
break;
case 1:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
break;
case 2:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "iron_block.png");
break;
}
MODEL.renderOnly("Shaft"); MODEL.renderOnly("Shaft");
} }
@ -51,7 +64,19 @@ public class RenderGearShaft implements ISimpleItemRenderer
GL11.glRotatef((float) Math.toDegrees(part.angle), 0, 1, 0); GL11.glRotatef((float) Math.toDegrees(part.angle), 0, 1, 0);
switch (part.tier)
{
default:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png"); RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
break;
case 1:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
break;
case 2:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "iron_block.png");
break;
}
MODEL.renderOnly("Shaft"); MODEL.renderOnly("Shaft");
GL11.glPopMatrix(); GL11.glPopMatrix();