use of net.minecraft.client.MinecraftClient in project LittleMaidModelLoader-Fabric by SistrScarlet.
the class CustomMobSpawnPacket method spawn.
@Environment(EnvType.CLIENT)
private static void spawn(int id, UUID uuid, int entityTypeId, double x, double y, double z, float yaw, float pitch, float headYaw, float velocityX, float velocityY, float velocityZ, PacketByteBuf additional) {
MinecraftClient client = MinecraftClient.getInstance();
ClientWorld world = client.world;
if (world == null) {
return;
}
LivingEntity livingEntity = (LivingEntity) EntityType.createInstanceFromId(entityTypeId, world);
if (livingEntity instanceof CustomPacketEntity) {
livingEntity.updateTrackedPosition(x, y, z);
livingEntity.bodyYaw = headYaw;
livingEntity.headYaw = headYaw;
livingEntity.setEntityId(id);
livingEntity.setUuid(uuid);
livingEntity.updatePositionAndAngles(x, y, z, yaw, pitch);
livingEntity.setVelocity(velocityX, velocityY, velocityZ);
((CustomPacketEntity) livingEntity).readCustomPacket(additional);
world.addEntity(id, livingEntity);
} else {
LOGGER.warn("Skipping Entity with id {}", entityTypeId);
}
if (additional.refCnt() > 0) {
additional.release();
}
}
use of net.minecraft.client.MinecraftClient in project Liminal-Library by LudoCrypt.
the class ReverbFilter method update.
public static void update(SoundInstance soundInstance, int sourceID) {
MinecraftClient client = MinecraftClient.getInstance();
if (!(ReverbSettings.shouldIgnore(soundInstance.getId()) || client == null || client.world == null)) {
Optional<ReverbSettings> reverb = ((DimensionTypeAccess) client.world.getDimension()).getLiminalEffects().getReverb();
if (reverb.isPresent()) {
for (int i = 0; i < 2; i++) {
AL11.alSourcei(sourceID, EXTEfx.AL_DIRECT_FILTER, 0);
AL11.alSource3i(sourceID, EXTEfx.AL_AUXILIARY_SEND_FILTER, update(soundInstance, reverb.get()) ? slot : 0, 0, 0);
int error = AL11.alGetError();
if (error == AL11.AL_NO_ERROR) {
break;
} else {
LOGGER.warn("OpenAl Error {}", error);
}
}
}
}
}
use of net.minecraft.client.MinecraftClient in project Enchanted-Bionics by Bubblie01.
the class FunnyItem method use.
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
if (world.isClient) {
MinecraftClient client = MinecraftClient.getInstance();
EntityRenderer<? super AbstractClientPlayerEntity> renderer = client.getEntityRenderDispatcher().getRenderer(client.player);
PlayerEntityModel<AbstractClientPlayerEntity> playerEntityModel = ((PlayerEntityRenderer) (renderer)).getModel();
this.playerEntityModel = playerEntityModel;
(((PlayerLimbInterface) playerEntityModel)).setSpecificVisible(false, EntityModelPartNames.LEFT_ARM);
}
return super.use(world, user, hand);
}
use of net.minecraft.client.MinecraftClient in project Enchanted-Bionics by Bubblie01.
the class FunnierItem method use.
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
if (world.isClient) {
MinecraftClient client = MinecraftClient.getInstance();
EntityRenderer<? super AbstractClientPlayerEntity> renderer = client.getEntityRenderDispatcher().getRenderer(client.player);
PlayerEntityModel<AbstractClientPlayerEntity> playerEntityModel = ((PlayerEntityRenderer) (renderer)).getModel();
this.playerEntityModel = playerEntityModel;
(((PlayerLimbInterface) playerEntityModel)).setSpecificVisible(true, EntityModelPartNames.LEFT_ARM);
}
return super.use(world, user, hand);
}
use of net.minecraft.client.MinecraftClient in project MCDungeonsWeapons by chronosacaria.
the class CombatEventHandler method checkForOffHandAttack.
public static void checkForOffHandAttack() {
MinecraftClient mc = MinecraftClient.getInstance();
PlayerEntity player = mc.player;
HitResult hitResult = mc.crosshairTarget;
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().currentScreen == null && !MinecraftClient.getInstance().isPaused() && player != null && !player.isBlocking()) {
ItemStack offhand = player.getOffHandStack();
if (offhand.getItem() instanceof IOffhandAttack) {
if (hitResult instanceof EntityHitResult) {
if (mc.crosshairTarget != null && mc.interactionManager != null) {
mc.interactionManager.attackEntity(player, ((EntityHitResult) mc.crosshairTarget).getEntity());
}
}
}
}
}
Aggregations