Search in sources :

Example 1 with GenderPlayer

use of com.wildfire.main.GenderPlayer in project WildfireFemaleGenderMod by WildfireRomeo.

the class WildfireBreastCustomizationScreen method init.

@Override
public void init() {
    int j = this.height / 2;
    GenderPlayer plr = getPlayer();
    Breasts breasts = plr.getBreasts();
    FloatConsumer onSave = value -> {
        // Just save as we updated the actual value in value change
        GenderPlayer.saveGenderInfo(plr);
    };
    this.addDrawableChild(new WildfireButton(this.width / 2 + 178, j - 61, 9, 9, new TranslatableText("wildfire_gender.label.exit"), button -> MinecraftClient.getInstance().setScreen(parent)));
    this.addDrawableChild(this.breastSlider = new WildfireSlider(this.width / 2 + 30, j - 48, 158, 20, Configuration.BUST_SIZE, plr.getBustSize(), plr::updateBustSize, value -> new TranslatableText("wildfire_gender.wardrobe.slider.breast_size", Math.round(value * 100)), onSave));
    // Customization
    this.addDrawableChild(this.xOffsetBoobSlider = new WildfireSlider(this.width / 2 + 30, j - 27, 158, 20, Configuration.BREASTS_OFFSET_X, breasts.getXOffset(), breasts::updateXOffset, value -> new TranslatableText("wildfire_gender.wardrobe.slider.separation", Math.round((Math.round(value * 100f) / 100f) * 10)), onSave));
    this.addDrawableChild(this.yOffsetBoobSlider = new WildfireSlider(this.width / 2 + 30, j - 6, 158, 20, Configuration.BREASTS_OFFSET_Y, breasts.getYOffset(), breasts::updateYOffset, value -> new TranslatableText("wildfire_gender.wardrobe.slider.height", Math.round((Math.round(value * 100f) / 100f) * 10)), onSave));
    this.addDrawableChild(this.zOffsetBoobSlider = new WildfireSlider(this.width / 2 + 30, j + 15, 158, 20, Configuration.BREASTS_OFFSET_Z, breasts.getZOffset(), breasts::updateZOffset, value -> new TranslatableText("wildfire_gender.wardrobe.slider.depth", Math.round((Math.round(value * 100f) / 100f) * 10)), onSave));
    this.addDrawableChild(this.cleavageSlider = new WildfireSlider(this.width / 2 + 30, j + 36, 158, 20, Configuration.BREASTS_CLEAVAGE, breasts.getCleavage(), breasts::updateCleavage, value -> new TranslatableText("wildfire_gender.wardrobe.slider.rotation", Math.round((Math.round(value * 100f) / 100f) * 100)), onSave));
    this.addDrawableChild(new WildfireButton(this.width / 2 + 30, j + 57, 158, 20, new TranslatableText("wildfire_gender.breast_customization.dual_physics", new TranslatableText(breasts.isUniboob() ? "wildfire_gender.label.no" : "wildfire_gender.label.yes")), button -> {
        boolean isUniboob = !breasts.isUniboob();
        if (breasts.updateUniboob(isUniboob)) {
            button.setMessage(new TranslatableText("wildfire_gender.breast_customization.dual_physics", new TranslatableText(isUniboob ? "wildfire_gender.label.no" : "wildfire_gender.label.yes")));
            GenderPlayer.saveGenderInfo(plr);
        }
    }));
    super.init();
}
Also used : GenderPlayer(com.wildfire.main.GenderPlayer) FloatConsumer(it.unimi.dsi.fastutil.floats.FloatConsumer) PlayerEntity(net.minecraft.entity.player.PlayerEntity) Configuration(com.wildfire.main.config.Configuration) MatrixStack(net.minecraft.client.util.math.MatrixStack) TranslatableText(net.minecraft.text.TranslatableText) UUID(java.util.UUID) WildfireButton(com.wildfire.gui.WildfireButton) WildfireSlider(com.wildfire.gui.WildfireSlider) Screen(net.minecraft.client.gui.screen.Screen) Breasts(com.wildfire.main.Breasts) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) MinecraftClient(net.minecraft.client.MinecraftClient) TranslatableText(net.minecraft.text.TranslatableText) Breasts(com.wildfire.main.Breasts) WildfireButton(com.wildfire.gui.WildfireButton) FloatConsumer(it.unimi.dsi.fastutil.floats.FloatConsumer) GenderPlayer(com.wildfire.main.GenderPlayer) WildfireSlider(com.wildfire.gui.WildfireSlider)

Example 2 with GenderPlayer

use of com.wildfire.main.GenderPlayer in project WildfireFemaleGenderMod by WildfireRomeo.

the class PacketSync method handle.

public static void handle(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
    PacketSync packet = new PacketSync(buf);
    if (!packet.uuid.equals(MinecraftClient.getInstance().player.getUuid())) {
        GenderPlayer plr = WildfireGender.getOrAddPlayerById(packet.uuid);
        packet.updatePlayerFromPacket(plr);
        plr.syncStatus = GenderPlayer.SyncStatus.SYNCED;
        plr.lockSettings = true;
    // System.out.println("Received player data " + plr.uuid);
    } else {
    // System.out.println("Ignoring packet, this is yourself.");
    }
}
Also used : GenderPlayer(com.wildfire.main.GenderPlayer)

Example 3 with GenderPlayer

use of com.wildfire.main.GenderPlayer in project WildfireFemaleGenderMod by WildfireRomeo.

the class PacketSync method sendTo.

public static void sendTo(ServerPlayerEntity player) {
    for (Map.Entry<UUID, GenderPlayer> entry : WildfireGender.CLOTHING_PLAYERS.entrySet()) {
        UUID uuid = entry.getKey();
        if (!player.getUuid().equals(uuid)) {
            PacketSync packet = new PacketSync(entry.getValue());
            PacketByteBuf buffer = PacketByteBufs.create();
            packet.encode(buffer);
            ServerPlayNetworking.send(player, new Identifier(WildfireGender.MODID, "sync"), buffer);
        }
    }
}
Also used : Identifier(net.minecraft.util.Identifier) PacketByteBuf(net.minecraft.network.PacketByteBuf) GenderPlayer(com.wildfire.main.GenderPlayer) UUID(java.util.UUID) Map(java.util.Map)

Example 4 with GenderPlayer

use of com.wildfire.main.GenderPlayer in project WildfireFemaleGenderMod by WildfireRomeo.

the class PlayerEntityServerMixin method onDamagePlayer.

@Inject(method = "applyDamage", at = @At("HEAD"), cancellable = true)
private void onDamagePlayer(DamageSource source, float amount, CallbackInfo ci) {
    if (!this.isInvulnerableTo(source)) {
        PlayerEntity self = (PlayerEntity) (Object) this;
        amount = this.applyArmorToDamage(source, amount);
        amount = this.applyEnchantmentsToDamage(source, amount);
        float f = amount;
        amount = Math.max(amount - this.getAbsorptionAmount(), 0.0F);
        if (amount != 0.0f) {
            // send to client hurt sound?
            GenderPlayer plr = WildfireGender.getPlayerById(self.getUuid());
            if (plr != null) {
                PacketByteBuf buf = PacketByteBufs.create();
                buf.writeUuid(plr.uuid);
                buf.writeEnumConstant(plr.getGender());
                buf.writeBoolean(plr.hasHurtSounds());
                for (ServerPlayerEntity player : PlayerLookup.tracking((ServerWorld) world, world.getPlayerByUuid(plr.uuid).getBlockPos())) {
                    if (ServerPlayNetworking.canSend(player, new Identifier("wildfire_gender", "hurt"))) {
                        ServerPlayNetworking.send(player, new Identifier("wildfire_gender", "hurt"), buf);
                    }
                }
            }
        }
    }
}
Also used : Identifier(net.minecraft.util.Identifier) PacketByteBuf(net.minecraft.network.PacketByteBuf) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) GenderPlayer(com.wildfire.main.GenderPlayer) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 5 with GenderPlayer

use of com.wildfire.main.GenderPlayer in project WildfireFemaleGenderMod by WildfireRomeo.

the class WildfireBreastCustomizationScreen method render.

@Override
public void render(MatrixStack m, int f1, int f2, float f3) {
    MinecraftClient minecraft = MinecraftClient.getInstance();
    GenderPlayer plr = getPlayer();
    super.renderBackground(m);
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    if (plr == null)
        return;
    try {
        RenderSystem.setShaderColor(1f, 1.0F, 1.0F, 1.0F);
        int xP = this.width / 2 - 102;
        int yP = this.height / 2 + 275;
        PlayerEntity ent = MinecraftClient.getInstance().world.getPlayerByUuid(this.playerUUID);
        if (ent != null) {
            WardrobeBrowserScreen.drawEntityOnScreen(xP, yP, 200, -20, -20, ent);
        } else {
            // player left, fallback
            minecraft.setScreen(new WildfirePlayerListScreen(minecraft));
        }
    } catch (Exception e) {
        // error, fallback
        minecraft.setScreen(new WildfirePlayerListScreen(minecraft));
    }
    boolean canHaveBreasts = plr.getGender().canHaveBreasts();
    breastSlider.visible = canHaveBreasts;
    xOffsetBoobSlider.visible = canHaveBreasts;
    yOffsetBoobSlider.visible = canHaveBreasts;
    zOffsetBoobSlider.visible = canHaveBreasts;
    cleavageSlider.visible = canHaveBreasts;
    int x = this.width / 2;
    int y = this.height / 2;
    fill(m, x + 28, y - 64, x + 190, y + 79, 0x55000000);
    fill(m, x + 29, y - 63, x + 189, y - 50, 0x55000000);
    this.textRenderer.draw(m, getTitle(), x + 32, y - 60, 0xFFFFFF);
    super.render(m, f1, f2, f3);
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) GenderPlayer(com.wildfire.main.GenderPlayer) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

GenderPlayer (com.wildfire.main.GenderPlayer)8 PlayerEntity (net.minecraft.entity.player.PlayerEntity)5 UUID (java.util.UUID)3 MinecraftClient (net.minecraft.client.MinecraftClient)3 Identifier (net.minecraft.util.Identifier)3 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)2 WildfireButton (com.wildfire.gui.WildfireButton)2 WildfireSlider (com.wildfire.gui.WildfireSlider)2 Configuration (com.wildfire.main.config.Configuration)2 Screen (net.minecraft.client.gui.screen.Screen)2 MatrixStack (net.minecraft.client.util.math.MatrixStack)2 PacketByteBuf (net.minecraft.network.PacketByteBuf)2 TranslatableText (net.minecraft.text.TranslatableText)2 IGenderArmor (com.wildfire.api.IGenderArmor)1 Breasts (com.wildfire.main.Breasts)1 WildfireGender (com.wildfire.main.WildfireGender)1 FloatConsumer (it.unimi.dsi.fastutil.floats.FloatConsumer)1 Map (java.util.Map)1 GameRenderer (net.minecraft.client.render.GameRenderer)1 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)1