Add ModAPI.player.sendChatMessage, along with automatic this type of change

This commit is contained in:
ZXMushroom63 2024-09-05 15:29:19 +08:00
parent 176159bc47
commit 9a623de631
3 changed files with 22 additions and 2 deletions

View File

@ -54,6 +54,9 @@
border-radius: 0.6rem; border-radius: 0.6rem;
padding-left: 8px; padding-left: 8px;
} }
h6 {
font-weight: normal;
}
</style> </style>
</head> </head>
<body> <body>
@ -123,6 +126,11 @@
<script src="filesaver.min.js"></script> <script src="filesaver.min.js"></script>
<script> <script>
document.querySelector("#htmlFile").addEventListener("input", (e)=>{
if (e.target.files[0]) {
document.querySelector(".custom-file-label").innerText = e.target.files[0].name;
}
});
function entriesToStaticVariableProxy(entries, prefix) { function entriesToStaticVariableProxy(entries, prefix) {
var getComponents = ""; var getComponents = "";
entries.forEach((entry) => { entries.forEach((entry) => {
@ -355,8 +363,6 @@ var main;(function(){`
} }
}); });
console.log(prefix);
var proxy = entriesToStaticVariableProxy(entries, prefix); var proxy = entriesToStaticVariableProxy(entries, prefix);
return proxy + "\n" + match; return proxy + "\n" + match;

View File

@ -146,6 +146,13 @@ globalThis.modapi_postinit = `(() => {
}, },
methodName: method methodName: method
}; };
//Prototype Injection, allows for far easier access to methods
if (typeof item === "function" && item.$meta && ModAPI.hooks._rippedMethodTypeMap[method] === "instance") {
item.prototype["$" + method.replace(compiledName + "_", "")] ||= function (...args) {
return ModAPI.hooks.methods[method].apply(this, [this, ...args]);
}
}
} }
}); });
}); });

View File

@ -146,6 +146,13 @@
}, },
methodName: method methodName: method
}; };
//Prototype Injection, allows for far easier access to methods
if (typeof item === "function" && item.$meta && ModAPI.hooks._rippedMethodTypeMap[method] === "instance") {
item.prototype["$" + method.replace(compiledName + "_", "")] ||= function (...args) {
return ModAPI.hooks.methods[method].apply(this, [this, ...args]);
}
}
} }
}); });
}); });