change package names
This commit is contained in:
parent
3e70accb76
commit
d08d0e11fc
1246 changed files with 9285 additions and 9272 deletions
5
java/src/common/sound/EventType.java
Normal file
5
java/src/common/sound/EventType.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package common.sound;
|
||||
|
||||
public enum EventType {
|
||||
SOUND_EFFECT, UI_INTERFACE;
|
||||
}
|
20
java/src/common/sound/MovingSound.java
Executable file
20
java/src/common/sound/MovingSound.java
Executable file
|
@ -0,0 +1,20 @@
|
|||
package common.sound;
|
||||
|
||||
import common.init.SoundEvent;
|
||||
|
||||
public abstract class MovingSound extends Sound
|
||||
{
|
||||
protected boolean donePlaying = false;
|
||||
|
||||
protected MovingSound(SoundEvent event)
|
||||
{
|
||||
super(event);
|
||||
}
|
||||
|
||||
public boolean isDonePlaying()
|
||||
{
|
||||
return this.donePlaying;
|
||||
}
|
||||
|
||||
public abstract void update();
|
||||
}
|
47
java/src/common/sound/MovingSoundMinecart.java
Executable file
47
java/src/common/sound/MovingSoundMinecart.java
Executable file
|
@ -0,0 +1,47 @@
|
|||
package common.sound;
|
||||
|
||||
import common.entity.item.EntityCart;
|
||||
import common.init.SoundEvent;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class MovingSoundMinecart extends MovingSound
|
||||
{
|
||||
private final EntityCart minecart;
|
||||
private float distance = 0.0F;
|
||||
|
||||
public MovingSoundMinecart(EntityCart minecartIn)
|
||||
{
|
||||
super(SoundEvent.CART);
|
||||
this.minecart = minecartIn;
|
||||
this.repeat = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
if (this.minecart.dead)
|
||||
{
|
||||
this.donePlaying = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.xPosF = (float)this.minecart.posX;
|
||||
this.yPosF = (float)this.minecart.posY;
|
||||
this.zPosF = (float)this.minecart.posZ;
|
||||
float f = ExtMath.sqrtd(this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ);
|
||||
|
||||
if ((double)f >= 0.01D)
|
||||
{
|
||||
this.distance = ExtMath.clampf(this.distance + 0.0025F, 0.0F, 1.0F);
|
||||
this.volume = 0.0F + ExtMath.clampf(f, 0.0F, 0.5F) * 0.7F;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.distance = 0.0F;
|
||||
this.volume = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
45
java/src/common/sound/MovingSoundMinecartRiding.java
Executable file
45
java/src/common/sound/MovingSoundMinecartRiding.java
Executable file
|
@ -0,0 +1,45 @@
|
|||
package common.sound;
|
||||
|
||||
import common.entity.item.EntityCart;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.SoundEvent;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public class MovingSoundMinecartRiding extends MovingSound
|
||||
{
|
||||
private final EntityNPC player;
|
||||
private final EntityCart minecart;
|
||||
|
||||
public MovingSoundMinecartRiding(EntityNPC playerRiding, EntityCart minecart)
|
||||
{
|
||||
super(SoundEvent.CART_INSIDE);
|
||||
this.player = playerRiding;
|
||||
this.minecart = minecart;
|
||||
this.attenuationType = false;
|
||||
this.repeat = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
if (!this.minecart.dead && this.player.isRiding() && this.player.vehicle == this.minecart)
|
||||
{
|
||||
float f = ExtMath.sqrtd(this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ);
|
||||
|
||||
if ((double)f >= 0.01D)
|
||||
{
|
||||
this.volume = 0.0F + ExtMath.clampf(f, 0.0F, 1.0F) * 0.75F;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.volume = 0.0F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.donePlaying = true;
|
||||
}
|
||||
}
|
||||
}
|
24
java/src/common/sound/PositionedSound.java
Executable file
24
java/src/common/sound/PositionedSound.java
Executable file
|
@ -0,0 +1,24 @@
|
|||
package common.sound;
|
||||
|
||||
import common.init.SoundEvent;
|
||||
|
||||
public class PositionedSound extends Sound {
|
||||
public PositionedSound(SoundEvent event, EventType type) {
|
||||
this(event, 1.0F, false, 0.0F, 0.0F, 0.0F);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public PositionedSound(SoundEvent event, float volume, float xPosition, float yPosition, float zPosition) {
|
||||
this(event, volume, true, xPosition, yPosition, zPosition);
|
||||
}
|
||||
|
||||
private PositionedSound(SoundEvent event, float volume, boolean attenuationType, float xPosition, float yPosition, float zPosition) {
|
||||
super(event);
|
||||
this.volume = volume;
|
||||
this.xPosF = xPosition;
|
||||
this.yPosF = yPosition;
|
||||
this.zPosF = zPosition;
|
||||
this.repeat = false;
|
||||
this.attenuationType = attenuationType;
|
||||
}
|
||||
}
|
60
java/src/common/sound/Sound.java
Executable file
60
java/src/common/sound/Sound.java
Executable file
|
@ -0,0 +1,60 @@
|
|||
package common.sound;
|
||||
|
||||
import common.init.SoundEvent;
|
||||
|
||||
public abstract class Sound
|
||||
{
|
||||
protected final SoundEvent event;
|
||||
protected EventType type = EventType.SOUND_EFFECT;
|
||||
protected float volume = 1.0F;
|
||||
protected float xPosF;
|
||||
protected float yPosF;
|
||||
protected float zPosF;
|
||||
protected boolean repeat = false;
|
||||
protected boolean attenuationType = true;
|
||||
|
||||
protected Sound(SoundEvent event)
|
||||
{
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public SoundEvent getSoundLocation()
|
||||
{
|
||||
return this.event;
|
||||
}
|
||||
|
||||
public boolean canRepeat()
|
||||
{
|
||||
return this.repeat;
|
||||
}
|
||||
|
||||
public float getVolume()
|
||||
{
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public float getXPosF()
|
||||
{
|
||||
return this.xPosF;
|
||||
}
|
||||
|
||||
public float getYPosF()
|
||||
{
|
||||
return this.yPosF;
|
||||
}
|
||||
|
||||
public float getZPosF()
|
||||
{
|
||||
return this.zPosF;
|
||||
}
|
||||
|
||||
public boolean getAttenuationType()
|
||||
{
|
||||
return this.attenuationType;
|
||||
}
|
||||
|
||||
public EventType getChannelType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue