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();
}
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.");
}
}
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);
}
}
}
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);
}
}
}
}
}
}
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);
}
Aggregations