Most convoluted way of doing things

This commit is contained in:
Nameless-123 committed 2020-04-26 12:03:14 +02:00
1 parent cdfce6f005
commit 2873494f5c
1 file changed
+22
@@ -10,6 +10,7 @@ import carpet.script.EntityEventsGroup;
import carpet.script.exception.InternalExpressionException;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.network.packet.s2c.play.EntityPassengersSetS2CPacket;
import net.minecraft.network.packet.s2c.play.EntityPositionS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
@@ -919,6 +920,27 @@ public class EntityValue extends Value
((LivingEntity) e).setJumping(v.getBoolean());
});
put("jump",(e,v)->{//Most *REDACTED* up code in the world
float m = e.world.getBlockState(new BlockPos(e)).getBlock().getJumpVelocityMultiplier();
float g = e.world.getBlockState(new BlockPos(e.getX(), e.getBoundingBox().y1 - 0.5000001D, e.getZ())).getBlock().getJumpVelocityMultiplier();
float JumpVelocityMultiplier= (double)m == 1.0D ? g : m;
float f = (0.42F * JumpVelocityMultiplier);
if (((LivingEntity)e).hasStatusEffect(StatusEffects.JUMP_BOOST)) {
f += 0.1F * (float)(((LivingEntity)e).getStatusEffect(StatusEffects.JUMP_BOOST).getAmplifier() + 1);
}
Vec3d vec3d = e.getVelocity();
e.setVelocity(vec3d.x, (double)f, vec3d.z);
if (e.isSprinting()) {
float u = e.yaw * 0.017453292F;
e.setVelocity(e.getVelocity().add((double)(-MathHelper.sin(g) * 0.2F), 0.0D, (double)(MathHelper.cos(u) * 0.2F)));
}
e.velocityDirty = true;
});
// gamemode [check]
// spectate [check]
// "fire" []