mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed cloud block placement desync when on multiplayer
This commit is contained in:
parent
8804fa0aba
commit
7cb8e9c859
5 changed files with 19 additions and 2 deletions
|
@ -86,4 +86,8 @@ public class InteractionManager {
|
||||||
public PlayerEntity createPlayer(World world, GameProfile profile) {
|
public PlayerEntity createPlayer(World world, GameProfile profile) {
|
||||||
return new DummyPlayerEntity(world, profile);
|
return new DummyPlayerEntity(world, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendPlayerLookAngles(PlayerEntity player) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,6 +209,7 @@ public class AbilityDispatcher implements Tickable, NbtSerialisable {
|
||||||
warmup = 0;
|
warmup = 0;
|
||||||
|
|
||||||
if (data.isPresent()) {
|
if (data.isPresent()) {
|
||||||
|
InteractionManager.instance().sendPlayerLookAngles(player.asEntity());
|
||||||
Channel.CLIENT_PLAYER_ABILITY.sendToServer(new MsgPlayerAbility<>(ability, data, ActivationType.NONE));
|
Channel.CLIENT_PLAYER_ABILITY.sendToServer(new MsgPlayerAbility<>(ability, data, ActivationType.NONE));
|
||||||
} else {
|
} else {
|
||||||
player.asEntity().playSound(USounds.GUI_ABILITY_FAIL, 1, 1);
|
player.asEntity().playSound(USounds.GUI_ABILITY_FAIL, 1, 1);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.mojang.authlib.GameProfile;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.client.sound.AggressiveBeeSoundInstance;
|
import net.minecraft.client.sound.AggressiveBeeSoundInstance;
|
||||||
import net.minecraft.client.sound.MovingMinecartSoundInstance;
|
import net.minecraft.client.sound.MovingMinecartSoundInstance;
|
||||||
import net.minecraft.client.sound.PassiveBeeSoundInstance;
|
import net.minecraft.client.sound.PassiveBeeSoundInstance;
|
||||||
|
@ -37,6 +38,7 @@ import net.minecraft.entity.passive.BeeEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
|
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.random.Random;
|
import net.minecraft.util.math.random.Random;
|
||||||
|
@ -152,4 +154,11 @@ public class ClientInteractionManager extends InteractionManager {
|
||||||
public ParticleSpawner createBoundParticle(UUID id) {
|
public ParticleSpawner createBoundParticle(UUID id) {
|
||||||
return new ClientBoundParticleSpawner(id);
|
return new ClientBoundParticleSpawner(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPlayerLookAngles(PlayerEntity player) {
|
||||||
|
if (player instanceof ClientPlayerEntity c) {
|
||||||
|
c.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(player.getYaw(), player.getPitch(), player.isOnGround()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.item.cloud;
|
package com.minelittlepony.unicopia.item.cloud;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.InteractionManager;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -30,7 +32,7 @@ extends BlockItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||||
|
InteractionManager.instance().sendPlayerLookAngles(user);
|
||||||
Vec3d targetPos = user.getEyePos().add(user.getRotationVec(1).multiply(1, 1.5, 1).normalize().multiply(2));
|
Vec3d targetPos = user.getEyePos().add(user.getRotationVec(1).multiply(1, 1.5, 1).normalize().multiply(2));
|
||||||
ItemPlacementContext context = new ItemPlacementContext(user, hand, user.getStackInHand(hand), new BlockHitResult(
|
ItemPlacementContext context = new ItemPlacementContext(user, hand, user.getStackInHand(hand), new BlockHitResult(
|
||||||
targetPos,
|
targetPos,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"replace": false,
|
"replace": false,
|
||||||
"values": [
|
"values": [
|
||||||
"minecraft:feather",
|
"minecraft:feather",
|
||||||
"#unicopia:magic_feathers"
|
"#unicopia:magic_feathers",
|
||||||
|
"unicopia:cloud_lump"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue