Added tiers for gears: stone and iron gear
This commit is contained in:
parent
daff7a091f
commit
158091519f
7 changed files with 77 additions and 17 deletions
|
@ -51,11 +51,11 @@ public class RenderRIItem implements IItemRenderer
|
||||||
}
|
}
|
||||||
else if (item.getItem() instanceof ItemGear)
|
else if (item.getItem() instanceof ItemGear)
|
||||||
{
|
{
|
||||||
RenderGear.INSTANCE.renderInventory(null, 0, 0, null);
|
RenderGear.INSTANCE.renderInventory(null, item.getItemDamage(), 0, null);
|
||||||
}
|
}
|
||||||
else if (item.getItem() instanceof ItemGearShaft)
|
else if (item.getItem() instanceof ItemGearShaft)
|
||||||
{
|
{
|
||||||
RenderGearShaft.INSTANCE.renderInventory(null, 0, 0, null);
|
RenderGearShaft.INSTANCE.renderInventory(null, item.getItemDamage(), 0, null);
|
||||||
}
|
}
|
||||||
else if (item.getItem() instanceof ItemMultimeter)
|
else if (item.getItem() instanceof ItemMultimeter)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,7 +137,9 @@ public class Mechanical
|
||||||
public void postInit(FMLPostInitializationEvent evt)
|
public void postInit(FMLPostInitializationEvent evt)
|
||||||
{
|
{
|
||||||
// Add recipes
|
// Add recipes
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(itemGear, "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, 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(itemGearShaft, "S", "S", "S", 'S', Item.stick));
|
||||||
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));
|
||||||
|
|
|
@ -7,9 +7,9 @@ import calclavia.lib.multiblock.reference.MultiBlockHandler;
|
||||||
import codechicken.multipart.TMultiPart;
|
import codechicken.multipart.TMultiPart;
|
||||||
import codechicken.multipart.TileMultipart;
|
import codechicken.multipart.TileMultipart;
|
||||||
|
|
||||||
public class MultiPartMultiBlockHandler extends MultiBlockHandler<PartGear>
|
public class GearMultiBlockHandler extends MultiBlockHandler<PartGear>
|
||||||
{
|
{
|
||||||
public MultiPartMultiBlockHandler(PartGear wrapper)
|
public GearMultiBlockHandler(PartGear wrapper)
|
||||||
{
|
{
|
||||||
super(wrapper);
|
super(wrapper);
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,13 @@ public class MultiPartMultiBlockHandler extends MultiBlockHandler<PartGear>
|
||||||
TMultiPart part = ((TileMultipart) tile).partMap(getPlacementSide().ordinal());
|
TMultiPart part = ((TileMultipart) tile).partMap(getPlacementSide().ordinal());
|
||||||
|
|
||||||
if (part instanceof PartGear)
|
if (part instanceof PartGear)
|
||||||
|
{
|
||||||
|
if (((PartGear) part).tier == self.tier)
|
||||||
{
|
{
|
||||||
return (PartGear) part;
|
return (PartGear) part;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
|
@ -1,10 +1,14 @@
|
||||||
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;
|
||||||
import resonantinduction.core.Settings;
|
import resonantinduction.core.Settings;
|
||||||
import resonantinduction.core.prefab.part.ItemMultipartBase;
|
import resonantinduction.core.prefab.part.ItemMultipartBase;
|
||||||
|
import resonantinduction.electrical.wire.EnumWireMaterial;
|
||||||
import codechicken.lib.vec.BlockCoord;
|
import codechicken.lib.vec.BlockCoord;
|
||||||
import codechicken.lib.vec.Vector3;
|
import codechicken.lib.vec.Vector3;
|
||||||
import codechicken.multipart.MultiPartRegistry;
|
import codechicken.multipart.MultiPartRegistry;
|
||||||
|
@ -29,4 +33,13 @@ public class ItemGear extends ItemMultipartBase
|
||||||
|
|
||||||
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,22 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
|
|
||||||
if (getMultiBlock().isPrimary())
|
if (getMultiBlock().isPrimary())
|
||||||
{
|
{
|
||||||
// Decelerate the gear.
|
// Decelerate the gear based on tier.
|
||||||
torque *= 0.95f;
|
switch (tier)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
torque *= 0.9f;
|
||||||
angularVelocity *= 0.95f;
|
angularVelocity *= 0.95f;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
torque *= 0.95f;
|
||||||
|
angularVelocity *= 0.9f;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
torque *= 0.99f;
|
||||||
|
angularVelocity *= 0.99f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -270,7 +283,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
{
|
{
|
||||||
if (pass == 0)
|
if (pass == 0)
|
||||||
{
|
{
|
||||||
RenderGear.INSTANCE.renderDynamic(this, pos.x, pos.y, pos.z, frame);
|
RenderGear.INSTANCE.renderDynamic(this, pos.x, pos.y, pos.z, tier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +310,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
/**
|
/**
|
||||||
* Multiblock
|
* Multiblock
|
||||||
*/
|
*/
|
||||||
private MultiPartMultiBlockHandler multiBlock;
|
private GearMultiBlockHandler multiBlock;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public universalelectricity.api.vector.Vector3[] getMultiBlockVectors()
|
public universalelectricity.api.vector.Vector3[] getMultiBlockVectors()
|
||||||
|
@ -354,7 +367,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock
|
||||||
public MultiBlockHandler<PartGear> getMultiBlock()
|
public MultiBlockHandler<PartGear> getMultiBlock()
|
||||||
{
|
{
|
||||||
if (multiBlock == null)
|
if (multiBlock == null)
|
||||||
multiBlock = new MultiPartMultiBlockHandler(this);
|
multiBlock = new GearMultiBlockHandler(this);
|
||||||
|
|
||||||
return multiBlock;
|
return multiBlock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,22 @@ public class RenderGear
|
||||||
public void renderInventory(Block block, int metadata, int modelID, RenderBlocks renderer)
|
public void renderInventory(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||||
{
|
{
|
||||||
GL11.glRotatef(90, 1, 0, 0);
|
GL11.glRotatef(90, 1, 0, 0);
|
||||||
|
switch (metadata)
|
||||||
|
{
|
||||||
|
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("SmallGear");
|
MODEL.renderOnly("SmallGear");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderDynamic(PartGear part, double x, double y, double z, float frame)
|
public void renderDynamic(PartGear part, double x, double y, double z, int tier)
|
||||||
{
|
{
|
||||||
if (part.getMultiBlock().isPrimary())
|
if (part.getMultiBlock().isPrimary())
|
||||||
{
|
{
|
||||||
|
@ -40,7 +51,18 @@ public class RenderGear
|
||||||
|
|
||||||
GL11.glRotatef((float) Math.toDegrees(part.angle), 0, 1, 0);
|
GL11.glRotatef((float) Math.toDegrees(part.angle), 0, 1, 0);
|
||||||
|
|
||||||
|
switch (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;
|
||||||
|
}
|
||||||
|
|
||||||
if (part.getMultiBlock().isConstructed())
|
if (part.getMultiBlock().isConstructed())
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,9 +51,12 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
/** The current angle the gear is on. In radians. */
|
/** The current angle the gear is on. In radians. */
|
||||||
public float angle = 0;
|
public float angle = 0;
|
||||||
|
|
||||||
|
public int tier;
|
||||||
|
|
||||||
public void preparePlacement(int side, int itemDamage)
|
public void preparePlacement(int side, int itemDamage)
|
||||||
{
|
{
|
||||||
this.placementSide = ForgeDirection.getOrientation((byte) (side ^ 1));
|
this.placementSide = ForgeDirection.getOrientation((byte) (side ^ 1));
|
||||||
|
this.tier = itemDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,8 +65,10 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
if (!world().isRemote)
|
if (!world().isRemote)
|
||||||
{
|
{
|
||||||
System.out.println(this + ":" + getNetwork());
|
System.out.println(this + ":" + getNetwork());
|
||||||
/*for (Object obj : connections)
|
/*
|
||||||
System.out.println(obj);*/
|
* for (Object obj : connections)
|
||||||
|
* System.out.println(obj);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -195,6 +200,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
{
|
{
|
||||||
placementSide = ForgeDirection.getOrientation(nbt.getByte("side"));
|
placementSide = ForgeDirection.getOrientation(nbt.getByte("side"));
|
||||||
angularVelocity = nbt.getFloat("angularVelocity");
|
angularVelocity = nbt.getFloat("angularVelocity");
|
||||||
|
tier = nbt.getByte("tier");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -202,6 +208,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
||||||
{
|
{
|
||||||
nbt.setByte("side", (byte) placementSide.ordinal());
|
nbt.setByte("side", (byte) placementSide.ordinal());
|
||||||
nbt.setFloat("angularVelocity", angularVelocity);
|
nbt.setFloat("angularVelocity", angularVelocity);
|
||||||
|
nbt.setByte("tier", (byte) tier);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract ItemStack getItem();
|
protected abstract ItemStack getItem();
|
||||||
|
|
Loading…
Reference in a new issue