Enable/Disable Rotation GUI

This commit is contained in:
KAMKEEL committed 2023-03-02 21:44:03 -05:00
1 parent cc0c83835c
commit 4976e059f5
3 files changed
+134 -121

No files matched your search

@@ -27,6 +27,7 @@ public class ModelDataShared{
public byte breasts = 0;
// Rotations
public boolean enableRotation = false;
public boolean whileStanding = true;
public boolean whileAttacking = false;
public boolean whileMoving = false;
@@ -81,9 +82,10 @@ public class ModelDataShared{
compound.setByte("Breasts", breasts);
compound.setTag("ExtraData", extra);
compound.setBoolean("PuppetStanding", whileStanding);
compound.setBoolean("PuppetAttacking", whileAttacking);
compound.setBoolean("PuppetMoving", whileMoving);
compound.setBoolean("EnableRotation", enableRotation);
compound.setBoolean("WhileStanding", whileStanding);
compound.setBoolean("WhileAttacking", whileAttacking);
compound.setBoolean("WhileMoving", whileMoving);
NBTTagList list = new NBTTagList();
for(String name : parts.keySet()){
@@ -124,9 +126,10 @@ public class ModelDataShared{
breasts = compound.getByte("Breasts");
extra = compound.getCompoundTag("ExtraData");
whileStanding = compound.getBoolean("PuppetStanding");
whileAttacking = compound.getBoolean("PuppetAttacking");
whileMoving = compound.getBoolean("PuppetMoving");
enableRotation = compound.getBoolean("EnableRotation");
whileStanding = compound.getBoolean("WhileStanding");
whileAttacking = compound.getBoolean("WhileAttacking");
whileMoving = compound.getBoolean("WhileMoving");
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
NBTTagList list = compound.getTagList("Parts", 10);
@@ -36,81 +36,85 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener
super.initGui();
int y = guiTop;
addLabel(new GuiNpcLabel(26, "gui.settings", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 6){
addButton(new GuiNpcButton(30, guiLeft + 120, y += 14, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileStanding?0:1));
addLabel(new GuiNpcLabel(30, "puppet.standing", guiLeft + 30, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(31, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileMoving?0:1));
addLabel(new GuiNpcLabel(31, "puppet.walking", guiLeft + 30, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(32, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileAttacking?0:1));
addLabel(new GuiNpcLabel(32, "puppet.attacking", guiLeft + 30, y + 5, 0xFFFFFF));
y += 24;
}
else{
addButton(new GuiNpcButton(6, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(20, "model.head", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 0){
drawSlider(y, playerdata.head);
y += 90;
}
else{
addButton(new GuiNpcButton(0, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(21, "model.body", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 1){
drawSlider(y, playerdata.body);
y += 90;
}
else{
addButton(new GuiNpcButton(1, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(22, "model.larm", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 2){
drawSlider(y, playerdata.arms);
y += 90;
}
else{
addButton(new GuiNpcButton(2, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(23, "model.rarm", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 3){
drawSlider(y, playerdata.rarms);
y += 90;
}
else{
addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(24, "model.lleg", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 4){
drawSlider(y, playerdata.legs);
y += 90;
}
else{
addButton(new GuiNpcButton(4, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(25, "model.rleg", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 5){
drawSlider(y, playerdata.rlegs);
y += 90;
}
else{
addButton(new GuiNpcButton(5, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(27, "movement.rotation", guiLeft + 55, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(14, guiLeft + 110, y , 60, 20, new String[]{"gui.enabled","gui.disabled"}, playerdata.enableRotation?0:1));
y += 24;
if(playerdata.enableRotation){
addLabel(new GuiNpcLabel(26, "gui.settings", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 6){
addButton(new GuiNpcButton(30, guiLeft + 120, y += 14, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileStanding?0:1));
addLabel(new GuiNpcLabel(30, "puppet.standing", guiLeft + 30, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(31, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileMoving?0:1));
addLabel(new GuiNpcLabel(31, "puppet.walking", guiLeft + 30, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(32, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileAttacking?0:1));
addLabel(new GuiNpcLabel(32, "puppet.attacking", guiLeft + 30, y + 5, 0xFFFFFF));
y += 24;
}
else{
addButton(new GuiNpcButton(6, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(20, "model.head", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 0){
drawSlider(y, playerdata.head);
y += 90;
}
else{
addButton(new GuiNpcButton(0, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(21, "model.body", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 1){
drawSlider(y, playerdata.body);
y += 90;
}
else{
addButton(new GuiNpcButton(1, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(22, "model.larm", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 2){
drawSlider(y, playerdata.arms);
y += 90;
}
else{
addButton(new GuiNpcButton(2, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(23, "model.rarm", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 3){
drawSlider(y, playerdata.rarms);
y += 90;
}
else{
addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(24, "model.lleg", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 4){
drawSlider(y, playerdata.legs);
y += 90;
}
else{
addButton(new GuiNpcButton(4, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
addLabel(new GuiNpcLabel(25, "model.rleg", guiLeft + 55, y + 5, 0xFFFFFF));
if(type == 5){
drawSlider(y, playerdata.rlegs);
y += 90;
}
else{
addButton(new GuiNpcButton(5, guiLeft + 110, y , 60, 20, "selectServer.edit"));
y += 24;
}
}
}
private void drawSlider(int y, ModelPartConfig config){
@@ -145,6 +149,10 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener
return;
GuiNpcButton button = (GuiNpcButton) btn;
if(btn.id == 14){
playerdata.enableRotation = button.getValue() == 0;
initGui();
}
if(btn.id == 29){
part.disabled = button.getValue() == 1;
}
@@ -446,53 +446,55 @@ public class ModelMPM extends ModelNPCMale{
setPlayerData(npc);
currentlyPlayerTexture = true;
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
if(isRotationActive(npc)){
float pi = (float) Math.PI;
if(npc.modelData.enableRotation){
if(isRotationActive(npc)){
float pi = (float) Math.PI;
if(!npc.modelData.head.disabled){
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = npc.modelData.head.rotationX * pi;
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = npc.modelData.head.rotationY * pi;
bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = npc.modelData.head.rotationZ * pi;
}
if(!npc.modelData.body.disabled){
bipedBody.rotateAngleX = npc.modelData.body.rotationX * pi;
bipedBody.rotateAngleY = npc.modelData.body.rotationY * pi;
bipedBody.rotateAngleZ = npc.modelData.body.rotationZ * pi;
}
if(!npc.modelData.arms.disabled){
bipedLeftArm.rotateAngleX = npc.modelData.arms.rotationX * pi;
bipedLeftArm.rotateAngleY = npc.modelData.arms.rotationY * pi;
bipedLeftArm.rotateAngleZ = npc.modelData.arms.rotationZ * pi;
if(!npc.display.disableLivingAnimation){
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
if(!npc.modelData.head.disabled){
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = npc.modelData.head.rotationX * pi;
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = npc.modelData.head.rotationY * pi;
bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = npc.modelData.head.rotationZ * pi;
}
}
if(!npc.modelData.rarms.disabled){
bipedRightArm.rotateAngleX = npc.modelData.rarms.rotationX * pi;
bipedRightArm.rotateAngleY = npc.modelData.rarms.rotationY * pi;
bipedRightArm.rotateAngleZ = npc.modelData.rarms.rotationZ * pi;
if(!npc.display.disableLivingAnimation){
this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
if(!npc.modelData.body.disabled){
bipedBody.rotateAngleX = npc.modelData.body.rotationX * pi;
bipedBody.rotateAngleY = npc.modelData.body.rotationY * pi;
bipedBody.rotateAngleZ = npc.modelData.body.rotationZ * pi;
}
}
if(!npc.modelData.rlegs.disabled){
bipedRightLeg.rotateAngleX = npc.modelData.rlegs.rotationX * pi;
bipedRightLeg.rotateAngleY = npc.modelData.rlegs.rotationY * pi;
bipedRightLeg.rotateAngleZ = npc.modelData.rlegs.rotationZ * pi;
}
if(!npc.modelData.arms.disabled){
bipedLeftArm.rotateAngleX = npc.modelData.arms.rotationX * pi;
bipedLeftArm.rotateAngleY = npc.modelData.arms.rotationY * pi;
bipedLeftArm.rotateAngleZ = npc.modelData.arms.rotationZ * pi;
if(!npc.modelData.legs.disabled){
bipedLeftLeg.rotateAngleX = npc.modelData.legs.rotationX * pi;
bipedLeftLeg.rotateAngleY = npc.modelData.legs.rotationY * pi;
bipedLeftLeg.rotateAngleZ = npc.modelData.legs.rotationZ * pi;
if(!npc.display.disableLivingAnimation){
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
}
}
if(!npc.modelData.rarms.disabled){
bipedRightArm.rotateAngleX = npc.modelData.rarms.rotationX * pi;
bipedRightArm.rotateAngleY = npc.modelData.rarms.rotationY * pi;
bipedRightArm.rotateAngleZ = npc.modelData.rarms.rotationZ * pi;
if(!npc.display.disableLivingAnimation){
this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
}
}
if(!npc.modelData.rlegs.disabled){
bipedRightLeg.rotateAngleX = npc.modelData.rlegs.rotationX * pi;
bipedRightLeg.rotateAngleY = npc.modelData.rlegs.rotationY * pi;
bipedRightLeg.rotateAngleZ = npc.modelData.rlegs.rotationZ * pi;
}
if(!npc.modelData.legs.disabled){
bipedLeftLeg.rotateAngleX = npc.modelData.legs.rotationX * pi;
bipedLeftLeg.rotateAngleY = npc.modelData.legs.rotationY * pi;
bipedLeftLeg.rotateAngleZ = npc.modelData.legs.rotationZ * pi;
}
}
}
renderHead(npc, par7);