Port fps boost, nodynamicfov, add onupdate event.

This commit is contained in:
ThisIsALegitUsername 2022-12-28 23:28:20 +00:00
parent a4f04313f5
commit 52c3f0d360
19 changed files with 71698 additions and 64922 deletions

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
eaglercraft-workspace

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="zulu-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/eaglercraft-workspace.iml" filepath="$PROJECT_DIR$/eaglercraft-workspace.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

3682
.idea/workspace.xml Normal file

File diff suppressed because it is too large Load Diff

21
eaglercraft-workspace.iml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<conelement value="org.eclipse.buildship.core.gradleclasspathcontainer" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src/main/java" expected_position="0" />
<src_folder value="file://$MODULE_DIR$/src/teavm/java" expected_position="1" />
</src_description>
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin/default" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/teavm/java" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
<orderEntry type="library" name="org.eclipse.buildship.core.gradleclasspathcontainer" level="application" />
</component>
</module>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ import dev.resent.module.base.Mod;
public class FPSB extends Mod{
public boolean yes = false;
public static boolean yes = false;
public FPSB(){
super("Fps Boost", Category.MISC);

View File

@ -1,5 +1,6 @@
package net.minecraft.client.entity;
import dev.resent.util.misc.W;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.network.NetworkPlayerInfo;
@ -74,18 +75,20 @@ public abstract class AbstractClientPlayer extends EntityPlayer {
public float getFovModifier() {
float f = 1.0F;
if (this.capabilities.isFlying) {
if (this.capabilities.isFlying && !W.dynamicFOV().isEnabled()) {
f *= 1.1F;
}
IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
f = (float) ((double) f
* ((iattributeinstance.getAttributeValue() / (double) this.capabilities.getWalkSpeed() + 1.0D) / 2.0D));
if(!W.dynamicFOV().isEnabled()){
f = (float) ((double) f * ((iattributeinstance.getAttributeValue() / (double) this.capabilities.getWalkSpeed() + 1.0D) / 2.0D));
}
if (this.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f)) {
f = 1.0F;
}
if (this.isUsingItem() && this.getItemInUse().getItem() == Items.bow) {
if (this.isUsingItem() && this.getItemInUse().getItem() == Items.bow && !W.dynamicFOV().isEnabled()) {
int i = this.getItemInUseDuration();
float f1 = (float) i / 20.0F;
if (f1 > 1.0F) {

View File

@ -1,5 +1,7 @@
package net.minecraft.client.entity;
import dev.resent.Resent;
import dev.resent.event.impl.EventUpdate;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.MovingSoundMinecartRiding;
import net.minecraft.client.audio.PositionedSoundRecord;
@ -594,6 +596,10 @@ public class EntityPlayerSP extends AbstractClientPlayer {
* to react to sunlight and start to burn.
*/
public void onLivingUpdate() {
EventUpdate event = new EventUpdate();
Resent.INSTANCE.events().post(event);
if (this.sprintingTicksLeft > 0) {
--this.sprintingTicksLeft;
if (this.sprintingTicksLeft == 0) {

View File

@ -1,5 +1,6 @@
package net.minecraft.util;
import dev.resent.module.impl.misc.FPSB;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
@ -28,23 +29,25 @@ public class MathHelper {
* (exclusive), with steps of 2*PI / 65536.
*/
private static final float[] SIN_TABLE = new float[65536];
private static final float[] SIN_TABLE_FAST = new float[4096];
private static final int[] multiplyDeBruijnBitPosition;
private static final double field_181163_d;
private static final double[] field_181164_e;
private static final double[] field_181165_f;
public static boolean fps = FPSB.yes;
/**+
* sin looked up in a table
*/
public static float sin(float parFloat1) {
return SIN_TABLE[(int) (parFloat1 * 10430.378F) & '\uffff'];
return fps ? SIN_TABLE_FAST[(int) (parFloat1 * 651.8986f) & 4095] : SIN_TABLE[(int) (parFloat1 * 10430.378F) & '\uffff'];
}
/**+
* cos looked up in the sin table with the appropriate offset
*/
public static float cos(float value) {
return SIN_TABLE[(int) (value * 10430.378F + 16384.0F) & '\uffff'];
return fps ? SIN_TABLE_FAST[(int)((value + ((float)Math.PI / 2f)) * 651.8986f) & 4095] : SIN_TABLE[(int) (value * 10430.378F + 16384.0F) & '\uffff'];
}
public static float sqrt_float(float value) {
@ -491,6 +494,14 @@ public class MathHelper {
SIN_TABLE[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D);
}
for (int j = 0; j < 4096; ++j) {
SIN_TABLE_FAST[j] = (float) Math.sin((double) (((float) j + 0.5f) / 4096.0f * ((float) Math.PI * 2f)));
}
for(int l = 0; l < 360; l += 90){
SIN_TABLE_FAST[(int)((float)l * 11.377778f) & 4095] = (float)Math.sin((double)((float)l * 0.017453292f));
}
multiplyDeBruijnBitPosition = new int[] { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13,
23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
field_181163_d = Double.longBitsToDouble(4805340802404319232L);