Skip to content

Commit

Permalink
fixed names and nullptrs for scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerrrs committed May 11, 2024
1 parent b047d50 commit 258ea76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/java/keystrokesmod/script/classes/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ public boolean isInLava() {
}

public boolean isOnLadder() {
int i = MathHelper.floor_double(entity.posX);
int j = MathHelper.floor_double(entity.posY - 0.20000000298023224D);
int k = MathHelper.floor_double(entity.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
int posX = MathHelper.floor_double(entity.posX);
int posY = MathHelper.floor_double(entity.posY - 0.20000000298023224D);
int posZ = MathHelper.floor_double(entity.posZ);
BlockPos blockpos = new BlockPos(posX, posY, posZ);
Block block1 = Minecraft.getMinecraft().theWorld.getBlockState(blockpos).getBlock();
return block1 instanceof BlockLadder && !entity.onGround;
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/keystrokesmod/script/classes/Json.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public String get(String key, String defaultValue) {
}

public Json object(String name) {
return new Json(this.jsonObject == null ? null : this.jsonObject.get(name).getAsJsonObject(), 0);
if (this.jsonObject == null || this.jsonObject.get(name) == null) {
return new Json(null, 0);
}
return new Json(this.jsonObject.get(name).getAsJsonObject(), 0);
}

public Json object() {
Expand Down

0 comments on commit 258ea76

Please sign in to comment.