1
0
Fork 0
mirror of https://github.com/haselkern/Minecraft-ArmorStand.git synced 2025-05-18 05:55:35 +00:00

Add support for scoreboard tags

Closes #42
This commit is contained in:
Lenny Lord 2022-07-16 16:54:48 +05:30
parent 66f12af03f
commit 4305257f0a
2 changed files with 36 additions and 6 deletions

View file

@ -219,6 +219,14 @@
</div> </div>
</div> </div>
<div class="padding underline">
<p>
Add scoreboard tags to your armor stand.<br/>
When adding multiple tags, make sure they are separated by a comma ' , '
</p>
<input type="text" name="scoreboardtags" id="scoreboardtags" placeholder="Tag1, Tag2">
</div>
<div class="padding"> <div class="padding">
<!-- THANK YOU to reddit user Oozebull for this part. --> <!-- THANK YOU to reddit user Oozebull for this part. -->
<label><input type="checkbox" id="slashgive" name="slashgive">Make /give</label> <label><input type="checkbox" id="slashgive" name="slashgive">Make /give</label>

View file

@ -70,6 +70,9 @@ var nameStrikethrough;
var useDisabledSlots; var useDisabledSlots;
var scoreboardTags;
//The rotation values are all in degrees. //The rotation values are all in degrees.
var head = new THREE.Vector3(0,0,0); var head = new THREE.Vector3(0,0,0);
var body = new THREE.Vector3(0,0,0); var body = new THREE.Vector3(0,0,0);
@ -383,6 +386,8 @@ function handleInput(){
nameObfuscated = getCheckBoxInput("nameobfuscated"); nameObfuscated = getCheckBoxInput("nameobfuscated");
nameStrikethrough = getCheckBoxInput("namestrikethrough"); nameStrikethrough = getCheckBoxInput("namestrikethrough");
scoreboardTags = getInput("scoreboardtags");
useDisabledSlots = getCheckBoxInput("usedisabledslots"); useDisabledSlots = getCheckBoxInput("usedisabledslots");
give = getCheckBoxInput("slashgive"); give = getCheckBoxInput("slashgive");
@ -502,15 +507,15 @@ function updateUI(){
} }
// Generate code // Generate code
$("#code").text(generateCode()); const generatedCode = generateCode();
$("#code").text(generatedCode);
// Show hint, when command is too long // Show hint, when command is too long
let characterLimit = (mcVersion == "1.8" || mcVersion == "1.9") ? 100 : 256; const characterLimit = (mcVersion == "1.8" || mcVersion == "1.9") ? 100 : 256;
if(generateCode().length > characterLimit){ if (generatedCode.length > characterLimit)
$("#codeinfo").slideDown(); $("#codeinfo").slideDown();
} else
else{
$("#codeinfo").slideUp(); $("#codeinfo").slideUp();
}
// Rotate 3D Stuff // Rotate 3D Stuff
@ -674,6 +679,19 @@ function generateCode(){
if(showCustomName) if(showCustomName)
tags.push("CustomNameVisible:1b"); tags.push("CustomNameVisible:1b");
//Scoreboard tags
if (scoreboardTags) {
const tagsList = scoreboardTags.split(',');
if (!tagsList[tagsList.length - 1].trim())
tagsList.pop();
for (let i = 0; i < tagsList.length; i++)
tagsList[i] = `"${tagsList[i].trim()}"`;
tags.push(`Tags:[${tagsList.join(",")}]`);
}
//DisabledSlots //DisabledSlots
if(useDisabledSlots){ if(useDisabledSlots){
tags.push("DisabledSlots:"+calculateDisabledSlotsFlag()); tags.push("DisabledSlots:"+calculateDisabledSlotsFlag());
@ -1060,6 +1078,8 @@ function saveData() {
} }
}, },
scoreboard_tags: getInput("scoreboardtags"),
lock_slot_interaction: { lock_slot_interaction: {
enabled: $("input[name=usedisabledslots]").is(":checked"), enabled: $("input[name=usedisabledslots]").is(":checked"),
remove: { remove: {
@ -1172,6 +1192,8 @@ function loadData(data) {
$("input[name=nameobfuscated]").prop(`checked`, data.custom_name.options.obfuscated); $("input[name=nameobfuscated]").prop(`checked`, data.custom_name.options.obfuscated);
$("input[name=namestrikethrough]").prop(`checked`, data.custom_name.options.strikethrough); $("input[name=namestrikethrough]").prop(`checked`, data.custom_name.options.strikethrough);
$("input[name=scoreboardtags]").val(data.scoreboard_tags);
//lock slot interaction //lock slot interaction
$("input[name=usedisabledslots]").prop(`checked`, data.lock_slot_interaction.enabled); $("input[name=usedisabledslots]").prop(`checked`, data.lock_slot_interaction.enabled);