Fixed conveyor belt sound and animation
This commit is contained in:
parent
bf574c7c8c
commit
028ff3fc1a
5 changed files with 12 additions and 10 deletions
|
@ -17,7 +17,7 @@ public class SoundHandler
|
|||
{
|
||||
public static final SoundHandler INSTANCE = new SoundHandler();
|
||||
|
||||
public static final String[] SOUND_FILES = { "hammer.ogg", "grinder1.ogg", "grinder2.ogg", "grinder3.ogg", "grinder4.ogg", "electricshock1.ogg", "electricshock2.ogg", "electricshock3.ogg", "electricshock4.ogg", "electricshock5.ogg", "electricshock6.ogg", "electricshock7.ogg" };
|
||||
public static final String[] SOUND_FILES = { "hammer.ogg", "grinder1.ogg", "grinder2.ogg", "grinder3.ogg", "grinder4.ogg", "electricshock1.ogg", "electricshock2.ogg", "electricshock3.ogg", "electricshock4.ogg", "electricshock5.ogg", "electricshock6.ogg", "electricshock7.ogg" , "conveyor.ogg" };
|
||||
|
||||
@ForgeSubscribe
|
||||
public void loadSoundEvents(SoundLoadEvent event)
|
||||
|
|
|
@ -102,7 +102,7 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer implements ICu
|
|||
bindTexture(name);
|
||||
GL11.glRotatef(180, 0f, 1f, 0f);
|
||||
GL11.glTranslatef(0f, -0.68f, 0f);
|
||||
MODEL.render(0.0625f, (float) Math.toRadians(tileEntity.getNetwork().getRotation()), false, false, false, false);
|
||||
MODEL.render(0.0625f, (float) Math.toRadians(tileEntity.angle), false, false, false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -124,7 +124,7 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer implements ICu
|
|||
}
|
||||
ResourceLocation name = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "belt/frame" + frame + ".png");
|
||||
bindTexture(name);
|
||||
MODEL.render(0.0625F, (float) Math.toRadians(tileEntity.getNetwork().getRotation()), false, false, false, true);
|
||||
MODEL.render(0.0625F, (float) Math.toRadians(tileEntity.angle), false, false, false, true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.IBelt;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.network.IMechanical;
|
||||
|
@ -76,11 +77,12 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
|||
{
|
||||
if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(this.xCoord - 1, this.yCoord, this.zCoord) != Mechanical.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != Mechanical.blockConveyorBelt.blockID)
|
||||
{
|
||||
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "mods.assemblyline.conveyor", 0.5f, 0.7f, true);
|
||||
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "conveyor", 0.5f, 0.7f, true);
|
||||
}
|
||||
|
||||
angle += Math.abs(angularVelocity / 20);
|
||||
double beltPercentage = (angle % Math.PI) / Math.PI;
|
||||
angle = getNetwork().getRotation(getMoveVelocity());
|
||||
// (float) ((angle + getMoveVelocity() / 20) % Math.PI);
|
||||
double beltPercentage = angle / (2 * Math.PI);
|
||||
|
||||
// Sync the animation. Slant belts are slower.
|
||||
if (this.getSlant() == SlantType.NONE || this.getSlant() == SlantType.TOP)
|
||||
|
|
|
@ -10,7 +10,7 @@ import universalelectricity.api.net.INetwork;
|
|||
public interface IMechanicalNetwork extends INetwork<IMechanicalNetwork, IMechanical>
|
||||
{
|
||||
/**
|
||||
* @return The current rotation value of the network.
|
||||
* @return The current rotation value of the network. Used for syncing rotational values.
|
||||
*/
|
||||
public float getRotation();
|
||||
public float getRotation(float velocity);
|
||||
}
|
||||
|
|
|
@ -144,13 +144,13 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getRotation()
|
||||
public float getRotation(float velocity)
|
||||
{
|
||||
long deltaTime = System.currentTimeMillis() - lastRotateTime;
|
||||
|
||||
if (deltaTime > 1)
|
||||
{
|
||||
rotation = (float) (((0) * (deltaTime / 1000f) + rotation) % (2 * Math.PI));
|
||||
rotation = (float) (((velocity) * (deltaTime / 1000f) + rotation) % (2 * Math.PI));
|
||||
lastRotateTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue