Skip to content

Commit

Permalink
Screen scaling hotfix & version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Creativious committed Sep 30, 2023
1 parent b71513f commit 168fc85
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 73 deletions.
1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/modules/platform-fabric-1.20.1.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion platform-fabric-1.19.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.22
# Mod Properties
mod_version=1.1
mod_version=1.1.1
maven_group=com.duzo
archives_base_name=fakeplayers
# Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,36 @@ public FakePlayerScreen(Text title, HumanoidEntity humanoid1, PlayerEntity playe
@Override
protected void init() {
super.init();
int l = this.height / 4 + 48;
int l = ((this.height - this.imageHeight) / 2) + (int) (this.imageHeight * 0.05);
int i = (this.width - this.imageWidth) / 2;
int j = (this.height - this.imageWidth) / 2;
int j = this.imageWidth - (int) ( this.imageWidth * 0.1);
System.out.println(l);
System.out.println(i);
System.out.println(j);
this.input = new EditBoxWidget(this.textRenderer, (i) + (this.imageWidth/2) - j + (j/2),l,j, 12, Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.skininput").toTranslationKey()), Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.skininputmessage").toTranslationKey()));
this.input.setMaxLength(100);
// @TODO: Remove the not implemented message when the feature is implemented
this.input.tooltip(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red"))));
this.input.tooltip((Text) Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red"))));
addDrawableChild(this.input);
int after_input_edit_box_y = this.input.getY() + this.input.getHeight() + ((int) (this.height * 0.01));

this.chatBox = new EditBoxWidget(this.textRenderer, (i) + (this.imageWidth/2) - j + (j/2),l + 20,j, 12, Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.chatinput").toTranslationKey()), Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.chatinputmessage").toTranslationKey()));

this.chatBox = new EditBoxWidget(this.textRenderer, (i) + (this.imageWidth/2) - j + (j/2),after_input_edit_box_y,j, 12, Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.chatinput").toTranslationKey()), Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.chatinputmessage").toTranslationKey()));
this.chatBox.setMaxLength(100);
addDrawableChild(this.chatBox);
int after_chat_edit_box_y = this.chatBox.getY() + this.chatBox.getHeight() + ((int) (this.height * 0.02));


this.send = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.send").toTranslationKey()), button -> {
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidChatPacket(this.chatBox.getText(), this.humanoid.getUuidAsString()));
this.close(); // Maybe change this out if this is annoying for players
})
.dimensions((i) + (this.imageWidth/2) - (98/2),l + 40,98,20)
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidChatPacket(this.chatBox.getText(), this.humanoid.getUuidAsString()));
this.close(); // Maybe change this out if this is annoying for players
})
.dimensions((i) + (this.imageWidth/2) - (98/2),after_chat_edit_box_y,98,20)
.build();
addDrawableChild(this.send);
this.confirm = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.confirm").toTranslationKey()), button -> {
player.sendMessage(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red"))), true);
player.sendMessage(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red"))), false);
this.close();

})
.dimensions((i) + (this.imageWidth/2) - (98/2),l + (128),98,20)
// @TODO: Remove the not implemented message when the feature is implemented
.tooltip(Tooltip.of((Text) Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red")))))
.build();
addDrawableChild(this.confirm);
int after_send_button_y = this.send.getY() + this.send.getHeight() + ((int) (this.height * 0.05));

this.sitting = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.sit").toTranslationKey()), button -> {
MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).toggleSitting();
this.stayPut.active = !MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).isSitting();
Expand All @@ -79,52 +78,69 @@ protected void init() {
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(!this.stayPut.active, this.humanoid.getUuidAsString()));
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket("", this.humanoid.getUuidAsString()));
this.close();
this.close();
})
.dimensions((i) + (this.imageWidth/2) - (23), l + 80,46,20)
this.close();
})
.dimensions((i) + (this.imageWidth/2) - (23), after_send_button_y,46,20)
.build();
addDrawableChild(this.sitting);

int after_sitting_button_y = this.sitting.getY() + this.sitting.getHeight();

