mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-23 14:11:16 -09:00
update blocklook
This commit is contained in:
parent
fa976e97e9
commit
9088777439
@ -8,4 +8,7 @@ TeaVM will add suffixes to some variables, seemingly randomly. An example is the
|
||||
When I was trying to hook into the server-side processing of chat messages, I found that chat packets were handled by the method `processChatMessage` in `NetHandlerPlayServer`. However, in the compiled JavaScript, this method no longer exists. This is because it is only used once, in the `processPacket` method of `C01PacketChatMessage`. TeaVM automatically saw this, and collapsed one method into the other.
|
||||
|
||||
#### Dedicated Server Not Responding / Client Not Responding
|
||||
Incorrectly patching methods with ModAPI.hooks (such as returning `false` instead of `0`, or a javascript string without using `ModAPI.str()`) will effectively cause the memory stack to implode, along with all crash handlers. I came across this when I was using the `processcommand` event with preventDefault set to true. I didn't return any value when patching methods for the event being `preventDefault`ed, when the output expected was a java boolean (`0`/`1`). This would cause the dedicated server to freeze/lock up, without triggering any form of crash.
|
||||
Incorrectly patching methods with ModAPI.hooks (such as returning `false` instead of `0`, or a javascript string without using `ModAPI.str()`) will effectively cause the memory stack to implode, along with all crash handlers. I came across this when I was using the `processcommand` event with preventDefault set to true. I didn't return any value when patching methods for the event being `preventDefault`ed, when the output expected was a java boolean (`0`/`1`). This would cause the dedicated server to freeze/lock up, without triggering any form of crash.
|
||||
|
||||
Update 13/09/2024:
|
||||
Any form of incorrect data type, even passing the wrong values, can cause this sort of hang. I encountered this when trying to set a block in the world to any form of wood or leaf block, without adding iproperties to the tree type.
|
@ -45,7 +45,7 @@ ModAPI.dedicatedServer.appendCode(function () {
|
||||
var t = 0;
|
||||
ModAPI.addEventListener("tick", () => {
|
||||
t++;
|
||||
if (t > 2) {
|
||||
if (t > 20) {
|
||||
t = 0;
|
||||
} else {
|
||||
return;
|
||||
@ -63,15 +63,20 @@ ModAPI.dedicatedServer.appendCode(function () {
|
||||
lookVector.addVector(start.$xCoord, start.$yCoord, start.$zCoord);
|
||||
var hitResult = rayTraceMethod(pair.world.getRef(), start, lookVector.getRef(), 0);
|
||||
if (hitResult) {
|
||||
var blockPos = blockPosConstructor(parseInt(hitResult.$hitVec.$xCoord), parseInt(hitResult.$hitVec.$yCoord), parseInt(hitResult.$hitVec.$zCoord));
|
||||
console.log(hitResult);
|
||||
var blockPos = hitResult.$blockPos;
|
||||
if (!pair.world.isBlockLoaded(blockPos)) {
|
||||
console.log("[BlockLook] Block is not loaded!");
|
||||
}
|
||||
var blockType = blockTypesList[Math.floor(Math.random() * blockTypesList.length)];
|
||||
blockType = ModAPI.blocks[blockType];
|
||||
if (!blockType.fullBlock) {
|
||||
return;
|
||||
}
|
||||
console.log(ModAPI.util.unstr(blockType.unlocalizedName.getRef()));
|
||||
var block = blockType.getDefaultState().getRef();
|
||||
pair.world.setBlockState(blockPos, block, 3);
|
||||
console.log("[BlockLook] " + ModAPI.util.unstr(blockType.unlocalizedName.getRef()));
|
||||
var block = blockType.getDefaultState();
|
||||
pair.world.setBlockState(blockPos, block.getRef(), 2);
|
||||
pair.world.notifyNeighborsRespectDebug(blockPos, block.getRef());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user