Minor cleanup

This commit is contained in:
Sollace 2020-04-28 00:32:42 +02:00
parent f55e6d00b9
commit e8e6afe01f
3 changed files with 28 additions and 36 deletions

View file

@ -91,14 +91,12 @@ public class SlimeDropBlock extends Block implements Climbable {
world.playSound(null, pos, USounds.SLIME_ADVANCE, SoundCategory.BLOCKS, 1, 1);
}
} else {
if (age < getMaximumAge(world, pos, state, spaceBelow)) {
if (rand.nextInt(5 * (age + 1)) == 0) {
if (age < getMaximumAge(world, pos, state, spaceBelow) && rand.nextInt(5 * (age + 1)) == 0) {
world.setBlockState(pos, state.cycle(AGE));
}
}
}
}
}
protected void breakConnected(World world, BlockPos pos) {
world.breakBlock(pos, true);
@ -143,9 +141,9 @@ public class SlimeDropBlock extends Block implements Climbable {
}
@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);
super.onBlockRemoved(state, world, pos, replacement, boolean_1);
super.onBlockRemoved(state, world, pos, replacement, moved);
}
@Override
@ -157,8 +155,7 @@ public class SlimeDropBlock extends Block implements Climbable {
living.damage(MagicalDamageSource.ACID, 1);
living.slowMovement(state, new Vec3d(0.25D, 0.05000000074505806D, 0.25D));
if (!world.isClient) {
if (living.getHealth() <= 0) {
if (!world.isClient && living.getHealth() <= 0) {
living.dropItem(Items.BONE, 3);
if (living instanceof PlayerEntity) {
@ -177,7 +174,6 @@ public class SlimeDropBlock extends Block implements Climbable {
}
}
}
}
public boolean checkSupport(BlockView world, BlockPos pos) {
@ -216,9 +212,7 @@ public class SlimeDropBlock extends Block implements Climbable {
@Override
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
if (state.get(SHAPE) == Shape.BULB) {
if (rand.nextInt(8) == 0) {
if (state.get(SHAPE) == Shape.BULB && 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)
@ -231,7 +225,6 @@ public class SlimeDropBlock extends Block implements Climbable {
world.addParticle(ParticleTypes.DRIPPING_LAVA, x, y, z, 0, 0, 0);
}
}
}
enum Shape implements StringIdentifiable {
BULB,

View file

@ -1,6 +1,5 @@
package com.minelittlepony.unicopia.client.gui;
import com.minelittlepony.unicopia.client.gui.UHud;
import com.minelittlepony.unicopia.entity.player.Pony;
import net.minecraft.client.MinecraftClient;

View file

@ -155,7 +155,7 @@ public class GravityDelegate implements Updatable, FlightControl, NbtSerialisabl
ticksNextLevel = 0;
entity.addExperience(1);
addFlightExperience(entity, 1);
addFlightExperience(1);
entity.playSound(SoundEvents.ENTITY_GUARDIAN_FLOP, 1, 1);
}
@ -198,9 +198,9 @@ public class GravityDelegate implements Updatable, FlightControl, NbtSerialisabl
ticksNextLevel = 0;
if (isExperienceCritical()) {
addFlightExperience(entity, -0.39991342F);
addFlightExperience(-0.39991342F);
} else {
addFlightExperience(entity, -0.019991342F);
addFlightExperience(-0.019991342F);
}
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;
}
private void addFlightExperience(PlayerEntity entity, float factor) {
private void addFlightExperience(float factor) {
float maximumGain = MAXIMUM_FLIGHT_EXPERIENCE - flightExperience;
float gainSteps = 20;