Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TechPizzaDev committed Jul 29, 2023
1 parent ef88547 commit 1e1b24b
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.SwingUtilities;

Expand Down Expand Up @@ -158,8 +157,8 @@ void ratingClicked(int var1, int var2) {
});
}

void getLines(String var1, List<String> var2) {
String[] var3 = var1.split(" ");
void getLines(String text, List<String> output) {
String[] var3 = text.split(" ");
String var4 = "";
String[] var5 = var3;
int var6 = var3.length;
Expand All @@ -171,7 +170,7 @@ void getLines(String var1, List<String> var2) {
} else {
String var9 = var4 + " " + var8;
if (Minecraft.instance.textRenderer.getTextWidth(var9) > 100) {
var2.add(var4);
output.add(var4);
var4 = var8;
} else {
var4 = var9;
Expand All @@ -180,7 +179,7 @@ void getLines(String var1, List<String> var2) {
}

if (!var4.equals("")) {
var2.add(var4);
output.add(var4);
}
}

Expand All @@ -197,7 +196,7 @@ void fadeDescriptionOut() {
}

@Override
public void render(TextRenderer var1, TextureManager var2, float var3) {
public void render(TextRenderer textRenderer, TextureManager texManager, float deltaTime) {
if (this.fadeIn || this.fadeOut) {
long var4 = System.nanoTime();
long var6 = var4 - this.fadeTimePrev;
Expand Down Expand Up @@ -251,7 +250,7 @@ public void render(TextRenderer var1, TextureManager var2, float var3) {
}
}

super.render(var1, var2, var3);
super.render(textRenderer, texManager, deltaTime);
}

public void setAsDownloaded() {
Expand Down
90 changes: 46 additions & 44 deletions src/main/java/dev/adventurecraft/awakening/script/ScriptEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,23 @@ ScriptVec3 getPosition(float deltaTime) {
dtSub * this.entity.prevZ + dt * this.entity.z);
}

public void setPosition(ScriptVec3 var1) {
this.setPosition(var1.x, var1.y, var1.z);
public void setPosition(ScriptVec3 vec) {
this.setPosition(vec.x, vec.y, vec.z);
}

public void setPosition(double var1, double var3, double var5) {
this.entity.setPosition(var1, var3, var5);
public void setPosition(double x, double y, double z) {
this.entity.setPosition(x, y, z);
}

public ScriptVecRot getRotation() {
return new ScriptVecRot(this.entity.yaw, this.entity.pitch);
}

ScriptVecRot getRotation(float var1) {
float var2 = 1.0F - var1;
return new ScriptVecRot(var2 * this.entity.prevYaw + var1 * this.entity.yaw, var2 * this.entity.prevPitch + var1 * this.entity.pitch);
ScriptVecRot getRotation(float deltaTime) {
float dtSub = 1.0F - deltaTime;
return new ScriptVecRot(
dtSub * this.entity.prevYaw + deltaTime * this.entity.yaw,
dtSub * this.entity.prevPitch + deltaTime * this.entity.pitch);
}

public void setRotation(float yaw, float pitch) {
Expand All @@ -103,29 +105,29 @@ public ScriptVec3 getVelocity() {
return new ScriptVec3(this.entity.xVelocity, this.entity.yVelocity, this.entity.zVelocity);
}

public void setVelocity(ScriptVec3 var1) {
this.setVelocity(var1.x, var1.y, var1.z);
public void setVelocity(ScriptVec3 vec) {
this.setVelocity(vec.x, vec.y, vec.z);
}

public void setVelocity(double var1, double var3, double var5) {
this.entity.setVelocity(var1, var3, var5);
public void setVelocity(double x, double y, double z) {
this.entity.setVelocity(x, y, z);
}

public void addVelocity(ScriptVec3 var1) {
this.addVelocity(var1.x, var1.y, var1.z);
public void addVelocity(ScriptVec3 vec) {
this.addVelocity(vec.x, vec.y, vec.z);
}

public void addVelocity(double var1, double var3, double var5) {
this.entity.accelerate(var1, var3, var5);
public void addVelocity(double x, double y, double z) {
this.entity.accelerate(x, y, z);
}

public void setDead() {
this.entity.remove();
}

public void mountEntity(ScriptEntity var1) {
if (var1 != null) {
this.entity.startRiding(var1.entity);
public void mountEntity(ScriptEntity entity) {
if (entity != null) {
this.entity.startRiding(entity.entity);
} else {
this.entity.startRiding(null);
}
Expand Down Expand Up @@ -169,8 +171,8 @@ public ScriptEntity[] getEntitiesWithinRange(double range) {
return list.toArray(new ScriptEntity[0]);
}

public ScriptEntity dropItem(ScriptItem var1) {
return getEntityClass(this.entity.dropItem(var1.item, 0.0F));
public ScriptEntity dropItem(ScriptItem item) {
return getEntityClass(this.entity.dropItem(item.item, 0.0F));
}

public boolean isInsideOfWater() {
Expand All @@ -185,52 +187,52 @@ public boolean getImmuneToFire() {
return this.entity.immuneToFire;
}

public void setImmuneToFire(boolean var1) {
this.entity.immuneToFire = var1;
public void setImmuneToFire(boolean value) {
this.entity.immuneToFire = value;
}

public int getFireLevel() {
return this.entity.fireTicks;
}

public void setFireLevel(int var1) {
this.entity.fireTicks = var1;
public void setFireLevel(int value) {
this.entity.fireTicks = value;
}

public int getFireResistance() {
return this.entity.field_1646;
}

public void setFireResistance(int var1) {
this.entity.field_1646 = var1;
public void setFireResistance(int value) {
this.entity.field_1646 = value;
}

public int getAir() {
return this.entity.air;
}

public void setAir(int var1) {
this.entity.air = var1;
public void setAir(int value) {
this.entity.air = value;
}

public int getMaxAir() {
return this.entity.field_1648;
}

public void setMaxAir(int var1) {
this.entity.field_1648 = var1;
public void setMaxAir(int value) {
this.entity.field_1648 = value;
}

public int getStunned() {
return ((ExEntity) this.entity).getStunned();
}

public void setStunned(int var1) {
((ExEntity) this.entity).setStunned(var1);
public void setStunned(int value) {
((ExEntity) this.entity).setStunned(value);
}

public boolean attackEntityFrom(ScriptEntity var1, int var2) {
return this.entity.damage(var1.entity, var2);
public boolean attackEntityFrom(ScriptEntity entity, int damage) {
return this.entity.damage(entity.entity, damage);
}

public String getClassType() {
Expand All @@ -242,30 +244,30 @@ public boolean getCollidesWithClipBlocks() {
return ((ExEntity) this.entity).getCollidesWithClipBlocks();
}

public void setCollidesWithClipBlocks(boolean var1) {
((ExEntity) this.entity).setCollidesWithClipBlocks(var1);
public void setCollidesWithClipBlocks(boolean value) {
((ExEntity) this.entity).setCollidesWithClipBlocks(value);
}

public float getHeight() {
return this.entity.height;
}

public void setHeight(float var1) {
this.entity.height = var1;
public void setHeight(float value) {
this.entity.height = value;
this.entity.setPosition(this.entity.x, this.entity.y, this.entity.z);
}

public float getWidth() {
return this.entity.width;
}

public void setWidth(float var1) {
this.entity.width = var1;
public void setWidth(float value) {
this.entity.width = value;
this.entity.setPosition(this.entity.x, this.entity.y, this.entity.z);
}

public void setIsFlying(boolean var1) {
((ExEntity) this.entity).setIsFlying(var1);
public void setIsFlying(boolean value) {
((ExEntity) this.entity).setIsFlying(value);
}

public boolean getIsFlying() {
Expand Down Expand Up @@ -298,7 +300,7 @@ public float getyOffset() {
return this.entity.standingEyeHeight;
}

public void setyOffset(float var1) {
this.entity.standingEyeHeight = var1;
public void setyOffset(float value) {
this.entity.standingEyeHeight = value;
}
}
Loading

0 comments on commit 1e1b24b

Please sign in to comment.