mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Flying in the rain is now more dangerous
This commit is contained in:
parent
bb0718bbd3
commit
672f78d35e
5 changed files with 56 additions and 3 deletions
|
@ -8,10 +8,21 @@ import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
public class USounds {
|
public class USounds {
|
||||||
|
|
||||||
public static final SoundEvent WING_FLAP = new SoundEvent(new ResourceLocation(Unicopia.MODID, "wing_flap"))
|
public static final SoundEvent WING_FLAP = new USound(Unicopia.MODID, "wing_flap");
|
||||||
.setRegistryName(Unicopia.MODID, "wing_flap");
|
public static final SoundEvent WIND_RUSH = new USound(Unicopia.MODID, "wind_rush");
|
||||||
|
|
||||||
static void init(IForgeRegistry<SoundEvent> registry) {
|
static void init(IForgeRegistry<SoundEvent> registry) {
|
||||||
registry.registerAll(WING_FLAP);
|
registry.registerAll(WING_FLAP, WIND_RUSH);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class USound extends SoundEvent {
|
||||||
|
USound(String domain, String name) {
|
||||||
|
this(new ResourceLocation(domain, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
USound(ResourceLocation id) {
|
||||||
|
super(id);
|
||||||
|
setRegistryName(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -164,6 +165,39 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
|
|
||||||
player.motionX += - forward * MathHelper.sin(player.rotationYaw * 0.017453292F);
|
player.motionX += - forward * MathHelper.sin(player.rotationYaw * 0.017453292F);
|
||||||
player.motionZ += forward * MathHelper.cos(player.rotationYaw * 0.017453292F);
|
player.motionZ += forward * MathHelper.cos(player.rotationYaw * 0.017453292F);
|
||||||
|
|
||||||
|
if (player.world.isRainingAt(player.getPosition())) {
|
||||||
|
float glance = 360 * player.world.rand.nextFloat();
|
||||||
|
|
||||||
|
|
||||||
|
forward = 0.015F * player.world.rand.nextFloat() * player.world.getRainStrength(1);
|
||||||
|
|
||||||
|
if (player.world.rand.nextInt(30) == 0) {
|
||||||
|
forward *= 10;
|
||||||
|
}
|
||||||
|
if (player.world.rand.nextInt(30) == 0) {
|
||||||
|
forward *= 10;
|
||||||
|
}
|
||||||
|
if (player.world.rand.nextInt(40) == 0) {
|
||||||
|
forward *= 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.world.isThundering() && player.world.rand.nextInt(60) == 0) {
|
||||||
|
player.motionY += forward * 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forward >= 1) {
|
||||||
|
player.world.playSound(null, player.getPosition(), USounds.WIND_RUSH, SoundCategory.AMBIENT, 3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forward > 4) {
|
||||||
|
forward = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//player.knockBack(player, forward, 1, 1);
|
||||||
|
player.motionX += - forward * MathHelper.sin((player.rotationYaw + glance) * 0.017453292F);
|
||||||
|
player.motionZ += forward * MathHelper.cos((player.rotationYaw + glance) * 0.017453292F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void landHard(EntityPlayer player, float distance, float damageMultiplier) {
|
public void landHard(EntityPlayer player, float distance, float damageMultiplier) {
|
||||||
|
|
|
@ -8,5 +8,13 @@
|
||||||
"unicopia:wing/wing2",
|
"unicopia:wing/wing2",
|
||||||
"unicopia:wing/wing3"
|
"unicopia:wing/wing3"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"wind_rush": {
|
||||||
|
"category": "ambient",
|
||||||
|
"subtitle": "unicopia.subtitle.wind_rush",
|
||||||
|
"sounds": [
|
||||||
|
"unicopia:wind/altitude_wind5",
|
||||||
|
"unicopia:wind/altitude_wind7"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue