Merge branch 'development' of https://bitbucket.org/calclavia/resonant-induction into development
This commit is contained in:
commit
4b9c08015e
10 changed files with 47 additions and 36 deletions
|
@ -184,8 +184,8 @@ public class Electrical
|
|||
GameRegistry.addRecipe(new ShapedOreRecipe(tierThreeBattery, "RRR", "RIR", "RRR", 'R', tierTwoBattery, 'I', Block.blockDiamond));
|
||||
|
||||
/** Wires **/
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(itemInsulation, Item.slimeBall, new ItemStack(Block.cloth, 2, OreDictionary.WILDCARD_VALUE)));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(itemInsulation, "slimeball", new ItemStack(Block.cloth, 2, OreDictionary.WILDCARD_VALUE)));
|
||||
//GameRegistry.addRecipe(new ShapelessOreRecipe(itemInsulation, Item.slimeBall, new ItemStack(Block.cloth, 2, OreDictionary.WILDCARD_VALUE)));
|
||||
//GameRegistry.addRecipe(new ShapelessOreRecipe(itemInsulation, "slimeball", new ItemStack(Block.cloth, 2, OreDictionary.WILDCARD_VALUE)));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.TIN.getWire(3), "MMM", 'M', "ingotTin"));
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -34,7 +35,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
|
||||
public EnumWireMaterial material = EnumWireMaterial.COPPER;
|
||||
public boolean isInsulated = false;
|
||||
protected Item insulationType = Electrical.itemInsulation;
|
||||
protected ItemStack insulationType = new ItemStack(Block.cloth);
|
||||
|
||||
/** INTERNAL USE. Can this conductor connect with an external object? */
|
||||
@Override
|
||||
|
@ -205,13 +206,13 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
this.setColor(dyeColor);
|
||||
return true;
|
||||
}
|
||||
else if (itemStack.getItem() == insulationType)
|
||||
else if (itemStack.itemID == insulationType.itemID)
|
||||
{
|
||||
if (this.isInsulated())
|
||||
{
|
||||
if (!world().isRemote && player.capabilities.isCreativeMode)
|
||||
{
|
||||
tile().dropItems(Collections.singletonList(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color))));
|
||||
tile().dropItems(Collections.singletonList(insulationType));
|
||||
}
|
||||
|
||||
this.setInsulated(false);
|
||||
|
@ -232,7 +233,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
{
|
||||
if (!world().isRemote && !player.capabilities.isCreativeMode)
|
||||
{
|
||||
tile().dropItems(Collections.singletonList(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color))));
|
||||
tile().dropItems(Collections.singletonList(insulationType));
|
||||
}
|
||||
|
||||
this.setInsulated(false);
|
||||
|
@ -257,7 +258,7 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
|
||||
if (this.isInsulated)
|
||||
{
|
||||
drops.add(new ItemStack(insulationType, 1, BlockColored.getBlockFromDye(color)));
|
||||
drops.add(insulationType.copy());
|
||||
}
|
||||
|
||||
return drops;
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package resonantinduction.mechanical.process.crusher;
|
||||
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMechanicalPiston extends TileEntitySpecialRenderer
|
||||
{
|
||||
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "rejector.tcn");
|
||||
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "rejector.png");
|
||||
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "piston/mechanicalPiston.tcn");
|
||||
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "piston/mechanicalPiston_iron.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
|
@ -25,43 +25,53 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
TileMechanicalPiston tile = (TileMechanicalPiston) tileEntity;
|
||||
|
||||
GL11.glRotated(-90, 0, 1, 0);
|
||||
GL11.glRotated(180, 0, 0, 1);
|
||||
|
||||
if (tile.worldObj != null)
|
||||
{
|
||||
RenderUtility.rotateBlockBasedOnDirection(tile.getDirection());
|
||||
}
|
||||
|
||||
RenderUtility.bind(TEXTURE);
|
||||
|
||||
// Angle in radians of the rotor.
|
||||
float angle = (float) tile.mechanicalNode.angle;
|
||||
float radius = 0.5f;
|
||||
// Length of piston arm
|
||||
float length = 0.8f;
|
||||
|
||||
double beta = Math.asin((radius * Math.sin(angle)) / (length / 2));
|
||||
|
||||
/**
|
||||
* Render Piston Rod
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
double pistonTranslateX = 2 * length * Math.cos(beta);
|
||||
double pistonTranslateY = 2 * length * Math.sin(beta);
|
||||
|
||||
GL11.glTranslated(0, pistonTranslateY, pistonTranslateX);
|
||||
GL11.glRotated(-Math.toDegrees(beta), 1, 0, 0);
|
||||
// MODEL.renderOnly("PistonShaft", "PistonFace", "PistonFace2");
|
||||
GL11.glPopMatrix();
|
||||
double angle = tile.mechanicalNode.angle;
|
||||
final String[] staticParts = { "baseRing", "leg1", "leg2", "leg3", "leg4", "connector", "basePlate", "basePlateTop", "connectorBar", "centerPiston" };
|
||||
final String[] shaftParts = { "topPlate", "outerPiston" };
|
||||
|
||||
/**
|
||||
* Render Piston Rotor
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
// TODO: Temporary, unless new models come out.
|
||||
GL11.glTranslated(0, 0, (0.06 * Math.sin(angle)) - 0.01);
|
||||
MODEL.renderOnly("PistonShaft", "PistonFace", "PistonFace2");
|
||||
GL11.glRotated(-Math.toDegrees(angle), 0, 0, 1);
|
||||
MODEL.renderAllExcept(ArrayUtils.addAll(shaftParts, staticParts));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
MODEL.renderAllExcept("PistonShaft", "PistonFace", "PistonFace2");
|
||||
/**
|
||||
* Render Piston Shaft
|
||||
*/
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tile.worldObj != null)
|
||||
{
|
||||
ForgeDirection dir = tile.getDirection();
|
||||
|
||||
if (tile.world().isAirBlock(tile.x() + dir.offsetX, tile.y() + dir.offsetY, tile.z() + dir.offsetZ))
|
||||
{
|
||||
GL11.glTranslated(0, 0, (0.4 * Math.sin(angle)) - 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslated(0, 0, (0.06 * Math.sin(angle)) - 0.03);
|
||||
}
|
||||
}
|
||||
|
||||
MODEL.renderOnly(shaftParts);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
MODEL.renderOnly(staticParts);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 4 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in a new issue