mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed sounds spam when disguised as bees and minecarts
This commit is contained in:
parent
b6004bcd05
commit
97f2eda351
5 changed files with 12 additions and 12 deletions
|
@ -9,9 +9,9 @@ import net.minecraft.entity.passive.BeeEntity;
|
|||
|
||||
public class BeeBehaviour extends EntityBehaviour<BeeEntity> {
|
||||
@Override
|
||||
public BeeEntity onCreate(BeeEntity entity, Disguise context) {
|
||||
super.onCreate(entity, context);
|
||||
if (entity.world.isClient) {
|
||||
public BeeEntity onCreate(BeeEntity entity, Disguise context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
if (replaceOld && entity.world.isClient) {
|
||||
MinecraftClient.getInstance().getSoundManager().playNextTick(
|
||||
entity.hasAngerTime() ? new AggressiveBeeSoundInstance(entity) : new PassiveBeeSoundInstance(entity)
|
||||
);
|
||||
|
|
|
@ -130,11 +130,11 @@ public class Disguise implements NbtSerialisable {
|
|||
} catch (Exception ignored) {
|
||||
// Mojang pls
|
||||
}
|
||||
entity = EntityBehaviour.forEntity(entity).onCreate(entity, this);
|
||||
entity = EntityBehaviour.forEntity(entity).onCreate(entity, this, true);
|
||||
}
|
||||
} else {
|
||||
entity = EntityType.loadEntityWithPassengers(nbt, source.getWorld(), e -> {
|
||||
return EntityBehaviour.forEntity(e).onCreate(e, this);
|
||||
return EntityBehaviour.forEntity(e).onCreate(e, this, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public class Disguise implements NbtSerialisable {
|
|||
}
|
||||
|
||||
attachments.clear();
|
||||
entity = EntityBehaviour.forEntity(entity).onCreate(entity, this);
|
||||
entity = EntityBehaviour.forEntity(entity).onCreate(entity, this, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class EntityBehaviour<T extends Entity> {
|
|||
|
||||
}
|
||||
|
||||
public T onCreate(T entity, Disguise context) {
|
||||
public T onCreate(T entity, Disguise context, boolean wasNew) {
|
||||
entity.extinguish();
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
|||
private static final Vec3d UP = Vec3d.of(Direction.UP.getVector());
|
||||
|
||||
@Override
|
||||
public FallingBlockEntity onCreate(FallingBlockEntity entity, Disguise context) {
|
||||
super.onCreate(entity, context);
|
||||
public FallingBlockEntity onCreate(FallingBlockEntity entity, Disguise context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
|
||||
BlockState state = entity.getBlockState();
|
||||
Block block = state.getBlock();
|
||||
|
|
|
@ -11,9 +11,9 @@ import net.minecraft.entity.vehicle.AbstractMinecartEntity;
|
|||
public class MinecartBehaviour extends EntityBehaviour<AbstractMinecartEntity> {
|
||||
|
||||
@Override
|
||||
public AbstractMinecartEntity onCreate(AbstractMinecartEntity entity, Disguise context) {
|
||||
super.onCreate(entity, context);
|
||||
if (entity.world.isClient) {
|
||||
public AbstractMinecartEntity onCreate(AbstractMinecartEntity entity, Disguise context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
if (replaceOld && entity.world.isClient) {
|
||||
MinecraftClient.getInstance().getSoundManager().play(new MovingMinecartSoundInstance(entity));
|
||||
}
|
||||
return entity;
|
||||
|
|
Loading…
Reference in a new issue