this.stayPut = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.stayput").toTranslationKey()), button -> {
this.stayPut.active = false;
this.wander.active = true;
this.follow.active = true;
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(true, this.humanoid.getUuidAsString()));
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket("", this.humanoid.getUuidAsString()));
this.close();
})
.dimensions((i) + (this.imageWidth/2) - 23, l + 100,46,20)
this.stayPut.active = false;
this.wander.active = true;
this.follow.active = true;
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(true, this.humanoid.getUuidAsString()));
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket("", this.humanoid.getUuidAsString()));
this.close();
})
.dimensions((i) + (this.imageWidth/2) - 23, after_sitting_button_y,46,20)
.build();
addDrawableChild(this.stayPut);
this.wander = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.wander").toTranslationKey()), button -> {
this.wander.active = false;
this.stayPut.active = true;
if (MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).isSitting()) {
MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).toggleSitting();
}

Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(false, this.humanoid.getUuidAsString())); // More or less setting to default state
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket("", this.humanoid.getUuidAsString()));
this.close();
})
.dimensions((i) + (this.imageWidth/2) - (23*3), l + 100,46,20)
this.wander.active = false;
this.stayPut.active = true;
if (MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).isSitting()) {
MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).toggleSitting();
}

Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(false, this.humanoid.getUuidAsString())); // More or less setting to default state
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket("", this.humanoid.getUuidAsString()));
this.close();
})
.dimensions((i) + (this.imageWidth/2) - (23*3), after_sitting_button_y,46,20)
.build();
addDrawableChild(this.wander);
this.follow = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.follow").toTranslationKey()), button -> {
this.follow.active = false;
this.stayPut.active = true;
this.wander.active = true;
if (MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).isSitting()) {
MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).toggleSitting();
}
if (this.humanoid.isAiDisabled()) {
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(false, this.humanoid.getUuidAsString()));
}
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket(this.player.getUuidAsString(), this.humanoid.getUuidAsString()));
this.close();
})
.dimensions((i) + (this.imageWidth/2) + (23), l + 100,46,20)
this.follow.active = false;
this.stayPut.active = true;
this.wander.active = true;
if (MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).isSitting()) {
MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).toggleSitting();
}
if (this.humanoid.isAiDisabled()) {
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidToggleAiPacket(false, this.humanoid.getUuidAsString()));
}
Fakeplayers.NETWORK.clientHandle().send(new C2SHumanoidFollowPlayerPacket(this.player.getUuidAsString(), this.humanoid.getUuidAsString()));
this.close();
})
.dimensions((i) + (this.imageWidth/2) + (23), after_sitting_button_y,46,20)
.build();
addDrawableChild(this.follow);

int after_other_buttons_y = this.follow.getY() + this.follow.getHeight() + ((int) (this.height * 0.02));

this.confirm = ButtonWidget.builder(Text.translatable(new Identifier(Fakeplayers.MOD_ID, "screen.fakeplayerscreen.confirm").toTranslationKey()), button -> {
player.sendMessage((Text) Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red"))), true);
player.sendMessage((Text) Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red"))), false);
this.close();

})
.dimensions((i) + (this.imageWidth/2) - (98/2),after_other_buttons_y,98,20)
// @TODO: Remove the not implemented message when the feature is implemented
.tooltip(Tooltip.of((Text) Text.translatable(new Identifier(Fakeplayers.MOD_ID, "not_implemented_message").toTranslationKey()).setStyle(Style.EMPTY.withColor(TextColor.parse("red")))))
.build();
addDrawableChild(this.confirm);
assert this.player != null;
assert this.humanoid != null;
if (MyComponents.FAKE_PLAYER_SITTING_COMPONENT_COMPONENT.get(this.humanoid).isSitting()) {
Expand Down
2 changes: 1 addition & 1 deletion platform-fabric-1.20.1/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.22
# Mod Properties
mod_version=1.1
mod_version=1.1.1
maven_group=com.duzo
archives_base_name=fakeplayers
# Dependencies
Expand Down
Loading

0 comments on commit 168fc85

Please sign in to comment.