mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Minor cleanup
This commit is contained in:
parent
f55e6d00b9
commit
e8e6afe01f
3 changed files with 28 additions and 36 deletions
|
@ -91,10 +91,8 @@ public class SlimeDropBlock extends Block implements Climbable {
|
||||||
world.playSound(null, pos, USounds.SLIME_ADVANCE, SoundCategory.BLOCKS, 1, 1);
|
world.playSound(null, pos, USounds.SLIME_ADVANCE, SoundCategory.BLOCKS, 1, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (age < getMaximumAge(world, pos, state, spaceBelow)) {
|
if (age < getMaximumAge(world, pos, state, spaceBelow) && rand.nextInt(5 * (age + 1)) == 0) {
|
||||||
if (rand.nextInt(5 * (age + 1)) == 0) {
|
world.setBlockState(pos, state.cycle(AGE));
|
||||||
world.setBlockState(pos, state.cycle(AGE));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,9 +141,9 @@ public class SlimeDropBlock extends Block implements Climbable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockRemoved(BlockState state, World world, BlockPos pos, BlockState replacement, boolean boolean_1) {
|
public void onBlockRemoved(BlockState state, World world, BlockPos pos, BlockState replacement, boolean moved) {
|
||||||
world.updateNeighborsAlways(pos, this);
|
world.updateNeighborsAlways(pos, this);
|
||||||
super.onBlockRemoved(state, world, pos, replacement, boolean_1);
|
super.onBlockRemoved(state, world, pos, replacement, moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -157,21 +155,19 @@ public class SlimeDropBlock extends Block implements Climbable {
|
||||||
living.damage(MagicalDamageSource.ACID, 1);
|
living.damage(MagicalDamageSource.ACID, 1);
|
||||||
living.slowMovement(state, new Vec3d(0.25D, 0.05000000074505806D, 0.25D));
|
living.slowMovement(state, new Vec3d(0.25D, 0.05000000074505806D, 0.25D));
|
||||||
|
|
||||||
if (!world.isClient) {
|
if (!world.isClient && living.getHealth() <= 0) {
|
||||||
if (living.getHealth() <= 0) {
|
living.dropItem(Items.BONE, 3);
|
||||||
living.dropItem(Items.BONE, 3);
|
|
||||||
|
|
||||||
if (living instanceof PlayerEntity) {
|
if (living instanceof PlayerEntity) {
|
||||||
if (world.random.nextInt(13000) == 0) {
|
if (world.random.nextInt(13000) == 0) {
|
||||||
ItemStack skull = new ItemStack(Items.PLAYER_HEAD);
|
ItemStack skull = new ItemStack(Items.PLAYER_HEAD);
|
||||||
PlayerEntity player = (PlayerEntity)living;
|
PlayerEntity player = (PlayerEntity)living;
|
||||||
|
|
||||||
skull.setTag(new CompoundTag());
|
skull.setTag(new CompoundTag());
|
||||||
skull.getTag().put("SkullOwner", NbtHelper.fromGameProfile(new CompoundTag(), player.getGameProfile()));
|
skull.getTag().put("SkullOwner", NbtHelper.fromGameProfile(new CompoundTag(), player.getGameProfile()));
|
||||||
player.dropItem(skull, true);
|
player.dropItem(skull, true);
|
||||||
} else {
|
} else {
|
||||||
living.dropItem(Items.SKELETON_SKULL, 1);
|
living.dropItem(Items.SKELETON_SKULL, 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,20 +212,17 @@ public class SlimeDropBlock extends Block implements Climbable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if (state.get(SHAPE) == Shape.BULB) {
|
if (state.get(SHAPE) == Shape.BULB && rand.nextInt(8) == 0) {
|
||||||
if (rand.nextInt(8) == 0) {
|
Vec3d offset = state.getOffsetPos(world, pos).add(pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
Box bounds = BULBS[state.get(AGE) / 2]
|
||||||
|
.offset(offset.x, offset.y, offset.z)
|
||||||
|
.getBoundingBox();
|
||||||
|
|
||||||
Vec3d offset = state.getOffsetPos(world, pos).add(pos.getX(), pos.getY(), pos.getZ());
|
double x = bounds.x1 + (bounds.x2 - bounds.x1) * rand.nextFloat();
|
||||||
Box bounds = BULBS[state.get(AGE) / 2]
|
double y = bounds.y1;
|
||||||
.offset(offset.x, offset.y, offset.z)
|
double z = bounds.z1 + (bounds.z2 - bounds.z1) * rand.nextFloat();
|
||||||
.getBoundingBox();
|
|
||||||
|
|
||||||
double x = bounds.x1 + (bounds.x2 - bounds.x1) * rand.nextFloat();
|
world.addParticle(ParticleTypes.DRIPPING_LAVA, x, y, z, 0, 0, 0);
|
||||||
double y = bounds.y1;
|
|
||||||
double z = bounds.z1 + (bounds.z2 - bounds.z1) * rand.nextFloat();
|
|
||||||
|
|
||||||
world.addParticle(ParticleTypes.DRIPPING_LAVA, x, y, z, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.client.gui;
|
package com.minelittlepony.unicopia.client.gui;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.client.gui.UHud;
|
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class GravityDelegate implements Updatable, FlightControl, NbtSerialisabl
|
||||||
ticksNextLevel = 0;
|
ticksNextLevel = 0;
|
||||||
|
|
||||||
entity.addExperience(1);
|
entity.addExperience(1);
|
||||||
addFlightExperience(entity, 1);
|
addFlightExperience(1);
|
||||||
entity.playSound(SoundEvents.ENTITY_GUARDIAN_FLOP, 1, 1);
|
entity.playSound(SoundEvents.ENTITY_GUARDIAN_FLOP, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,9 +198,9 @@ public class GravityDelegate implements Updatable, FlightControl, NbtSerialisabl
|
||||||
ticksNextLevel = 0;
|
ticksNextLevel = 0;
|
||||||
|
|
||||||
if (isExperienceCritical()) {
|
if (isExperienceCritical()) {
|
||||||
addFlightExperience(entity, -0.39991342F);
|
addFlightExperience(-0.39991342F);
|
||||||
} else {
|
} else {
|
||||||
addFlightExperience(entity, -0.019991342F);
|
addFlightExperience(-0.019991342F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flightExperience < 0.02) {
|
if (flightExperience < 0.02) {
|
||||||
|
@ -282,7 +282,7 @@ public class GravityDelegate implements Updatable, FlightControl, NbtSerialisabl
|
||||||
return distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL;
|
return distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFlightExperience(PlayerEntity entity, float factor) {
|
private void addFlightExperience(float factor) {
|
||||||
float maximumGain = MAXIMUM_FLIGHT_EXPERIENCE - flightExperience;
|
float maximumGain = MAXIMUM_FLIGHT_EXPERIENCE - flightExperience;
|
||||||
float gainSteps = 20;
|
float gainSteps = 20;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue